• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Maven 2 to Maven 3 up-gradation: Issue on version attribute

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This problem faced while migrated the code from maven 2 to maven 3.

I have a master POM and project pom structure.
In project pom (means a project having their own pom which inherits some properties form master pom)
version uses expression which is defined in master pom.
Earlier we were using Maven 2, and there was not any issue, until we migrated to maven 3.

Warning coming is-

[WARNING] Some problems were encountered while building the effective model for com.mycompany.myservice:myservice:jar:MyBranch-1.0
[WARNING] 'version' contains an expression but should be a constant. @ com.mycompany.myservice:myservice:${myserviceVersion}, pom.xml line 11, column 14
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.


Following is the structure in project pom--

<name>MyProject</name>
<groupId>com.mycompany.myservice</groupId>
<artifactId>myservice</artifactId>
<version>${myserviceVersion}</version>
<packaging>jar</packaging>



"myserviceVersion" is defined in master pom as follows--

<myserviceVersion>${BranchUsed}-${BranchVersion}</myserviceVersion>

<BranchUsed>MyBranch</BranchUsed>
<BranchVersion>1.0</BranchVersion>



Got this link where it shows that similar issue is in OPEN state--
http://jira.codehaus.org/browse/MNG-4715

Need a thought if we have any workaround for this?

Thanks,
Arfeen.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need to remove the property reference from the <version> tag; as long as you have the version reference there Maven will complain. WE ran into the same thing when we went from Maven 2 to Maven 3 - Maven 3 wants hard-coded version numbers. We ended up writing our own plugin to set the version during the validate phase.

The Versions plugin might be able to help: http://mojo.codehaus.org/versions-maven-plugin/
 
arfeen khan
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Peter for valuable response.
Let me see what can i do with custom plugin.
 
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic