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

0
5 comments
Avatar
Permanently deleted user

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. 

0

Could you please attach error message you've got while running task?

0
Avatar
Permanently deleted user

That's the other point, the absolute lack of , at least my, IDEa build messages. Just this :

Run Tasks (with red exclamation icon)

Task 1/3  Fails

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)

0

Is it possible to share sample project example for investigation?

0
Avatar
Permanently deleted user

Not really. Sorry . 

 

Anyway, it's been solved by creating an analog specific task for Linux

0

Please sign in to leave a comment.