In my project I have some buildependencies that are conditional, I want to be able to build other tasks if these are not present.
buildscript {
repositories {
mavenCentral()
}
dependencies {
if(icegridguiProguard.toBoolean()) {
classpath group: 'net.sourceforge', name: 'proguard', version: '5.0'
}
}
}
if(icegridguiProguard.toBoolean()) {
// Build a proguard JAR
else {
// Build a plain JAR
}
So when I build with -PofflineBuild=true I build a plain JAR and avoid proguard dependency, and for “online” builds I build a proguard JAR.
That doesn’t seems to work as I expected, if I first build with -PicegridguiProguard=true the plain JAR is build correctly, but if I now try to do a proguard build with -PicegridguiProguard=false.
Can somebody explain what is the problem with this approach and how to correctly define dynamic dependencies for the build script.
That is part of a more large build script see
https://github.com/zeroc-ice/ice/blob/3.6/java/src/IceGridGUI/build.gradle
and the complete error
jose@amulet:~/Documents/ZeroC/ice3.6/java$ ./gradlew -PicegridguiProguard=false
Downloading https://services.gradle.org/distributions/gradle-2.6-bin.zip
.............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping /home/jose/.gradle/wrapper/dists/gradle-2.6-bin/7og9jkn1p1nxjafu1htp0hhvc/gradle-2.6-bin.zip to /home/jose/.gradle/wrapper/dists/gradle-2.6-bin/7og9jkn1p1nxjafu1htp0hhvc
Set executable permissions for: /home/jose/.gradle/wrapper/dists/gradle-2.6-bin/7og9jkn1p1nxjafu1htp0hhvc/gradle-2.6/bin/gradle
Starting a new Gradle Daemon for this build (subsequent builds will be faster).
Parallel execution is an incubating feature.
Download https://repo.zeroc.com/nexus/content/repositories/releases/com/zeroc/gradle/ice-builder/slice/1.3.13/slice-1.3.13.pom
Download https://repo.zeroc.com/nexus/content/repositories/releases/com/zeroc/gradle/ice-builder/slice/1.3.13/slice-1.3.13.jar
Download https://repo.zeroc.com/nexus/content/repositories/thirdparty/org/apache/tools/bzip2/1.0/bzip2-1.0.pom
Download https://repo.zeroc.com/nexus/content/repositories/thirdparty/org/apache/tools/bzip2/1.0/bzip2-1.0.jar
:help
Welcome to Gradle 2.6.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL
Total time: 31.119 secs
jose@amulet:~/Documents/ZeroC/ice3.6/java$ ./gradlew clean
Parallel execution is an incubating feature.
Download https://repo.zeroc.com/nexus/content/repositories/thirdparty/net/sourceforge/proguard/5.0/proguard-5.0.pom
Download https://repo.zeroc.com/nexus/content/repositories/thirdparty/net/sourceforge/proguard/5.0/proguard-5.0.jar
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jose/Documents/ZeroC/ice3.6/java/src/IceGridGUI/build.gradle' line: 98
* What went wrong:
A problem occurred evaluating project ':IceGridGUI'.
> Could not find property 'proguard' on project ':IceGridGUI'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.556 secs