Search code examples
javamaven-2mavenm2eclipse

Pom/Project Properties via Eclipse maven2


I packaging my java project with maven, using the M2 Plug in Eclipse

I need to provide a value for the following pom property (module_version), for local packaging this will have a value like “local-SNAPSHOT”

  <groupId>com.group</groupId>
  <artifactId>server</artifactId>
  <packaging>jar</packaging>
  <version>${module_version}</version>

Run config env variables don't seem to work...


Solution

  • I am assuming that you need to specify the property module_version via the command line. In that case you can do so by typing:

    $> mvn -Dmodule_version=local-SNAPSHOT package
    

    Another way is to take it from the environment assuming you have exported the enviromnemt varialble by typing

    $>export module_version=local-SNAPSHOT
    

    An in your pom you can use:

      <groupId>com.group</groupId>
      <artifactId>server</artifactId>
      <packaging>jar</packaging>
      <version>${env.module_version}</version>