How do I define a compile-time *only* classpath in Gradle?

前端 未结 11 2193
[愿得一人]
[愿得一人] 2020-12-02 11:51

Can someone please give me a simple build.gradle example of how I can specify compile-time-only classes that are not included in the runtime deployment (war).

Gradl

11条回答
  •  孤街浪徒
    2020-12-02 12:37

    In Gradle 2.12 a compileOnly configuration has been introduced. A blog post introducing this features can be found here:

    Gradle latest feature: Compile only dependencies

    Please be aware of one important side effect:

    As a result of the addition of the “compileOnly” configuration, the “compile” configuration no longer represents a complete picture of all compile time dependencies. When needing reference a compile classpath in build scripts or custom plugins, the appropriate source set’s compileClasspath property should be used instead.

提交回复
热议问题