I have a multi-module project with many dependencies on different versions of modules. The versions are currently hard-coded and must be manually changed. Therefore, I decided to put all of them in the properties file and get the values โโof the properties from it during the build of the project.
Here is how I am trying to do this:
root pom.xml
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>properties-maven-plugin</artifactId> <version>1.0-alpha-2</version> <executions> <execution> <phase>initialize</phase> <goals> <goal>read-project-properties</goal> </goals> <configuration> <files> <file>./version.properties</file> </files> </configuration> </execution> </executions> </plugin>
file version.properties
module1.version=1.1 module2.version=1.8 module3.version=5.4
pom.xml module example
<properties> <module1.project.version>${module1.version}</module1.project.version> </properties> <parent> <groupId>com.mymodule</groupId> <artifactId>test</artifactId> <version>${module1.version}</version> <relativePath>../pom.xml</relativePath> </parent>
Build failed:
Failed to fulfill target org.codehaus.mojo: build-helpers-Maven-plugin: 1.7: parse-versions for ccm-agent project: Perform parsing versions target org.codehaus.mojo: build-helper-maven -plugin: 1.7: parse-version failed. NullPointerException โ [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: failed to fulfill the goal org.codehaus.mojo: build-helpers-Maven-plugin: 1.7: parse-versions for the ccm-agent project: Version parsing target org.codehaus.mojo: build-helper-maven-plugin: 1.7: parse-version failed.
How can I read some properties from a file and configure pom.xml correctly?
maven
Dragon
source share