2

I'm new to maven, I want to asign dinamically the jar version of a jira plugin passing a parameter to maven by command line (win7 with maven 2.1.0), so I can generate the jar file name with the svn revision:

mvn -Dsvnrev=1 package

or

mvn package -Dsvnrev=1

but have an error: [INFO] Invalid task '1': you must specify a valid lifecycle phase, or a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal

I define the parameter in pom.xml but, is there something I'm missing?

<properties>
    <myprop>MyJarStaticName${svnrev}</myprop>
</properties>

<version>${myprop}</version>

also I have tryed

<properties>
    <myprop>${myprop}</myprop>
</properties>

<version>MyJarStaticName-${myprop}</version>

I had a watch to this post and this but It doesn't work for me :(

Community
  • 1
  • 1
LeonardoX
  • 1,113
  • 14
  • 31
  • What are you using such an old Maven version? up-to-date 3.0.4!. The version of an maven artifact can't given dynamically via command line. What you can do is to use buildnumber-maven-plugin to get the information from SVN and put it into the MANIFEST.MF file. – khmarbaise Jan 08 '13 at 19:27
  • I use that version because is the version that comes with Jira sdk 3.11, I don't know if it's possible to update maven but works for me at the moment. How does I put the svn revision into Manifest.mf file?, and how does maven takes the info from this file to generate the jar name? I only know a little knowledge of pom or settings structure, but never heard about manifest.mf. thanks – LeonardoX Jan 09 '13 at 15:31

1 Answers1

0

For command

mvn -Dsvnrev=1 package

Try using

${env.svnrev}

in pom.xml

MariuszS
  • 30,646
  • 12
  • 114
  • 155