[
http://jira.codehaus.org/browse/MNG-4985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=252086#action_252086
]
Wujek commented on MNG-4985:
----------------------------
I read the other issue this one is supposed to duplicate, and whereas the other
one also deals with profiles, I wouldn't consider them identical, and hence
close this one. The use case depicted by my is quite different.
I don't define dependencies within a profile - I define classifiers that are
used to point to correct dependencies, that in turn are defined globally.
Or is it that the two features share common erroneous code, fixing of which
will fix both issues? Please pardon my question, but I simply don't know the
maven codebase.
> Transitive dependencies with classifiers not resolved correctly
> ---------------------------------------------------------------
>
> Key: MNG-4985
> URL: http://jira.codehaus.org/browse/MNG-4985
> Project: Maven 2 & 3
> Issue Type: Bug
> Components: Dependencies
> Affects Versions: 3.0.1, 3.0.2
> Environment: Ubuntu 10.04 64bit, JDK 1.6_23
> Reporter: Wujek
> Assignee: Benjamin Bentmann
> Priority: Critical
> Attachments: classifiers-test.zip
>
>
> Tested against maven 3.0.1, and the latest 3.0.2. I don't know whether this
> works for 2.2.1.
> The project described below is attached to this issue.
> I have a multi-module project that has modules: A, B, and C. B depends on A,
> C depends on B and transitively on A.
> Additionally, there is a web archive that depends on B and C directly and
> transitively on A:
> I have 2 profiles: dev and qa. They define a single property named
> 'classifier' - and this property is used in maven jar and war plugins:
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>
> <version>2.3.1</version>
> <configuration>
> <classifier>${classifier}</classifier>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-war-plugin</artifactId>
> <version>2.1.1</version>
> <configuration>
> <classifier>${classifier}</classifier>
> <failOnMissingWebXml>false</failOnMissingWebXml>
> </configuration>
> </plugin>
> Thus, depending on the profile, different version of the application is build
> and installed / deployed (actually not in this demo, as I don't declare any
> repository to deploy to).
> Supposing none of the modules in any of the profiles has been built, go on
> and try to build the project with -Pqa turned on. Parent pom is correctly
> deployed, A is correctly deployed, and so is B. The problem is with module C
> which has a transitive dependency on A, and somehow it doesn't take the
> classifier into account:
> [ERROR] Failed to execute goal on project C: Could not resolve dependencies
> for project test:C:jar:0.0.1-SNAPSHOT: Could not find artifact
> test:A:jar:*dev*:0.0.1-SNAPSHOT -> [Help 1]
> When I first build everything using the dev profile (which is turned on by
> default), the build of the qa profile goes Ok. But, when I go to C and invoke
> 'mvn dependency:tree', I see:
> [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ C ---
> [INFO] test:C:jar:0.0.1-SNAPSHOT
> [INFO] \- test:B:jar:qa:0.0.1-SNAPSHOT:compile
> [INFO] \- test:A:jar:*dev*:0.0.1-SNAPSHOT:compile
> As can be seen, the transitive dependency used an invalid classifier.
> However, I can't use the workaround that I build dev and then qa, as in my
> current project we have a web module that packages these jars inside
> WEB-INF/lib - and the transitive dependencies are packaged with invalid
> qualifiers. Please check out the jars that are packages within WEB-INF/lib of
> the generated war file - it packages a qa jar only for the direct dependency.
> Here is the output of 'mvn dependency:tree -Pqa':
> [INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ web ---
> [INFO] test:web:war:0.0.1-SNAPSHOT
> [INFO] +- test:C:jar:qa:0.0.1-SNAPSHOT:compile
> [INFO] | \- test:B:jar:*dev*:0.0.1-SNAPSHOT:compile
> [INFO] +- test:B:jar:qa:0.0.1-SNAPSHOT:compile
> [INFO] | \- test:A:jar:*dev*:0.0.1-SNAPSHOT:compile
> [INFO] \- org.apache.geronimo.specs:geronimo-servlet_3.0_spec:jar:1.0:provided
> It gets even worse - there is also a direct dependency on B, so when the -Pqa
> switch is used, both B-qa.jar and B-dev.jar end up in the war file - dev is
> the transitive dep, qa the direct one.
> For us this means disaster - mixing of jars from other profiles means the
> jars use different JMS resources, different JDBC pools and so on. Supposing B
> is a JPA module, we end up with the same persistence unit twice, with the
> same name, but using different pools (one for devs, one for qa).
> Setting at critical as I don't know any workaround.
> If I am doing something wrong, this means I don't understand profiles and
> classifiers correctly. In this case, please be generous and point me to the
> right resources.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira