Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gradle transitive dependencies download local ivy

I have a project that i am coverting to gradle. the project has some dependencies like junit etc. The Jars for the dependencies get downloaded but the dependencies of those Jars are not downloaded. The build.gradle file is as follows

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'application'

repositories {
     ivy  {
        url 'http://localserver/repo'
        layout 'pattern', {
              artifact 'snapshot/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]'
              artifact '3rd-party/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]'
              artifact 'b2bdev/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]'
              file 'snapshot/[organisation]/[module]/ivys/ivy-[revision].xml'
              file '3rd-party/[organisation]/[module]/ivys/ivy-[revision].xml'
        }
    }
}

targetCompatibility = sourceCompatibility = JavaVersion.VERSION_1_6

dependencies {
    testCompile('test:project:17.20.SNAPSHOT') {
        transitive = true
    }
    testCompile('org.hibernate.common:hibernate-commons-annotations:4.0.1.Final') {
        transitive = false
    }
    testCompile('org.hibernate:hibernate-ehcache:4.1.2.Final') {
        transitive = false
    }
    testCompile('org.javassist:javassist:3.16.1-GA') {
        transitive = false
    }
    compileOnly('javax.servlet:javax.servlet-api:3.0.1') {
        transitive = false
    }
    compileOnly('dom4j:dom4j:1.6.1') {
        transitive = false
    }
}

Why is the Jars required by test:project:17.20.SNAPSHOT not downloaded ? this thing works with ant+ivy project

Update 1

I have added the ivy.xml file of test project

<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info organisation="test" module="project" revision="17.20.SNAPSHOT" status="integration" publication="434334345"></info>
<configurations>
<conf name="test" visibility="public" description="Dependencies needed only for testing"/>
<conf name="compile" visibility="public" description="Dependencies required for compile time that are not provided by a container"/>
<conf name="runtime" extends="compile" visibility="public" description="Dependencies not needed for compile time but are needed for runtime"/>
<conf name="provided" visibility="public" description="Dependencies provided by a container"/>
<conf name="ear" visibility="public" description="Dependencies managed by ear level classloader"/>
<conf name="war" visibility="public" description="Dependencies managed by war level classloader"/>
<conf name="default" visibility="public"/>
<conf name="optional" visibility="public"/>
<conf name="sources" visibility="public"/>
</configurations>
<publications>
<artifact name="project"/>
<artifact name="project-sources" type="src" ext="jar" conf="sources"/>
</publications>
<dependencies>

<!--  Spring and related dependencies  -->
<dependency org="org.springframework" name="spring-core" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-context" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-web" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-beans" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-expression" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-aop" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-orm" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-tx" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-jdbc" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-test" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-context-support" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework" name="spring-oxm" rev="4.1.6.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="2.1.0.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.data" name="spring-data-neo4j-tx" rev="2.1.0.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.batch" name="spring-batch-core" rev="2.1.8.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.batch" name="spring-batch-infrastructure" rev="2.1.8.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.security" name="spring-security-core" rev="3.2.4.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.security" name="spring-security-web" rev="3.2.4.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.security" name="spring-security-config" rev="3.2.4.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.security" name="spring-security-ldap" rev="3.2.4.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
<dependency org="org.springframework.ldap" name="spring-ldap" rev="1.3.0.RELEASE" transitive="false" conf="compile->default; war->default; ear->default"/>
</ivy-module>
like image 411
CognitiveDesire Avatar asked Mar 21 '17 19:03

CognitiveDesire


1 Answers

I think it might be because of your configuration in ivy.xml ties them up to compile default and Gradle is trying to resolve default configuration which doesnt have anything declared.

You might try to: create a new configuration configurations.add("yourConf") and extend it from compile configurations.yourConf.extendsFrom(configurations.compile) and use it for test project

or extend the 'default' configuration from compile

configurations.add("default")
configurations.default.extendsFrom(configurations.compile)

or try to delete/change the conf from ivy.xml

if you're not able to to this you might want to play with some groovy to do it.

asNode().dependencies.dependency.findAll { it.@conf }.each { it.attributes().remove("conf") }
like image 197
LazerBanana Avatar answered Nov 07 '22 19:11

LazerBanana