attach-source-javadoc |-- pom.xml |-- src\ `-- target `-- attach-source-javadoc-1.0-SNAPSHOT.jar `-- attach-source-javadoc-1.0-SNAPSHOT-javadoc.jar `-- attach-source-javadoc-1.0-SNAPSHOT-sources.jar
We execute the source:jar goal from the source plugin during the package phase.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
Same thing for the javadoc:jar goal from the javadoc plugin.
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <executions> <execution> <id>attach-javadocs</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>