Issue w/ transitive dependencies

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue w/ transitive dependencies

Allan Lewis
Hi,

This seems so simple that I'm probably being dense, but I can't see what I'm doing wrong.  I have a project defined as follows:

project (':foo') {

        dependencies {
                compile 'org.springframework:spring:2.5.4@jar'

}

Later on in the same build.gradle, I have another project:

project (':bar') {
       
        dependencies {
                compile project(':foo')
        }

}

I'm currently getting an error compiling any classes that have Spring dependencies in the 'bar' project.  Shouldn't project 'bar' be able to compile classes with Spring dependencies based on the above?    Shouldn't 'bar' be inheriting the spring jar through the 'foo' lib dependency?

This is all being done using the 0.2 release
Reply | Threaded
Open this post in threaded view
|

Re: Issue w/ transitive dependencies

Allan Lewis
The ivy.xml sheds some light on this:

<dependency org="org.springframework" name="spring" rev="2.5.4" <b>transitive="false" conf="compile->default">
        <artifact name="spring" type="jar" ext="jar" conf=""/>
</dependency>

How do I get the transitive flag set to 'true'?
Reply | Threaded
Open this post in threaded view
|

Re: Issue w/ transitive dependencies

hans_d
Administrator
In reply to this post by Allan Lewis
Hi Allan,

On Jul 8, 2008, at 3:35 AM, Allan Lewis wrote:

>
> Hi,
>
> This seems so simple that I'm probably being dense, but I can't see  
> what I'm
> doing wrong.  I have a project defined as follows:
>
> project (':foo') {
>
> dependencies {
> compile 'org.springframework:spring:2.5.4@jar'
>
> }
>
> Later on in the same build.gradle, I have another project:
>
> project (':bar') {
>
> dependencies {
> compile project(':foo')
> }
>
> }
>
> I'm currently getting an error compiling any classes that have Spring
> dependencies in the 'bar' project.  Shouldn't project 'bar' be able to
> compile classes with Spring dependencies based on the above?    
> Shouldn't
> 'bar' be inheriting the spring jar through the 'foo' lib dependency?

For runtime yes, for compile time no. I think this is a very  
important feature of Gradle. For example yesterday I got a compile  
error because I have refactored some Groovy classes to Java.  
Therefore I could not use the Groovy AntBuilder in this classes any  
longer but had to use the Ant classes directly. The compile failed  
although Ant is in the transitive classpath. But Gradle has informed  
me (via the compile failure) that I have a new first level dependency  
which needs to be declared explicitly. See also the discussion in  
12.1.2 in the user's guide.

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Issue w/ transitive dependencies

hans_d
Administrator
In reply to this post by Allan Lewis

On Jul 8, 2008, at 3:55 AM, Allan Lewis wrote:

>
> The ivy.xml sheds some light on this:
>
> <dependency org="org.springframework" name="spring" rev="2.5.4"
> transitive="false" conf="compile->default">
>         <artifact name="spring" type="jar" ext="jar" conf=""/>
> </dependency>
>
> How do I get the transitive flag set to 'true'?
>

The transitive setting is contained in an Ivy configuration object.  
We don't usually recommend to change this setting. The Ivy  
configuration objects are immutable objects so you have to assign  
them anew:

dependencies {
    addConfiguration(
                 new Configuration(JavaPlugin.COMPILE,  
Visibility.PRIVATE, null, null, true, null));
}

This is not very nice. We plan to provide convenience methods soon,  
like: configuration('compile', transitive: true), where we under the  
hood create a new Configuration object which use the settings of the  
old one as default and overwrite only the declared ones from the map:  
http://jira.codehaus.org/browse/GRADLE-149

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email