Transitive dependency not resolved


(Andreas Sahlbach) #1

I would like to simulate the behaviour of maven for this pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>example.com</groupId>
        <artifactId>example</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>pom</packaging>
        <name>application</name>
              <dependencies>
            <dependency>
                <groupId>org.apache.shiro</groupId>
                <artifactId>shiro-spring</artifactId>
                <version>1.2.2</version>
            </dependency>
       </dependencies>
    </project>

mvn dependency:tree gives me:

[INFO] — maven-dependency-plugin:2.1:tree (default-cli) @ example —

[INFO] example.com:example:pom:1.0-SNAPSHOT

[INFO] - org.apache.shiro:shiro-spring:jar:1.2.2:compile

[INFO]

± org.apache.shiro:shiro-core:jar:1.2.2:compile

[INFO]

| ± org.slf4j:slf4j-api:jar:1.6.4:compile

[INFO]

| - commons-beanutils:commons-beanutils:jar:1.8.3:compile

[INFO]

- org.apache.shiro:shiro-web:jar:1.2.2:compile

Now my gradle build file looks like this:

apply plugin: 'java'
      repositories {
         mavenCentral()
    }
      dependencies {
         compile("org.apache.shiro:shiro-spring:1.2.2")
    }

and the output of gradle dependencies looks like this (without the other configs that have the same result):

compile - Compile classpath for source set ‘main’.

— org.apache.shiro:shiro-spring:1.2.2

— org.apache.shiro:shiro-web:1.2.2

So, where is the dependency to shiro-core? Why is it missing and what do I have to change to get the same results as with maven?


(Peter Niederwieser) #2

Not sure what’s going on here. Maybe Gradle is getting confused by the “bundle” packaging type. Raised as Gradle-2885. In the meantime you can declare an explicit dependency on ‘shiro-core’.


(Andreas Sahlbach) #3

Yeah, thanks, the workaround works. I was just wondering, because the shiro pom looks pretty usual, nothing fancy in it. And the rest of my project resolves perfectly.