Hi,

I think your build.gradle script for the dao project should contain just this:

version = "0.1-SNAPSHOT"

dependencies {
    compile project(':platonos-dao')
}

That's it. Get rid of the other stuff. Then, Gradle will take care of building things in the correct order, and you don't need to do an install of the common project in order to build the dao project.

You might also want to get rid of 'install.dependsOn compileJava' from the root build.gradle.

Gradle doesn't recognise that the following dependency actually refers to a project in the same build, and so looks in one of the repositories for it:

dependencies {
compile group : 'org.platonos', name: 'platonos-common', version: '0.1-SNAPSHOT'
}

This also means that it doesn't know it should build the common stuff before building the dao, because, as far as it is concerned, there's no relationship between the 2 project.

It might make sense for Gradle to check if any of the external style dependencies like the above actually correspond to a project in the same build, and treat it as a project dependency instead. I've added a JIRA issue for this: http://jira.codehaus.org/browse/GRADLE-1057


On 24/07/10 3:41 AM, Potje rode kool wrote:
I attached some of my build scripts. build.gradle, repositories.gradle and settings.gradle are in the root of the projects tree. common-build.gradle and dao-build.gradle are the build scripts of two sub project, I just renamed those files just for this e-mail. On disk they are both build.gradle.
The install.dependsOn compileJava seems to fix my problem.
C:\Users\Evert\projects\platonos\projects\platonos-dao>gradle clean install
:platonos-common:clean
:platonos-dao:clean
:platonos-common:compileJava
:platonos-common:processResources
:platonos-common:classes
:platonos-common:jar
:platonos-common:install
:platonos-dao:compileJava
Download file:/C:/Users/Evert/.m2/repository/org/platonos/platonos-common/0.1-SN
APSHOT/platonos-common-0.1-SNAPSHOT.pom
Download file:/C:/Users/Evert/.m2/repository/org/platonos/platonos-common/0.1-SN
APSHOT/platonos-common-0.1-SNAPSHOT.jar
:platonos-dao:processResources UP-TO-DATE
:platonos-dao:classes
:platonos-dao:jar
:platonos-dao:install
BUILD SUCCESSFUL
I would expect that gradle would excute the tasks of a project before it goes on to the next project.
What I am missing?

Thanks,
Evert
2010/7/23 Adam Murdoch <[email protected] <mailto:[email protected]>>

    On 23/07/10 4:00 AM, Potje rode kool wrote:
    Looks like I fixed it. I appended -SNAPSHOT to the version number.
    But one thing I see is that the dependency (platonos-common) is
    downloaded first and after that it gets installed in my .m2 folder.
    platonos-dao depends on platonos common. I would expected that
    gradle should run first all the tasks of platonos-common before
    running the tasks from platonos-dao. Is there a way to make
    gradle work like this?

    I suspect you've configured your build in an unusual way, and
    Gradle is getting confused. Could you provide some snippets from
    your build files where you declare the dependencies and
    repositories? Then we can see if there's a way to structure them
    so they work better, and whether we need to fix anything in Gradle.


    C:\Users\Evert\projects\platonos\projects\platonos-dao>gradle
    clean compileJava install
    :platonos-common:clean
    :platonos-dao:clean
    :platonos-common:compileJava
    :platonos-common:processResources
    :platonos-common:classes
    :platonos-common:jar
    :platonos-dao:compileJava
    Download
    file:/C:/Users/Evert/.m2/repository/org/platonos/platonos-common/0.1-SN
    APSHOT/platonos-common-0.1-SNAPSHOT.pom
    Download
    file:/C:/Users/Evert/.m2/repository/org/platonos/platonos-common/0.1-SN
    APSHOT/platonos-common-0.1-SNAPSHOT.jar
    :platonos-common:install
    :platonos-dao:processResources UP-TO-DATE
    :platonos-dao:classes
    :platonos-dao:jar
    :platonos-dao:install
    BUILD SUCCESSFUL

    2010/7/22 Adam Murdoch <[email protected] <mailto:[email protected]>>

         On 21/07/10 6:28 AM, Potje rode kool wrote:

            I am trying to build a multiproject but I got some problems.
            I have a core project that contains things like dao and
            service classes, another project web depends on core.
            When I change something in my core project and I call:
            gradle clean install war, the web project doesn't get the
            new jar from the core project.


        Could you provide a snippet from your web project's build
        file where you're declaring the dependency and repositories?

-- Adam Murdoch
        Gradle Developer
        http://www.gradle.org <http://www.gradle.org/>
        CTO, Gradle Inc. - Gradle Training, Support, Consulting
        http://www.gradle.biz <http://www.gradle.biz/>



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

        http://xircles.codehaus.org/manage_email





-- Adam Murdoch
    Gradle Developer
    http://www.gradle.org  <http://www.gradle.org/>
    CTO, Gradle Inc. - Gradle Training, Support, Consulting
    http://www.gradle.biz  <http://www.gradle.biz/>



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

     http://xircles.codehaus.org/manage_email


--
Adam Murdoch
Gradle Developer
http://www.gradle.org
CTO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

Reply via email to