Gradle Java Library Plugin: Difference between revisions
Jump to navigation
Jump to search
(6 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
=Overview= | =Overview= | ||
The Java Library plugin expands the capabilities of the [[Gradle_Java_Plugin|Java plugin]] by providing specific knowledge about Java libraries. In particular, a Java library exposes an API to consumers, so the plugin introduces the "api" configuration. All the source sets, tasks and configurations exposed by the Java plugin are implicitly available when using this plugin. | The Java Library plugin expands the capabilities of the [[Gradle_Java_Plugin#Overview|Java plugin]] by providing specific knowledge about Java libraries. In particular, a Java library exposes an API to consumers, so the plugin introduces the "api" configuration. All the source sets, tasks and configurations exposed by the Java plugin are implicitly available when using this plugin. The Java Library plugin should be used by default with Java projects: | ||
<syntaxhighlight lang='groovy'> | |||
plugins { | |||
id 'java-library' | |||
} | |||
java { | |||
toolchain { | |||
languageVersion = JavaLanguageVersion.of(11) | |||
} | |||
} | |||
</syntaxhighlight> | |||
The Java Library plugin integrates the [[Gradle Java Plugin#jar|jar]] and [[Gradle Java Plugin#test|test]] tasks, with the standard lifecycle tasks [[Gradle_Base_Plugin#assemble|assemble]] and [[Gradle_Base_Plugin#check|check]], respectively. | |||
Also see: {{Internal|Gradle Java Plugin|Java Plugin}} | |||
=Dependency Configurations= | |||
{{Internal|Gradle_Dependencies_and_Dependency_Configurations#Default_Configurations_added_by_the_Java_Library_Plugin|Default Configurations added by the Java Library Plugin}} |
Latest revision as of 07:30, 1 April 2021
External
Internal
Overview
The Java Library plugin expands the capabilities of the Java plugin by providing specific knowledge about Java libraries. In particular, a Java library exposes an API to consumers, so the plugin introduces the "api" configuration. All the source sets, tasks and configurations exposed by the Java plugin are implicitly available when using this plugin. The Java Library plugin should be used by default with Java projects:
plugins {
id 'java-library'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(11)
}
}
The Java Library plugin integrates the jar and test tasks, with the standard lifecycle tasks assemble and check, respectively.
Also see: