[GRADLE-2982] POM dependency management declarations with import scope shouldn't be overwritten by declaration of element group/artifactId/version with different scope Created: 08/Jan/14 Updated: 04/Mar/14 Resolved: 04/Mar/14 |
|
Status: | Resolved |
Project: | Gradle |
Affects Version/s: | 1.10 |
Fix Version/s: | 1.12-rc-1 |
Type: | Bug | ||
Reporter: | Gradle Forums | Assignee: | Benjamin Muschko |
Resolution: | Fixed | Votes: | 2 |
Description |
In my project I have dependency on org.jboss.seam.validation:seam-validation-api:3.1.0.Final. It has dependency on javax.enterprise:cdi-api, but without version, so gradle fails to resolve it. It shouldn't be a big deal, I can exclude javax.enterprise:cdi-api. The problem is, even if excluded, gradle still tries to figure out version number, and fails the whole build. Error message: Could not resolve all dependencies for configuration ':compile'. |
Comments |
Comment by Gradle Forums [ 08/Jan/14 ] |
Please include all relevant parts of the build script (wrapped in HTML code tags) and the output of `gradle -v`. |
Comment by Gradle Forums [ 08/Jan/14 ] |
The build script is quite simple. Relevant part: dependencies { gradle -v: ------------------------------------------------------------ Build time: 2013-12-17 09:28:15 UTC Groovy: 1.8.6 I'm the author of this question on SO: [1]http://stackoverflow.com/questions/20... |
Comment by Gradle Forums [ 08/Jan/14 ] |
Could you please also provide us with the repositories you are using? |
Comment by Gradle Forums [ 08/Jan/14 ] |
Sure: repositories { maven { url "https://nexus.softwaremill.com/content/groups/smlcommon-repos/" }mavenCentral() This specific archives are in jboss repo. |
Comment by Gradle Forums [ 08/Jan/14 ] |
Thanks, I can reproduce the issue. The exclude of the module doesn't work at the moment as the version of the dependency cannot be resolving when parsing the POM (which happens earlier than the exclude). I think we will need to be less strict in this case (especially because the scope of "cdi-api" is "provided"). |
Comment by Benjamin Muschko [ 04/Mar/14 ] |
I had a deeper look at this issue. In one of the POMs, seam-bom-3.1.0-Final.pom, that is part of the POM import chain, we see the following: <dependencyManagement> <dependencies> <!-- import the individual Java EE 6 API spec versions --> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>${jboss.javaee.version}</version> <scope>import</scope> <type>pom</type> </dependency> <!-- make Java EE 6 API available as stack artifact --> <!-- yes, we really need this one too! --> <dependency> <groupId>org.jboss.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>${jboss.javaee.version}</version> <scope>provided</scope> <type>pom</type> </dependency> ... </dependencies> </dependencyManagement> The imported POM is declared with scope import, later is defined with scope provided. When we parse the POM and identify multiple dependencies with the same groupId, artifactId and version we pick the last. As the scope of the last definition is provided, we do not import the POM. That's why the property and the relevant dependencyManagement declaration cannot be resolved. I am not sure why the dependency was declared twice with different scopes. |