You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jose Vicente Nunez Zuleta <un...@stupidzombie.com> on 2012/01/15 16:30:50 UTC

'version' contains an expression but should be a constant. Better way to add a new version?

Hi,

I want to compile and deploy release artifacts on daily basis to my Maven repository, each version different from the other;  Ideally I want to setup a property to do this but Maven complains very strongly about it:

Macintosh:walker josevnz$ mvn package -Dwalker.version=20120115
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.stupidzombie:walker:jar:20120115
[WARNING] 'version' contains an expression but should be a constant. @ com.stupidzombie:walker:${walker.version}, /Users/josevnz/Documents/stupidzombie/kenai/stupidzombie~source-code-repository/branches/walker/pom.xml, line 6, column 12
[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.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building walker 20120115
[INFO] ------------------------------------------------------------------------
[INFO] 

So it seems that I cannot use a variable on the <version> tag in my pom. What is the right way to do this?:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.stupidzombie</groupId>
  <artifactId>walker</artifactId>
  <version>${walker.version}</version>
  <packaging>jar</packaging>
  <name>walker</name>
  <url>http://stupidzombie.com</url>

Thanks in advance,

--Jose



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: 'version' contains an expression but should be a constant. Better way to add a new version?

Posted by Ron Wheeler <rw...@artifact-software.com>.
It looks like you are trying to use releases when you want SNAPSHOTS.
Releases should come with a warranty and a specification (written or 
implied).
SNAPSHOTS do not.


Ron


On 15/01/2012 8:00 PM, Jose Vicente Nunez Zuleta wrote:
> Hello Stephen,
>
> mvn versions:set -DnewVersion=0.1
> mvn versions:commit
>
> Work like a charm, thanks!
>
> On Jan 15, 2012, at 12:31 PM, Stephen Connolly wrote:
>
>> mvn versions:set
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Ron Wheeler
President
Artifact Software Inc
email: rwheeler@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102



Re: 'version' contains an expression but should be a constant. Better way to add a new version?

Posted by Jose Vicente Nunez Zuleta <un...@stupidzombie.com>.
Hello Stephen,

mvn versions:set -DnewVersion=0.1
mvn versions:commit

Work like a charm, thanks!

On Jan 15, 2012, at 12:31 PM, Stephen Connolly wrote:

> mvn versions:set


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: 'version' contains an expression but should be a constant. Better way to add a new version?

Posted by Stephen Connolly <st...@gmail.com>.
here is why this is a bad plan.

the pom that gets deployed will not have the property value resolved, so
anyone depending on that pom will pick up the dependency as being the
string uninterpolated with the ${ } and much hilarity will ensue in your
build process.

in maven 2.1.0 and/or 2.2.0 an attempt was made to deploy poms with
resolved properties... this broke more than expected, which is why those
two versions are not recommended, 2.2.1 being the recommended 2.x version.

best bet would be

mvn versions:set && mvn deploy versions:rollback

- Stephen

---
Sent from my Android phone, so random spelling mistakes, random nonsense
words and other nonsense are a direct result of using swype to type on the
screen
On 15 Jan 2012 15:31, "Jose Vicente Nunez Zuleta" <un...@stupidzombie.com>
wrote:

> Hi,
>
> I want to compile and deploy release artifacts on daily basis to my Maven
> repository, each version different from the other;  Ideally I want to setup
> a property to do this but Maven complains very strongly about it:
>
> Macintosh:walker josevnz$ mvn package -Dwalker.version=20120115
> [INFO] Scanning for projects...
> [WARNING]
> [WARNING] Some problems were encountered while building the effective
> model for com.stupidzombie:walker:jar:20120115
> [WARNING] 'version' contains an expression but should be a constant. @
> com.stupidzombie:walker:${walker.version},
> /Users/josevnz/Documents/stupidzombie/kenai/stupidzombie~source-code-repository/branches/walker/pom.xml,
> line 6, column 12
> [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.
> [WARNING]
> [INFO]
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Building walker 20120115
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
>
> So it seems that I cannot use a variable on the <version> tag in my pom.
> What is the right way to do this?:
>
> <?xml version="1.0"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="
> http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>  <modelVersion>4.0.0</modelVersion>
>  <groupId>com.stupidzombie</groupId>
>  <artifactId>walker</artifactId>
>  <version>${walker.version}</version>
>  <packaging>jar</packaging>
>  <name>walker</name>
>  <url>http://stupidzombie.com</url>
>
> Thanks in advance,
>
> --Jose
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>