Ant Library to detect Operating System fails in sentence IF
Answered
I am using import org.apache.tools.ant.taskdefs.condition.Os in one of my gradle scripts. The strange point is that, issuing gradlew command in xterm, it all works fine, but when I try to run the same task within the IDEa it fails !!!
The culprit line, right the if . If I comment it out, the IDEa runs the task allright; otherwise it fails :( :( :(
task compileLocal {
dependsOn 'compile'
group 'PIPELINE'
description '1. compile'
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println "************** Generating adecuated properties for Windoze"
def servidorOperador = new File( 'src/main/resources/ServidorOperador.properties' );
def backupRestore = new File( 'src/main/resources/BackupRestore.properties' );
} else {
println "************** Right choice. All running in Linux"
}
.....
}
However, I've got this subtask right at the beggining of the same gradle script and it works seamlessly at xTerm and IDEa too
task operativeSystem {
println "**************************** "
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
println "******* WINDOWS *****"
}
if (Os.isFamily(Os.FAMILY_UNIX)) {
println "******* UNIX ******"
}
println "**************************** "
}
Quite lost at the moment and no examples or explanations found to sort this out
Please sign in to leave a comment.
Still messing me up, anyway I've sorted it out just by creating a duplicated task, called ideCompile without that troublemaker line.
So I use the compileLocal in xterm and compileIde within IDEa. If you can't cross a road, surround it.
Could you please attach error message you've got while running task?
That's the other point, the absolute lack of , at least my, IDEa build messages. Just this :
Unable to see any further detail on the IDEa output :(
Anyway as I said, I surrounded it probably in a most correct way (using different tasks for xterm and IDEa)
Is it possible to share sample project example for investigation?
Not really. Sorry .
Anyway, it's been solved by creating an analog specific task for Linux