开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