dependency binding, overriding

View: New views
3 Messages — Rating Filter:   Alert me  

dependency binding, overriding

by Narco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

I have few days to learn gradle again. I see there is version 0.8 released so I have migrated to it. Seems like base things are changed again.

However, I`m still having the same problems as before and gradle is still very complicated. I`m trying to write one build.gradle file for multi-project build with different project types. What I need currently is to compile simple project with other projects testCompile configuration. Gradle says "Cause: Cyclic extendsFrom from configuration 'compile' and configuration...". So actually, in other words all I need is to use different configuration than "compile" for java plugin cause "compile" is already defined for other projects. code snippet:

subprojects {
usePlugin('java')
configurations {
                   compile
                   testCompile
                   sharedCompile { extendsFrom testCompile }
                }
dependencies {
                   compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1', ':gwt-servlet:1', ':gwt-user:1')
                   testCompile (':junit:1', ':selenium-java-client-driver:1')
                }

if (artifactType.equals('shared')) { //under this I want to override compile configuration with sharedCompile

                //exclude any files from src/test/resources
                testResourceDirNames = new LinkedList()

                configurations {
                   compile { extendsFrom sharedCompile } //There it fails of course
                }
}

Re: dependency binding, overriding

by Narco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anybody? :(
I found in other post that I can try to set custom classpath in this way:
sourceSets {
    main {
        compileClasspath = configurations.compile + configurations.provided
    }
}

Any suggestions?

Narco wrote:
Hello!

I have few days to learn gradle again. I see there is version 0.8 released so I have migrated to it. Seems like base things are changed again.

However, I`m still having the same problems as before and gradle is still very complicated. I`m trying to write one build.gradle file for multi-project build with different project types. What I need currently is to compile simple project with other projects testCompile configuration. Gradle says "Cause: Cyclic extendsFrom from configuration 'compile' and configuration...". So actually, in other words all I need is to use different configuration than "compile" for java plugin cause "compile" is already defined for other projects. code snippet:

subprojects {
usePlugin('java')
configurations {
                   compile
                   testCompile
                   sharedCompile { extendsFrom testCompile }
                }
dependencies {
                   compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1', ':gwt-servlet:1', ':gwt-user:1')
                   testCompile (':junit:1', ':selenium-java-client-driver:1')
                }

if (artifactType.equals('shared')) { //under this I want to override compile configuration with sharedCompile

                //exclude any files from src/test/resources
                testResourceDirNames = new LinkedList()

                configurations {
                   compile { extendsFrom sharedCompile } //There it fails of course
                }
}

Re: dependency binding, overriding

by Narco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, this is the correct way to go imo. Works fine.


Anybody? :(
I found in other post that I can try to set custom classpath in this way:
sourceSets {
    main {
        compileClasspath = configurations.compile + configurations.provided
    }
}

Any suggestions?

Narco wrote:
Hello!

I have few days to learn gradle again. I see there is version 0.8 released so I have migrated to it. Seems like base things are changed again.

However, I`m still having the same problems as before and gradle is still very complicated. I`m trying to write one build.gradle file for multi-project build with different project types. What I need currently is to compile simple project with other projects testCompile configuration. Gradle says "Cause: Cyclic extendsFrom from configuration 'compile' and configuration...". So actually, in other words all I need is to use different configuration than "compile" for java plugin cause "compile" is already defined for other projects. code snippet:

subprojects {
usePlugin('java')
configurations {
                   compile
                   testCompile
                   sharedCompile { extendsFrom testCompile }
                }
dependencies {
                   compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1', ':gwt-servlet:1', ':gwt-user:1')
                   testCompile (':junit:1', ':selenium-java-client-driver:1')
                }

if (artifactType.equals('shared')) { //under this I want to override compile configuration with sharedCompile

                //exclude any files from src/test/resources
                testResourceDirNames = new LinkedList()

                configurations {
                   compile { extendsFrom sharedCompile } //There it fails of course
                }
}