Hi
We are working on automating our build process using Gradle,Nexus and Jenkins and stumbled upon this issue for 2 days. We created a job in Jenkins where users will choose the options like Build,Stage and Deploy or “Stage and Deploy” .In the first case we build stage and deploy whatever the artifacts produced in the libs dir of each of the projects and in the later case no build will be run but we get the files of version given by the users from the Nexus and move it to Server and deploy the application. Our applications has lots of dependencies jars and zips containing properties files which we were able to download successfully from nexus but for some reason we cannot download the specific version of ear .There is no error or anything and it simply skip the task as it is always empty.
Below are the code we used to download the files
subprojects{
afterEvaluate { Project project ->
if(parent.buildApplication.equalsIgnoreCase("false")){
tasks.each { curTask ->
curTask.enabled=false
}
}
if(parent.stageApplication.equalsIgnoreCase("true") && project.name.equalsIgnoreCase("TestCommon")){
project.parent.task('copyJar',type:Copy){
outputs.upToDateWhen { false }
from jar.archivePath
into parent.rootProject.as400LibFolder
}
project.parent.task('explodeZip'){
outputs.upToDateWhen { false }
doLast{
ant.unzip(src: distZip.archivePath.path, dest:rootProject.as400LibFolder, overwrite:"true") {
patternset( ) {
exclude( name: archivesBaseName+"-"+version )
}
mapper(type:"flatten")
}
}
}
explodeZip.dependsOn('prepareDependencies')
copyJar.dependsOn('explodeZip')
copyEar.dependsOn('copyJar')
}
//user entered specific version
to deploy
if(parent.isDownloadFiles.equalsIgnoreCase("true") && project.name.equalsIgnoreCase("TestCommon")){
parent.configurations{
copyStagedJarVersion
copyStagedZipVersion
copyStagedEarVersion
}
parent.dependencies{
copyStagedJarVersion group: 'com.cfins.test', name: 'TestCommon', version: version, ext: 'jar'
copyStagedZipVersion group: 'com.cfins.test', name: 'TestCommon', version: version, ext: 'zip'
copyStagedEarVersion group: 'com.cfins.test', name: 'Test', version: version, ext: 'ear'
}
parent.configurations.copyStagedJarVersion.files.each { file ->
println file.name
}
parent.configurations.copyStagedZipVersion.files.each { file ->
println file.name
}
parent.configurations.copyStagedEarVersion.files.each { file ->
println file.path
}
project.parent.task('copyStagedEar',type:EarDownload){
outputs.upToDateWhen { false }
def earDir=new File(ear.destinationDir.path)
if(earDir.exists()){
earDir.deleteDir()
}
earDir.mkdirs()
from
parent.configurations.copyStagedEarVersion
into ear.destinationDir
}
project.parent.task('copyStagedJar',type:Copy){
outputs.upToDateWhen { false }
def jarDir=new File(jar.destinationDir.path)
if(jarDir.exists()){
jarDir.deleteDir()
}
jarDir.mkdirs()
from parent.configurations.copyStagedJarVersion
into jar.destinationDir
}
project.parent.task('copyStagedZip',type:Copy){
outputs.upToDateWhen { false }
def zipDir=new File(distZip.destinationDir.path)
if(zipDir.exists()){
zipDir.deleteDir()
}
zipDir.mkdirs()
from parent.configurations.copyStagedZipVersion
into distZip.destinationDir
}
copyStagedEar.dependsOn('prepareDependencies')
copyStagedZip.dependsOn('copyStagedEar')
copyStagedJar.dependsOn('copyStagedZip')
copyJar.dependsOn('copyStagedJar')
}
}
Output:
***************************************************************
Welcome to Gradle 2.0 - http://www.gradle.org
Gradle home is set to: C:\gradle-2.0
Java Home is set to : C:\Websphere8.5\AppServer\java_1.7_64
Java Version is set to : 1.7
Build Environment : DEV
***************************************************************
TestCommon-1.0.1.jar
TestCommon-1.0.1.zip
C:\Test\build\libs\Test-1.0.1.ear
:compileJava UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:startBuild
**********************************************
Build Version : 1.0.1
**********************************************
**********************************************
Base directory: C:\Test\build
Running script: C:\Test\build.gradle
**********************************************
Test build started...
:TestCommon:processResources SKIPPED
:TestCommon:generateEUSWebServiceClient SKIPPED
:TestCommon:generateDNBWebServiceClient SKIPPED
:TestCommon:generateIRWebServiceClient SKIPPED
:TestCommon:generateIRJAXBClient SKIPPED
:TestCommon:compileJava SKIPPED
:TestCommon:classes SKIPPED
:TestCommon:jar SKIPPED
:TestMessagingEJB:compileJava SKIPPED
:TestMessagingEJB:processResources SKIPPED
:TestMessagingEJB:classes SKIPPED
:TestMessagingEJB:jar SKIPPED
:TestProcessEJB:compileJava SKIPPED
:TestProcessEJB:processResources SKIPPED
:TestProcessEJB:classes SKIPPED
:TestProcessEJB:jar SKIPPED
:TestWeb:compileJava SKIPPED
:TestWeb:compileJasperReport SKIPPED
:TestWeb:processResources SKIPPED
:TestWeb:classes SKIPPED
:TestWeb:war SKIPPED
:ear SKIPPED
:TestCommon:distZip SKIPPED
:TestCommon:uploadArchives SKIPPED
:uploadArchives SKIPPED
:prepareDependencies
:copyStagedEar UP-TO-DATE
:copyStagedZip
:copyStagedJar
:explodeZip
:copyJar
:copyEar UP-TO-DATE
:createLibrary
:stageApplicationFilesTask SKIPPED
:serverActionTask SKIPPED
:getLogsFromServerTask SKIPPED
BUILD SUCCESSFUL
I can see that the jar and the zip files of the given version downloaded successfully . But ear is always skipped as shown in the above log Thanks in advance