How to set properties that reference dependencies in Maven

In my project, I have a dependency on maven.
by the way it is:

<dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-activiti</artifactId> <version>3.2.0</version> </dependency> 

There is a property in this POM dependency that is used but not defined - ${activiti.version}

The only way to find this property is to specify it on the command line, for example mvn -Dactiviti.version=5.10

Is there a way to specify this property in my POM projects?
<properties><activiti.version>5.10</activiti.version></properties> does not work.

I hope I put the problem clear enough.
Thanks for the help.

EDIT:

The situation that I am trying to solve can be reproduced if you create a new maven project with a dependency:

 <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-activiti</artifactId> <version>3.2.0</version> </dependency> 

and provide the necessary repositories:

  <repositories> <repository> <id>muleforge-repo</id> <name>MuleForge Repository</name> <url>http://repository.muleforge.org/release</url> <layout>default</layout> </repository> <repository> <id>codehaus-repo</id> <name>Codehaus Repository</name> <url>http://dist.codehaus.org/mule/dependencies/maven2</url> <layout>default</layout> </repository> <repository> <id>activiti</id> <name>Activiti</name> <url>https://maven.alfresco.com/nexus/content/groups/public/</url> </repository> </repositories> 

EDIT 2:

Here is the POM for org.mule.modules: mule-module-activiti: 3.2.0 , my projects depend on me. Inside this pom, they use the expression ${activiti.version} . But they do not set a meaning for this expression. (there is nothing like <properties><activiti.version>5.10</activiti.version></properties> )

Question: how to set the value for this expression from my pom?

+4
source share
3 answers

OK, finnaly, after several days of searching and experimenting, I found a solution to my problem.

If you need to provide properties for maven on the command line (speaking of system properties that are slightly different from maven properties), you can also use the plugin to provide these properties in your pom or in a separate properties file.

Note: System properties can be used to override maven properties in your dependencies.

Like this:

 <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-alpha-2</version> <executions> <execution> <goals> <goal>set-system-properties</goal> </goals> <configuration> <properties> <property> <name>activiti.version</name> <value>5.10</value> </property> </properties> </configuration> </execution> </executions> </plugin> 

Hope this helps someone.

Also sorry for my awkward question, which seems to be hard to understand.

+4
source

You can use properties to determine versions:

 <properties> <module-version>3.2.0</module-version> </properties> .. <dependency> <groupId>org.mule.modules</groupId> <artifactId>mule-module-activiti</artifactId> <version>${module-version}</version> </dependency> 

Why not work ?

You should never specify artifact versions through properties on the command line, because you will not be able to reproduce this in the future, and I doubt that this works.

+4
source

Make sure that you do not have proxy settings for communicating with the outside world. I just tried your configuration and it worked. I am using the latest version of Maven 3.

0
source

All Articles