maven打包安装的时候安装源码
我们本地开发了一个模块,对其 mvn install
的时候会打包并将jar包安装(拷贝)到本地maven仓库相应的目录里。
那么如何安装的时候把源码也打包并放到本地仓库里呢?
install时安装源码
步骤
- 原来的pom.xml里添加
<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>
- 再次install,则可以看到本地仓库的目录下出现了这个源码包,如图