I have a task that is set UP-TO-DATE how can I run this task


(Cavanagh) #1

I created a task but it had an error in it. I corrected the error but the task is set UP-TO-DATE

So I cant see if my fix works

is there a way around this so I can run my task

task unzipWebXSDJar(type: Copy, dependsOn: [downloadWebXSDJar]) {
from zipTree("./${ultraESB}/conf/work/gta-jcbs-jaxb2-10.35.jar")
into './${ultraESB}/conf/work/unzipped’
include ‘*’
}

:unzipWebXSDJar UP-TO-DATE

running in debug mode I get the following

Starting to execute task ':unzipWebXSDJar’
08:52:46.201 [INFO] [org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter] Skipping task ‘:unzipWebXSDJar’ as it has no source files.
08:52:46.201 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ‘:unzipWebXSDJar’

This is causing me confusion I run the 3 tasks

task createDir(dependsOn: [cleanUltraESB]){

def work = new File("./${ultraESB}/conf/work")
work.mkdirs()

def unzipped = new  File("./${ultraESB}/conf/work/unzipped")
unzipped.mkdirs();

def schema = new File("./${ultraESB}/conf/schema")
schema.mkdirs()

}

task downloadWebXSDJar(type: Download, dependsOn: [createDir]) {
src([
http://myrepository/gta-jcbs-jaxb2-10.35.jar
])
dest “./${ultraESB}/conf/work”
}

task unzipWebXSDJar(type: Copy, dependsOn: [downloadWebXSDJar]){
from zipTree("./${ultraESB}/conf/work/gta-jcbs-jaxb2-10.35.jar")
into './${ultraESB}/conf/work/unzipped’
include ‘*’
}

Now task downloadWebXSDJar does down load the jar into the work directory

So am confused why the task unzipWebXSDJar cant see the jar file


(Lance Java) #2

As a rule of thumb, you should use file("x") rather than new File("./x") to reference files relative to the current project. To access files relative to the root project you can use new File(rootProject.projectDir, "x")


(Cavanagh) #3

Ok I got it working, the error message as it has no source files.

Did confuse me, i thought it meant it could not find the jar to unzip, but it could what I needed to add was the following

task unzipWebXSDJar(type: Copy, dependsOn: [downloadWebXSDJar]) {
from zipTree("./${ultraESB}/conf/work/gta-jcbs-jaxb2-10.35.jar")
into "./${ultraESB}/conf/work"
include ‘**/*.xsd’
}

So any unzip needs
From
into
include