Gradle

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
To raise new issues or bugs against Gradle, please use forums.gradle.org.
  • Gradle
  • GRADLE-1483

Tasks of type JavaExec fails to honor inputs/outputs

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Resolution: Fixed
  • Affects Version/s: 1.0-milestone-2
  • Fix Version/s: 1.0-milestone-9

Description

The following task will always run regardless:

/** Generate webservice source files from wsdl **/
wsdlDir = file("src/main/resources/wsdl")
wsdlFile = file("$wsdlDir/SakWS.wsdl")
jaxbBindingsFile = file("$wsdlDir/jaxbBindings.xml")
task wsdl2Java(type: JavaExec) {    
    inputs.files configurations.cxfCodeGenLibs, wsdlFile, jaxbBindingsFile
    outputs.files generatedWsdlDir
    main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
    classpath = configurations.cxfCodeGenLibs
    args '-b', jaxbBindingsFile,
            '-d', generatedWsdlDir,
            '-xjc-Xts',
            wsdlFile
}
compileJava.dependsOn wsdl2Java

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • History
  • Activity
  • TeamCity
  • Commits
  • Source
  • Reviews
Hide
Permalink
Magnus Rundberget added a comment - 18/Apr/11 12:15 AM - edited

This workaround from Adam fixes it;

outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
Show
Magnus Rundberget added a comment - 18/Apr/11 12:15 AM - edited This workaround from Adam fixes it;
outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
Peter Niederwieser made changes - 22/Apr/11 5:05 AM
Field Original Value New Value
Description The following task will always run regardless:
/** Generate webservice source files from wsdl **/
wsdlDir = file("src/main/resources/wsdl")
wsdlFile = file("$wsdlDir/SakWS.wsdl")
jaxbBindingsFile = file("$wsdlDir/jaxbBindings.xml")
task wsdl2Java(type: JavaExec) {
    inputs.files configurations.cxfCodeGenLibs, wsdlFile, jaxbBindingsFile
    outputs.files generatedWsdlDir
    main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
    classpath = configurations.cxfCodeGenLibs
    args '-b', jaxbBindingsFile,
            '-d', generatedWsdlDir,
            '-xjc-Xts',
            wsdlFile
}
compileJava.dependsOn wsdl2Java
The following task will always run regardless:

{code}
/** Generate webservice source files from wsdl **/
wsdlDir = file("src/main/resources/wsdl")
wsdlFile = file("$wsdlDir/SakWS.wsdl")
jaxbBindingsFile = file("$wsdlDir/jaxbBindings.xml")
task wsdl2Java(type: JavaExec) {
    inputs.files configurations.cxfCodeGenLibs, wsdlFile, jaxbBindingsFile
    outputs.files generatedWsdlDir
    main = 'org.apache.cxf.tools.wsdlto.WSDLToJava'
    classpath = configurations.cxfCodeGenLibs
    args '-b', jaxbBindingsFile,
            '-d', generatedWsdlDir,
            '-xjc-Xts',
            wsdlFile
}
compileJava.dependsOn wsdl2Java
{code}
Hide
Permalink
Peter Niederwieser added a comment - 22/Apr/11 5:27 AM

Is there any particular reason why we set upToDateWhen {false} for JavaExec?

Show
Peter Niederwieser added a comment - 22/Apr/11 5:27 AM Is there any particular reason why we set upToDateWhen {false} for JavaExec?
Daz DeBoer made changes - 03/Aug/11 3:30 PM
Workflow jira [ 12905 ] jira with pivotal tracker [ 14473 ]
Hide
Create a new review for changeset ca753e472e30be5d49d812786225a00a6f58a3ce
Luke Daley <ld@ldaley.com> submitted changeset ca753e472e30be5d49d812786225a00a6f58a3ce to pull-request-138 in Gradle (2 files) - 16/Feb/12 5:54 AM

GRADLE-1483 - make it possible to make the java exec task incremental.
It has no declared outputs out of the box, so will run everytime. Now if the user declares some outputs then it can be incremental.

  • subprojects/core/src/main/groovy/org/gradle/api/tasks/JavaExec.java (+0 -2)
    • View diff to previous
    • View full source
    • View file history
    • Download raw file
  • subprojects/plugins/src/integTest/groovy/org/gradle/api/tasks/JavaExecIntegrationTest.groovy (+99)
    • View diff to previous
    • View full source
    • View file history
    • Download raw file
