I have a problem I wonder if someone could help me to resolve. I have a module structure in my project where I resolve dependencies using Maven. For this structure I have versions with different content I distinguish using classifiers. For each classifier I have defined a profile in a parent pom with the string for the classifier in a property. This way in my modules I use this property and is the profile I defined who decides the classifier constant. The problem I'm stuck with now is the dependency hierarchy not recognizing the classifier when a dependency is inherit from the one I define in the pom of one of my modules. For example, if I have projects A, B and C, B depends on A and C depends on B, from C I'm getting B with the classifier but not A with it. This happens if I use the property from the parent pom. If I use directly a constant string instead, the dependencies get caught correctly.The only solution I see is using profiles on each pom defining the dependencies inside them. But I have 5 profiles! Isn't there any other way to resolve this?I'm using STS 3.8 with m2e plugin as my IDE.
Thank you in advance!
I add the poms
parent pom:
<profiles><profile><id>TRUNK</id><activation><activeByDefault>true</activeByDefault></activation><properties><svnBranch /></properties></profile><profile><id>MON</id><properties><svnBranch>MON</svnBranch></properties></profile><profile><id>LOLA</id><properties><svnBranch>LOLA</svnBranch></properties></profile><profile><id>NBA</id><properties><svnBranch>NBA</svnBranch></properties></profile><profile><id>TEST</id><properties><svnBranch>TEST</svnBranch></properties></profile><profile><id>PROD</id><properties><svnBranch>PROD</svnBranch></properties></profile></profiles>
Project A:
<parent><groupId>com.myproject</groupId><artifactId>pom</artifactId><version>1.0.10</version></parent><artifactId>core-services</artifactId><version>1.1.0.41-SNAPSHOT</version>
Project B:
<parent><groupId>com.mycompany</groupId><artifactId>pom</artifactId><version>1.0.10</version></parent><artifactId>olb-services</artifactId><version>1.1.0.41-SNAPSHOT</version><properties><module.core-services.dependency.version>1.1.0.41-SNAPSHOT</module.core-services.dependency.version></properties><dependencies><dependency><groupId>com.mycompany</groupId><artifactId>core-services</artifactId><version>${module.core-services.dependency.version}</version><classifier>${svnBranch}</classifier></dependency></dependencies>
Project C:
<parent><groupId>com.mycompany</groupId><artifactId>pom</artifactId><version>1.0.10</version></parent><artifactId>nba-services</artifactId><version>1.1.0.41-SNAPSHOT</version><properties><module.olb-services.dependency.version>1.1.0.41-SNAPSHOT</module.olb-services.dependency.version><module.core-services.dependency.version>1.1.0.41-SNAPSHOT</module.core-services.dependency.version></properties><dependencies><dependency><groupId>com.mycompany</groupId><artifactId>olb-services</artifactId><version>${module.olb-services.dependency.version}</version><classifier>${svnBranch}</classifier></dependency><dependency><groupId>com.mycompany</groupId><artifactId>core-services</artifactId><version>${module.core-services.dependency.version}</version><classifier>${svnBranch}</classifier></dependency></dependencies>
Using the ${svnBranch} in the classifier tag for each dependency doesn't work. It looks like in project B, when is referenced by project C, the property ${svnBranch} is empty nevertheless it comes from the parent pom.