0
I am trying to make a modification to a project to allow you to pass a Property and generate the package with the version that was passed. Ex: mvn package install -Dversion.app=0.0.1 But I have a problem when it comes to generating project B that has two dependencies of project A (two modules). Project A generates the artifacts and installs in the . m2, but when I run the same command for project B it cannot find the dependencies. In fact, for what I identified, he tries to look the wrong way (/.m2/Repository/br/project/${version.app}), recognizing the Property as a string, but in the project A works perfectly.
Anyway, my problem is this, I need to use this command in both projects and manage to pass the value of the Property: mvn package install -Dversion.app=0.0.1
Project A:
<groupId>br.projeto</groupId>
<artifactId>projeto-a</artifactId>
<packaging>pom</packaging>
<version>${version.app}</version>
<name>Projeto A - Parent</name>
<modules>
<module>core-model</module>
<module>core-ejb</module>
<module>web-api</module>
</modules>
Project B:
<groupId>br.projeto</groupId>
<artifactId>projeto-b</artifactId>
<packaging>pom</packaging>
<version>${version.app}</version>
<name>Projeto B - Parent</name>
<modules>
<module>outro-modulo</module>
<module>outroweb-api</module>
</modules>
<dependencies>
<dependency>
<groupId>br.projeto</groupId>
<artifactId>core-model</artifactId>
<version>${version.app}</version>
</dependency>
<dependency>
<groupId>br.projeto</groupId>
<artifactId>core-ejb</artifactId>
<version>${version.app}</version>
</dependency>
</dependencies>
Module - outroweb-api of Project B:
<artifactId>outroweb-api</artifactId>
<parent>
<groupId>br.projeto</groupId>
<artifactId>projeto-b</artifactId>
<relativePath>../pom.xml</relativePath>
<version>${version.app}</version><!--Isso não é permitido-->
</parent>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>br.projeto</groupId>
<artifactId>core-model</artifactId>
<version>${version.app}</version>
</dependency>
<dependency>
<groupId>br.projeto</groupId>
<artifactId>core-ejb</artifactId>
<version>${version.app}</version>
</dependency>
<dependencies>
Finally,
Can you explain to me why only with the variable it is not possible to find the parent pom in the case of project B? The goal is that I do not do what the command did (scanner all pom and replace), but rather be able to do as I did in the first project a, pass to Property/variable and generate both Ear and submodules in the informed version.
– L. Luan
@L. Luan And what would that help? The goal of versioning is to keep all modules in the same version, the release command performs exactly this, changes the version of the parent module, through the desired number, updates the dependencies of the submodules to the desired version, and also updates the related artifacts in pom to the new version
– nullptr
I added a few more details in the reply, another way since you want to have the version of pom variable.
– nullptr