Reputation: 1436
I have a new app, the pom for which has parent tags and all. I have to include in this app another dependency whose parent is different than the current apps parent. The problem is the version tag for the new dependency.
The current pom :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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>
<parent>
<artifactId>abc-pom</artifactId>
<groupId>com.abc</groupId>
<version>4.480.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.abc.libs</groupId>
<artifactId>dynamixSession</artifactId>
<packaging>jar</packaging>
<name>dynamixSession</name>
.....
.....
<dependency>
<groupId>com.pqr.someOtherProject</groupId>
<artifactId>SomeCoreProcessing</artifactId>
<version>4.2.14.2-SNAPSHOT</version>
<!-- <version>${project.version}</version>-->
<scope>provided</scope>
</dependency>
This pom works. Since I am hardcoding version number here, do I need to update this pom everytime the version changes ? Or will it be updated automatically. But I doubt that it updates automatically. I would like to use '${project.version}' so that I don't have to update it. But if I use '${project.version}' it tries to look for 'com.pqr.someOtherProject.SomeCoreProcessing:4.480.0-SNAPSHOT', which is not existing.
Is there a way arround this or am I stuck with harcoding the version in my pom ?
Thanks
Upvotes: 1
Views: 108
Reputation: 2214
You can use versions plugin to achieve that. It would be the easiest way. The plugins is especially used for these kind of requirements.
But it would not be automatically updated. You would need to execute versions:use-latest-snapshots goal.
If you are using a continuous integration tool (e.g. Jenkins) you can automate this with nightly builds or some other way.
Just have a look at below link to see all the details of versions plugin. It is nicely documented.
http://mojo.codehaus.org/versions-maven-plugin/
Upvotes: 1
Reputation: 140
Why don't you try {env.SomeCoreProcessing_version} instead? Just make sure you set/export the SomeCoreProcessing_version variable before kick starting your build.
Upvotes: 0