multi-project dependencies

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

multi-project dependencies

by Narco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello again!

I`m confused about multi-project projects build order on gradle-0.8. It works differently than before and it is wrong imo. All projects are simply running in alphabetical order and ignoring my configuration.
The first thing I have is settings.gradle in root:
include 'app', "ejb-module-session", 'web-main', "test-shared", "test-fit", "test-integration", "test-selenium", "ear"

Also I have test-shared/build.gradle:
dependencies {
    compile project(':app')
}

and test-fit/build.gradle:
dependencies {
    compile project(':test-shared')
}

so no matter which project or task I build, gradle should understand dependency chain app <-- test-shared <-- test-fit

I don`t get it why gradle is building just in alphabetical order:
gradle -C=off test -PconfigName=host1.ctco.lv -PconfigType=tomcat
:app:compileJava
:app:processResources
:app:classes
:app:compileTestJava
:app:processTestResources
:app:testClasses
:app:test
:app:jar
:app:uploadDefaultInternal
:ejb-module-session:compileJava
:ejb-module-session:processResources
:ejb-module-session:classes
:ejb-module-session:compileTestJava
:ejb-module-session:processTestResources
:ejb-module-session:testClasses
:ejb-module-session:test
:test-fit:compileJava
C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
tco\module\test\fit\SomeFitTest.java:3: cannot find symbol
symbol  : class ModuleTestShared
location: package lv.ctco.module.test
import lv.ctco.module.test.ModuleTestShared;
                           ^
C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
tco\module\test\fit\SomeFitTest.java:4: cannot find symbol
symbol  : class Module
location: package lv.ctco.module
import lv.ctco.module.Module;

Maybe my root build.gradle overrides project dependencies? :
subprojects {
usePlugin('java')
configurations {
                    compile
                    testCompile
                    sharedCompile { extendsFrom testCompile }
fitCompile
                }

                dependencies {
                    compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1', ':gwt-servlet:1', ':gwt-user:1')
                    testCompile (':junit:1')
fitCompile (':fit:1')
                }    
...
} else if (artifactType.equals('shared')) { //test-shared configuration
                sourceSets {
                    main {
                        compileClasspath = configurations.sharedCompile
                    }
                }
} else if (artifactType.equals('fit')) {
                sourceSets {
                    main {
                        compileClasspath = configurations.fitCompile
                    }
                }
}
...
}

Re: multi-project dependencies

by Adam Murdoch-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Narco wrote:

> Hello again!
>
> I`m confused about multi-project projects build order on gradle-0.8. It
> works differently than before and it is wrong imo. All projects are simply
> running in alphabetical order and ignoring my configuration.
> The first thing I have is settings.gradle in root:
> include 'app', "ejb-module-session", 'web-main', "test-shared", "test-fit",
> "test-integration", "test-selenium", "ear"
>
> Also I have test-shared/build.gradle:
> dependencies {
>     compile project(':app')
> }
>
> and test-fit/build.gradle:
> dependencies {
>     compile project(':test-shared')
> }
>
> so no matter which project or task I build, gradle should understand
> dependency chain app <-- test-shared <-- test-fit
>
> I don`t get it why gradle is building just in alphabetical order:
> gradle -C=off test -PconfigName=host1.ctco.lv -PconfigType=tomcat
> :app:compileJava
> :app:processResources
> :app:classes
> :app:compileTestJava
> :app:processTestResources
> :app:testClasses
> :app:test
> :app:jar
> :app:uploadDefaultInternal
> :ejb-module-session:compileJava
> :ejb-module-session:processResources
> :ejb-module-session:classes
> :ejb-module-session:compileTestJava
> :ejb-module-session:processTestResources
> :ejb-module-session:testClasses
> :ejb-module-session:test
> :test-fit:compileJava
> C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
> tco\module\test\fit\SomeFitTest.java:3: cannot find symbol
> symbol  : class ModuleTestShared
> location: package lv.ctco.module.test
> import lv.ctco.module.test.ModuleTestShared;
>                            ^
> C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
> tco\module\test\fit\SomeFitTest.java:4: cannot find symbol
> symbol  : class Module
> location: package lv.ctco.module
> import lv.ctco.module.Module;
>
> Maybe my root build.gradle overrides project dependencies? :
>  

