當我們用maven下載jar包時,有時希望下載jar包的源代碼,此時可以在pom.xml文件中,進行設置。
<build>
<finalName>WebProject</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.3</version>
<configuration>
<container>
<!-- 指明使用的tomcat服務器版本 -->
<containerId>tomcat7x</containerId>
<!--指明tomcat服務器的安裝目錄 -->
<home>C:\d\install_software\apache-tomcat-7.0.75-windows-x86\apache-tomcat-7.0.75</home>
</container>
<configuration>
<type>existing</type>
<!--指明tomcat服務器的安裝目錄 -->
<home>C:\d\install_software\apache-tomcat-7.0.75-windows-x86\apache-tomcat-7.0.75</home>
</configuration>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</configuration>
<executions>
<execution>
<id>cargo-run</id>
<phase>install</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<configuration>
標簽部分追加進來之后,重新編譯項目,就可以得到源代碼了。