-
-
Save jandsu/978bd8a995c9c3b06de5 to your computer and use it in GitHub Desktop.
Gradle: unexpected UP-TO-DATE task while output file is missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
ext { | |
dest = file( "${buildDir}/generated-files" ) | |
} | |
task generate(type:JavaExec, dependsOn: [classes]) { | |
def destFile = new File(dest, "foo.txt") | |
outputs.file destFile | |
main 'org.foo.bar.FooMain' | |
classpath sourceSets.main.runtimeClasspath | |
args destFile | |
doFirst { | |
dest.mkdirs() | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.foo.bar; | |
import java.io.FileNotFoundException; | |
import java.io.PrintWriter; | |
import java.io.UnsupportedEncodingException; | |
public class FooMain | |
{ | |
public static void main( String[] args ) | |
throws FileNotFoundException, UnsupportedEncodingException | |
{ | |
boolean skip = false; | |
if ( !skip ) | |
{ | |
System.out.println( "Writing file" ); | |
PrintWriter writer = new PrintWriter( args[0], "UTF-8" ); | |
writer.println( "Hello World!" ); | |
writer.close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment