我注意到大多数发行版打包了他们的工件,如
my-1.0.jar
my-1.0-sources.jar
my-1.0-documentation.jar
当我进行部署时,我目前只获得my-1.0.jar
如何将源和文档生成为单独的jar?
答案 0 :(得分:0)
我将maven-source-plugin
和maven-javadoc-plugin
添加到了我的父pom.xml
的build.plugins部分。值得一提的是,我原本不小心将它们放在pluginManagement
中,当然只有当我手动将它们包含在孩子身上时才会有效。
<build>
<plugins>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>