Personally, it seems that applying the WAR plugin should put the WAR 
artifact in the runtime configuration (replacing the JAR).  Since we are 
wrapping all of the Gradle plugins for other reasons, we have the 
following workaround in place.  Another hack approach, but this allows us 
to use simple project dependencies and get the intended effect.

project.configurations.each { Configuration configuration ->
        def jarArtifact = configuration.artifacts.find {
                it.file == jar.archivePath
        }
        if (jarArtifact != null) {
                configuration.artifacts.remove(jarArtifact)
                project.artifacts.add(configuration.name, task)
        }
}

Here's the link to the issue Bryan references: 
http://issues.gradle.org/browse/GRADLE-1912 

Andrew Oberstar



From:   bryan <brya...@gmail.com>
To:     user@gradle.codehaus.org
Date:   01/06/2012 12:52 PM
Subject:        [gradle-user] Re: Can't access war artifact from 
dependencies in 1.0?



FWIW, the solution above isn't entirely complete. I also wanted to package
the transitive dependencies for the war that were not embedded in the war
itself. Thus in addition to above, I also specified:

compile project(":mywar")

...and in mywar's build.grade I set jar.enabled=false. Kind of a hack but
gets the job done until GRADLE-1912 is fixed.

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/Can-t-access-war-artifact-from-dependencies-in-1-0-tp5124737p5126375.html

Sent from the gradle-user mailing list archive at Nabble.com.

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

    http://xircles.codehaus.org/manage_email



Reply via email to