开发者

Alternative configurations in Gradle for compiling Java

开发者 https://www.devze.com 2023-01-10 14:35 出处:网络
With Gradle there are some default configurations such as compile, runtime etc but for various reasons I wish to use some alternative configurations.How do I tell the compilation task abou开发者_开发技

With Gradle there are some default configurations such as compile, runtime etc but for various reasons I wish to use some alternative configurations. How do I tell the compilation task abou开发者_开发技巧t these configurations? The documentation seems to suggest that it can be set on the sourceset using compileClasspath but I'm unclear how exactly this is done.


You could do:

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

You can also have a look at the sample at GRADLE_HOME/samples/java/withIntegrationTests to see how the classpaths of a source set are configured.

Hans

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

0

精彩评论

暂无评论...
验证码 换一张
取 消