我正在使用Maven2来构建我的项目。我希望我的构建在编译时自动下载依赖源jar 。依赖性可执行jar正确下载。我的依赖关系如下:
...
<dependencies>
<dependency>
<groupId>id.name</groupId>
<artifactId>artifact-name</artifactId>
<version>1403.00</version>
</dependency>
</dependencies>
...
我确实有maven源插件:
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
...
我也尝试将此配置添加到maven-source-plugin下的pom中:
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
</configuration>
我需要添加到我的pom文件中才能实现此目的?
答案 0 :(得分:1)
将此添加到您的POM:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>download-sources</id>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>