To include, add the following to your build.gradle
plugins {
id 'nebula.optional-base' version '3.0.3' // if you want optional-base
id 'nebula.provided-base' version '3.0.3' // if you want provided-base
}
Creates a new configuration named provided similar to providedCompile created by the
War plugin.
optional-base
-
OptionalBasePlugin
Provides an extra method for marking dependencies as optional.
To use the Provided plugin, include the following code snippet in your build script:
apply plugin: 'nebula.provided-base'
To use the Optional plugin, include the following code snippet in your build script:
apply plugin: 'nebula.optional-base'
Using the provided plugin
A dependency declared with the provided configuration is available on the compilation and test classpath. However, when
publishing the outgoing artifact of the project (usually a JAR file) with Ivy or Maven, the dependency is not marked as
required transitive dependency.
provided - this is much like compile, but indicates you expect the JDK or a container to provide it at runtime.
It is only available on the compilation and test classpath, and is not transitive.
Impact on metadata created when publishing artifact
When publishing a provided dependency to a Maven repository the declaration in the POM looks as such:
A dependency marked with the optional attribute is a dependency that is not necessarily meant to be required. The idea
is that some of the dependencies are only used for certain features in the project, and will not be needed if that feature
isn't used. For more information, please have a look at the Maven documentation.
Impact on metadata created when publishing artifact
When publishing a optional dependency to a Maven repository the declaration in the POM looks as such:
请发表评论