Maven – 始终下载源代码和 javadocs
有没有办法将maven配置为始终下载源代码和javadocs?指定每次(通常与运行mvn编译两次一起进行,因为我忘记了第一次)变得相当乏味。-DdownloadSources=true -DdownloadJavadocs=true
有没有办法将maven配置为始终下载源代码和javadocs?指定每次(通常与运行mvn编译两次一起进行,因为我忘记了第一次)变得相当乏味。-DdownloadSources=true -DdownloadJavadocs=true
打开设置.xml文件(如果不存在,请创建该文件)。添加添加了属性的部分。然后确保活动配置文件包含新的配置文件。~/.m2/settings.xml
<settings>
<!-- ... other settings here ... -->
<profiles>
<profile>
<id>downloadSources</id>
<properties>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>downloadSources</activeProfile>
</activeProfiles>
</settings>
在我的情况下,“设置.xml”解决方案不起作用,所以我使用此命令来下载所有源代码:
mvn dependency:sources
您还可以将其与其他 maven 命令一起使用,例如:
mvn clean install dependency:sources -Dmaven.test.skip=true
要下载所有文档,请使用以下命令:
mvn dependency:resolve -Dclassifier=javadoc