Show
Create a new review for changeset ca753e472e30be5d49d812786225a00a6f58a3ce
Luke Daley <ld@ldaley.com> submitted changeset ca753e472e30be5d49d812786225a00a6f58a3ce to pull-request-138 in Gradle (2 files) - 16/Feb/12 5:54 AM
Hide
Permalink
Luke Daley added a comment - 16/Feb/12 6:06 AM

The javaexec task can now be made incremental if you declare some outputs.

Out of the box it does not declare any outputs so will not be incremental.

Show
Luke Daley added a comment - 16/Feb/12 6:06 AM The javaexec task can now be made incremental if you declare some outputs. Out of the box it does not declare any outputs so will not be incremental.
Luke Daley made changes - 16/Feb/12 6:06 AM
Resolution Fixed [ 1 ]
Fix Version/s 1.0-milestone-9 [ 10161 ]
Assignee Luke Daley [ ldaley ]
Status Open [ 1 ] Resolved [ 5 ]
Hide
Permalink
Warren Muller added a comment - 27/Feb/12 2:55 AM

M6 and M8 did not work for me with:
outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
Trying gradle-1.0-milestone-9-20120227005038+0100 (last nights) did not work either. i.e. rebuilds every time
I am using a slightly more generic version:
Not all code included but this is the gist of it

// mc, cp, ag defined above as being set by iteration through a map of settings
	tasks.add(name: "wsdl2Java${k.capitalize()}",type: JavaExec) {
		description="Generates Java source for wsdl:${k}=${v.file}"
		outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
		outputs.files generatedWsdlDir
		inputs.files configurations.compile, wsdlFile
		main = mc
		classpath = cp
		args = ag
		logger.debug "main=${main},classpath=${classpath},args=${args}"
	}
	clean.dependsOn "cleanWsdl2Java${k.capitalize()}"
	project."compile${wsdlSrcSetName.capitalize()}Java".dependsOn "wsdl2Java${k.capitalize()}"
Show
Warren Muller added a comment - 27/Feb/12 2:55 AM M6 and M8 did not work for me with: outputs.upToDateSpec = new org.gradle.api.specs.AndSpec() Trying gradle-1.0-milestone-9-20120227005038+0100 (last nights) did not work either. i.e. rebuilds every time I am using a slightly more generic version: Not all code included but this is the gist of it
// mc, cp, ag defined above as being set by iteration through a map of settings
	tasks.add(name: "wsdl2Java${k.capitalize()}",type: JavaExec) {
		description="Generates Java source for wsdl:${k}=${v.file}"
		outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
		outputs.files generatedWsdlDir
		inputs.files configurations.compile, wsdlFile
		main = mc
		classpath = cp
		args = ag
		logger.debug "main=${main},classpath=${classpath},args=${args}"
	}
	clean.dependsOn "cleanWsdl2Java${k.capitalize()}"
	project."compile${wsdlSrcSetName.capitalize()}Java".dependsOn "wsdl2Java${k.capitalize()}"
Hide
Permalink
MikeN added a comment - 27/Feb/12 3:49 AM

M6 and M7 work for me with

outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
Show
MikeN added a comment - 27/Feb/12 3:49 AM M6 and M7 work for me with
outputs.upToDateSpec = new org.gradle.api.specs.AndSpec()
Luke Daley made changes - 03/Jan/13 5:09 AM
Status Resolved [ 5 ] Closed [ 6 ]
Workflow jira with pivotal tracker [ 14473 ] jira with pivotal tracker (no resolved, only closed) [ 17745 ]
Luke Daley made changes - 04/Jan/13 5:10 AM
Status Closed [ 6 ] Resolved [ 5 ]
Workflow jira with pivotal tracker (no resolved, only closed) [ 17745 ] Copy of jira with pivotal tracker (no closed, only resolved) [ 20372 ]
Unable to get TeamCity builds: No active plugin license is found! Please visit http://stiltsoft.com/teamcity for details

People

  • Assignee:
    Luke Daley
    Reporter:
    Magnus Rundberget
Vote (3)
Watch (4)

Dates

  • Created:
    18/Apr/11 12:14 AM
    Updated:
    04/Jan/13 5:10 AM
    Resolved:
    16/Feb/12 6:06 AM
  • Atlassian JIRA (v5.0.3#729-sha1:bf569e4)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Gradle. Try JIRA - bug tracking software for your team.