Maven versions plugin: reference a rule.xml from a maven dependency?

匿名 (未验证) 提交于 2019-12-03 01:34:02

问题:

I am using the mvn versions:display-dependency-updates versions:display-plugin-updates goals to check for dependencies or plugins updates.

My maven project is a multi module one, which looks like this:

moduleA  |- moduleB1  |    |- moduleC    |- moduleB2  |- build-config/rules.xml

Since there is some unwanted updates, like betas I don't want, I've made a filter (which works). I use it like that:

<profile>   <id>maven-version-plugin-1</id>   <activation>     <property>       <name>version.rules.uri</name>     </property>   </activation>   <build>     <plugins>       <plugin>         <groupId>org.codehaus.mojo</groupId>         <artifactId>versions-maven-plugin</artifactId>         <configuration>           <rulesUri>${version.rules.uri}</rulesUri>         </configuration>       </plugin>     </plugins>   </build> </profile>

I am forced to use a profile and a property version.rules.uri because it must refer to an existing file (by default it points to ./build-config/rules.xml, but it is also in my settings.xml with an absolute path).

I'd like to avoid that by:

  • publishing an independent build-config project
  • referencing this project using some uri: m2:myGroupId:myArtifactId:version:scope:jar/rules.xml

Now the question: is there an implementation of Maven Wagon Plugin (which is used by maven versions plugin) that allow for reading a repository entry such as a jar ?

回答1:

This works for me:

<rulesUri>file:///${session.executionRootDirectory}/maven-version-rules.xml</rulesUri>

For the meaning of the variable ${session.executionRootDirectory}, see Finding the root directory of a multi module maven reactor project



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!