Alternative configurations in Gradle for compiling Java

There are some default configurations with Gradle, such as compilation, runtime, etc., but for various reasons I want to use some alternative configurations. How do I tell the compilation task about these configurations? The documentation seems to suggest that it can be installed on the source using compileClasspath, but I don't understand how exactly this is done.

+4
source share
1 answer

You can do:

sourceSets { main { compileClasspath = configuration.myConf // or compileClasspath += configurations.myConf } } 

You can also view the sample in GRADLE_HOME / samples / java / withIntegrationTests to see how the classpaths of the source set are configured.

Hans

- Hans Docter
Founder, Gradle
http://www.gradle.org , http://twitter.com/gradleorg
CEO, Gradle Inc. - Gradle Training, Support, Consulting
http://www.gradle.biz

+4
source

All Articles