fascynacja
fascynacja

Reputation: 2888

How to define project version only once in a multi module maven project

I have a multi module maven project with this structure:

maven-project/
│-- pom.xml (Main parent POM)
│-- module-a/
│   ├── pom.xml
│-- module-b/
│   ├── pom.xml
│-- module-c/
│   ├── pom.xml
│-- parent-module/  (Acts as the parent)
│   ├── pom.xml

One of the modules is parent, which stores all dependencies versions. I would like to define the version lets say 2.0.0 only in one of the poms, and then reference it in all other pom.xml files. What I want to achieve is proper module setup where I dont duplicate the same value over and over in all the files. Since some of users marked my question as duplicate I would like to emphasise that I do not necessary need to user any parameters/properties, any solution which will allow me reuse the version from parent will be ok.

What I have tried:

I have tried not to put version at all, but then I get:

'version' child tag should be defined 

Is there a way to define the version in one place instead of replicating it in all those pom.xml files?

Upvotes: 0

Views: 31

Answers (0)

Related Questions