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

前端 未结 11 2148
[愿得一人]
[愿得一人] 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

    It's quite common to have runtime dependencies that aren't compile time dependencies. The other way around is a fairly special case and as such requires a few lines of configuration in Gradle. I suggest to search the Gradle forum for provided.

    It sounds like what you are really after is declaring dependencies for your build, not for the compile class path. How this is done depends on how the desired functionality gets invoked (Ant task, Gradle task/plugin, ad-hoc use from build script). If you provide more detailed information on what you are trying to do, I can provide a more specific answer.

    Here are some links to relevant information in the Gradle user guide:

    • External dependencies for the build script
    • Declaring the class path for a custom Ant task

提交回复
热议问题