Gradle transient dependencies download local ivy

I have a project that I hide until gradle. The project has some dependencies, such as junit, etc. Dependency tanks are loaded, but the dependencies of these Jars are not loaded. 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 are Jars needed for the test: project: 17.20.SNAPSHOT not loaded? this thing works with ant + ivy project

Update 1

I added the ivy.xml file of the 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>
+6
source share
1 answer

I think this may be due to your configuration in ivy.xml linking them for compilation by default, and Gradle is trying to allow a default configuration that has nothing declared.

: configurations.add("yourConf") configurations.yourConf.extendsFrom(configurations.compile)

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

/ conf ivy.xml

, groovy, .

asNode().dependencies.dependency.findAll { it.@conf }.each { it.attributes().remove("conf") }
+1

Source: https://habr.com/ru/post/1015919/


All Articles