Im using (for enabling download source on child projects):

http://gradle.org/current/docs/dsl/org.gradle.api.Project.html#org.gradle.api.Project:afterEvaluate(groovy.lang.Closure)

within the subproject closure and dependsOnChildren in the root project (so
they will evaluate before the parent does)

Ronen

On Wed, Jun 8, 2011 at 12:58 AM, Eric Berry <[email protected]> wrote:

> Hello,
>    I have a multi-project build like so:
> [root]
>    /app
>    /webapp
>
> I'm trying to add an unversioned jar file or war file to the sub-projects,
> but I want it to be conditional.
>
> Eg. The 'app' project applies the java plugin, so it should also produce an
> unversioned jar file. The 'webapp' project applies the war plugin so it
> should produce an unversioned war file.
>
> The easiest way I found to produce the actual j/war file is to create a new
> task and add it to the artifacts closure.
> [code]
> task("unversionedArtifact", type: Jar, dependsOn: "classes") { version =
> null }
>
> artifacts { archives unversionedArtifact }
> [/code]
>
> The issue I'm having is essentially changing the type based on whether or
> not java, or war is applied.
>
> I've tried adding a check to see if the 'war' task is available:
> [code]
> if(project.tasks['war']) {
>    extension = 'war'
> }
> [/code]
>
> But this results in an error because the war plugin hasn't been applied
> yet. I added this task to the root project's build.gradle file, under the
> subprojects closure.
>
> Is there an easy and generic way I can do this so that I can put it in the
> subprojects closure and have it for both types of projects?
>
> Thanks,
> Eric
>
> --
> Learn from the past. Live in the present. Plan for the future.
> Blog: http://eric-berry.blogspot.com
> jEdit <http://www.jedit.org> - Programmer's Text Editor
> Bazaar <http://bazaar.canonical.com> - Version Control for Humans
>

Reply via email to