开发者

Alter settings.xml from a maven plugin

开发者 https://www.devze.com 2023-02-22 18:12 出处:网络
Is it possible to access content of user settings.xml file from a maven plugin Mojo ? And if so, how ?

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

精彩评论

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