Deploying the Maven plugin for source.jar and javadoc.jar

I am using the maven release plugin to generate the release of my project. I do not want to generate Javadoc all the time that I create. On the other hand, when I call release: execute, I would like maven to generate sources.jar and javadoc.jar and deploy it to the maven release repository. Just because I'm curious how the deployment of source.jar can be disabled, as it looks like it is deployed by default.

+4
source share
2 answers

Use the releaseProfiles parameter (example: src,javadoc ) to enable one or more profiles, and in these profiles define the source and generation of javadoc:

 <profiles> <profile> <id>src</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.1.2</version> <executions> <execution> <id>attach-sources</id> <phase>verify</phase> <goals> <goal>jar-no-fork</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>javadoc</id> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.7</version> <executions> <execution> <id>attach-javadocs</id> <phase>verify</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> 
+10
source

From the Maven Release Plugin documentation, there is a useReleaseProfile parameter that defines Whether to use the release profile that adds sources and javadocs to the released artifact, if appropriate . By default, this is true . You can try changing this to enable / disable source / javadocs.

+10
source

Source: https://habr.com/ru/post/1335833/


All Articles