I think that's exactly what's happening. Perhaps 'fitCompile' should
extend 'testCompile' or 'compile'?

> subprojects {
> usePlugin('java')
> configurations {
>                     compile
>                     testCompile
>                     sharedCompile { extendsFrom testCompile }
> fitCompile
>                 }
>
>                 dependencies {
>                     compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1',
> ':gwt-servlet:1', ':gwt-user:1')
>                     testCompile (':junit:1')
> fitCompile (':fit:1')
>                 }    
> ...
> } else if (artifactType.equals('shared')) { //test-shared configuration
>                 sourceSets {
>                     main {
>                         compileClasspath = configurations.sharedCompile
>                     }
>                 }
> } else if (artifactType.equals('fit')) {
>                 sourceSets {
>                     main {
>                         compileClasspath = configurations.fitCompile
>                     }
>                 }
> }
> ...
> }
>  

--
Adam Murdoch
Gradle Developer
http://www.gradle.org


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

    http://xircles.codehaus.org/manage_email



Re: multi-project dependencies

by Narco :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Yes, dependency was overrided. Got it working!

Adam Murdoch-2 wrote:

Narco wrote:
> Hello again!
>
> I`m confused about multi-project projects build order on gradle-0.8. It
> works differently than before and it is wrong imo. All projects are simply
> running in alphabetical order and ignoring my configuration.
> The first thing I have is settings.gradle in root:
> include 'app', "ejb-module-session", 'web-main', "test-shared", "test-fit",
> "test-integration", "test-selenium", "ear"
>
> Also I have test-shared/build.gradle:
> dependencies {
>     compile project(':app')
> }
>
> and test-fit/build.gradle:
> dependencies {
>     compile project(':test-shared')
> }
>
> so no matter which project or task I build, gradle should understand
> dependency chain app <-- test-shared <-- test-fit
>
> I don`t get it why gradle is building just in alphabetical order:
> gradle -C=off test -PconfigName=host1.ctco.lv -PconfigType=tomcat
> :app:compileJava
> :app:processResources
> :app:classes
> :app:compileTestJava
> :app:processTestResources
> :app:testClasses
> :app:test
> :app:jar
> :app:uploadDefaultInternal
> :ejb-module-session:compileJava
> :ejb-module-session:processResources
> :ejb-module-session:classes
> :ejb-module-session:compileTestJava
> :ejb-module-session:processTestResources
> :ejb-module-session:testClasses
> :ejb-module-session:test
> :test-fit:compileJava
> C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
> tco\module\test\fit\SomeFitTest.java:3: cannot find symbol
> symbol  : class ModuleTestShared
> location: package lv.ctco.module.test
> import lv.ctco.module.test.ModuleTestShared;
>                            ^
> C:\work\perf\SCM\Build\Ant\Project\Release_2_0_1\MDL\test-fit\src\main\java\lv\c
> tco\module\test\fit\SomeFitTest.java:4: cannot find symbol
> symbol  : class Module
> location: package lv.ctco.module
> import lv.ctco.module.Module;
>
> Maybe my root build.gradle overrides project dependencies? :
>  

I think that's exactly what's happening. Perhaps 'fitCompile' should
extend 'testCompile' or 'compile'?

> subprojects {
> usePlugin('java')
> configurations {
>                     compile
>                     testCompile
>                     sharedCompile { extendsFrom testCompile }
> fitCompile
>                 }
>
>                 dependencies {
>                     compile (':log4j:1', ':j2ee:1', ':gwt-dev-windows:1',
> ':gwt-servlet:1', ':gwt-user:1')
>                     testCompile (':junit:1')
> fitCompile (':fit:1')
>                 }    
> ...
> } else if (artifactType.equals('shared')) { //test-shared configuration
>                 sourceSets {
>                     main {
>                         compileClasspath = configurations.sharedCompile
>                     }
>                 }
> } else if (artifactType.equals('fit')) {
>                 sourceSets {
>                     main {
>                         compileClasspath = configurations.fitCompile
>                     }
>                 }
> }
> ...
> }
>  

--
Adam Murdoch
Gradle Developer
http://www.gradle.org


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

    http://xircles.codehaus.org/manage_email