有没有办法我可以配置maven 总是下载源和javadocs?-DdownloadSources=true -DdownloadJavadocs=true每次指定(通常伴随着运行mvn编译两次因为我第一次忘记)变得相当乏味.
xec*_*s12 260
打开您的settings.xml文件~/.m2/settings.xml (如果它不存在,则创建它).添加添加了属性的部分.然后确保activeProfiles包含新的配置文件.
<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>
Run Code Online (Sandbox Code Playgroud)
Ale*_*rra 186
在我的情况下,"settings.xml"解决方案不起作用,所以我使用此命令来下载所有源:
mvn dependency:sources
Run Code Online (Sandbox Code Playgroud)
您还可以将其与其他maven命令一起使用,例如:
mvn clean install dependency:sources -Dmaven.test.skip=true
Run Code Online (Sandbox Code Playgroud)
要下载所有文档,请使用以下命令:
mvn dependency:resolve -Dclassifier=javadoc
Run Code Online (Sandbox Code Playgroud)
Ven*_*Rao 47
只需合并并准备单一命令来解决源和文档下载问题......
mvn dependency:sources dependency:resolve -Dclassifier=javadoc
Run Code Online (Sandbox Code Playgroud)
Gha*_*kus 41
来自Google的人的回答
在Eclipse中,您可以自动下载javadoc和源代码.
为此,右键单击项目并使用
kev*_*rpe 14
我使用Maven 3.3.3并且无法获取默认配置文件以在用户或全局settings.xml文件中工作.
作为解决方法,您还可以向pom.xml文件中添加其他构建插件.
<properties>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
</properties>
<build>
<plugins>
<!-- Download Java source JARs. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
163160 次 |
| 最近记录: |