Using software components
Besides the artifact
method and the artifacts
property, we can also use the from
method inside a publications
configuration block. We specify SoftwareComponent
for Gradle as an argument to the from
method. The java
plugin adds SoftwareComponent
with the name java
, and it includes the jar
artifact and all runtime dependencies. The war
plugin adds the war
artifact as SoftwareComponent
. SoftwareComponent
is a part of the Gradle build model that defines a piece of code that depends on other code or is a dependency for other code.
In the next example build file, we will apply the war
plugin to our project, which will implicitly add the java
plugin. We also define two publications, each using SoftwareComponent
from both plugins. ...
Get Gradle Dependency Management now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.