简体   繁体   中英

Release maven project removing automatically SNAPSHOT dependencies

I want to make my first release of a multi-module maven project using the maven release plugin. I´m facing a problem in the release:prepare step because I have SNAPSHOT dependencies.

<project ...> 

   <parent>
      <artifactId>project</artifactId>
      <groupId>ccc.aaa.bbb</groupId>
      <version>0.0.1-SNAPSHOT</version>
   </parent>

  <artifactId>common</artifactId>
  <packaging>pom</packaging>
  <name>common</name>

  <modules>
     <module>daoModule</module>
     <module>configModule</module>
     <module>exceptionModule</module>
  </modules>

   <scm>
     ...    
   </scm>
   <distributionManagement>
       <repository>...</repository>
       <snapshotRepository>...</snapshotRepository>
   </distributionManagement>
</project>

And the modules extend this as its parent:

<project ...>
<parent>
   <artifactId>common</artifactId>
   <groupId>ccc.aaa.bbb</groupId>
   <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>exceptionModule</artifactId>
  <name>exceptionModule</name>

<build>
        ...

The plugin changes the the version of the artifact 0.0.1-SNAPSHOT to a release version 0.0.1 , and creates the new snapshot version id 0.0.2-SNAPSHOT.

¿Is there any way to change automatically the version of the parents from 0.0.1-SNAPSHOT to 0.0.1 - the release that is going to be created-?

Thanks.

It should work when doing release:prepare from the aggregator project level that contains all the modules you're interested in. So your common , project artifacts and all the modules should be released at once. Also look at autoVersionSubmodules switch to do a little less typing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM