jira-importer commented on issue #142:
URL: 
https://github.com/apache/maven-install-plugin/issues/142#issuecomment-2771839942

   **[Matthew 
Jaskula](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=mjaskula)**
 commented
   
   Here is a simple workaround to allow version numbers from the command line 
to override the version used by the install and deploy plugins. In our case the 
continuous integration server is providing the version number, which includes a 
build number. I didn't test group or artifact ids, but this same scheme may 
work for them as well.
   
   By using a level of indirection you can pass a version number in to the pom 
at build time and have the install and deploy plugins use them. For example:
   
       <project xmlns="..." xmlns:xsi="..." xsi:schemaLocation="...">
         <modelVersion>4.0.0</modelVersion>
         <groupId>org.codehaus</groupId>
         <artifactId>codehaus</artifactId>
         <version>${ciVersion}</version>
         <packaging>jar</packaging>
         
         <properties>
           <ciVersion>0.0.0.0</ciVersion>
         </properties>
       
         ...
       
       </project>
   
   We cannot override ${project.version} directly. So instead, we add a second 
property called 'ciVersion' and give it a default value of '0.0.0.0' in the 
properties section. Now the CI server can specify a version number by 
overriding the ciVersion property on the command line. As in:
   
       mvn -DciVersion=1.0.0.25 install
   
   The install and deploy plugins will use the value of the ciVersion property 
that was passed in whenever ${project.version} is referenced, as expected, and 
the default value will be used when no version is provided on the command line.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to