Alter settings.xml from a maven plugin
Is it possible to access content of user settings.xml
file from a maven plugin Mojo ?
And if so, how ?
I woul开发者_C百科d like to alter this file in order to put in some user-specific configuration.
This can simply be achieved by injecting the Settings into your Mojo:
/**
* @parameter default-value="${settings}"
*/
private Settings settings;
for reading the Settings
Object see khmarbaise's answer, and for writing the modified settings back, use a SettingsWriter
:
/**
* @component role="org.apache.maven.settings.io.SettingsWriter"
*/
private SettingsWriter settingsWriter;
精彩评论