Hello Jefferson,
have a look at Gradle DSL Documentation at http://gradle.org/docs/current/dsl/index.html. There you can find a chapter about Gradle Tasks (http://gradle.org/docs/current/dsl/org.gradle.api.Task.html). You can use the onlyIf and didWork properties to skip the uploadArchives task when the war is up-to-date:

--------------
uploadArchives {
    onlyIf { war.didWork }
}
--------------

regards,
René



--
--
Rene Groeschke
@breskeby

Principal Engineer,
Gradleware Inc. - Gradle Training, Support, Consulting
rene.groesc...@gradleware.com
http://gradleware.com 
 


14. Februar 2012 21:04
Hi René, thanks for the clarification! That is exactly what worked for me!

If you don't mind, I have another quick question: when I run two times the task uploadArchives on a war project, I can notice that all the previous tasks are UP-TO-DATE but it looks that the uploadArchives is always executed.

Is there a reason for that? If the war task is UP-TO-DATE, is there a way to skip the execution of uploadArchives?

Thanks a lot,

Jefferson





14. Februar 2012 16:26
Hi Jefferson,
your dependency isn't added to the war because you declared it as providedCompile and runtime dependency. You should avoid to declare the same dependency for two scopes. Behind the scenes, gradle filters every dependency that is declared as providedCompile dependency when the war is created. Since your runtime dependency is exactly the same as your providedCompile dependency. Normally there is no reason for adding your dependency as providedCompile and Runtime. Instead you should just add it as "compile" dependency.

regards,
René



 

14. Februar 2012 14:39
Hi guys, I have a question related to the War plugin.

My war project depends on another (path: ':bp.jars', configuration: 'search') at compile time.
It also needs the jar files on the lib dir of generated war file.

The documentation says "All the dependencies of the runtime configuration are copied to WEB-INF/lib".
But I tried the following, without success (the jars were not been included into the generated war file):

dependencies {
providedCompile project(path: ':bp.jars', configuration: 'search')
runtime project(path: ':bp.jars', configuration: 'search')
}

After many tries, It is now working when I use:

dependencies {
compile project(path: ':bp.jars', configuration: 'search')
}

Why the jars are not included when I use runtime configuration, but are included when I use compile configuration?

Thanks a lot,

Jefferson




Reply via email to