`
wanxiaotao12
  • 浏览: 456091 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

maven发布时连带源码一起发布的pom配置

 
阅读更多

需要在要发布的pom项目里的pom.xml里添加如下内容:

[html] view plaincopy
  1. <project>  
  2.     <build>  
  3.         <plugins>  
  4.            <!--   要将源码放上去,需要加入这个插件    -->  
  5.             <plugin>    
  6.                 <artifactId>maven-source-plugin</artifactId>    
  7.                 <version>2.1</version>    
  8.                 <configuration>    
  9.                     <attach>true</attach>    
  10.                 </configuration>    
  11.                 <executions>    
  12.                     <execution>    
  13.                         <phase>compile</phase>    
  14.                         <goals>    
  15.                             <goal>jar</goal>    
  16.                         </goals>    
  17.                     </execution>    
  18.                 </executions>    
  19.             </plugin>              
  20.     </plugins>  
  21. </build>  
  22.   
  23. <distributionManagement>  
  24.  <repository>  
  25.    <id>releases</id>  
  26.    <name>Search Book Replace Plugin</name>  
  27.    <url>http://mvnrepo.xxxx.com/mvn/releases</url>  
  28.  </repository>  
  29.  <!--use the following if you ARE using a snapshot version. -->  
  30.  <snapshotRepository>  
  31.    <id>snapshots</id>  
  32.    <name>Search Book Replace Plugin</name>  
  33.    <url>http://mvnrepo.xxxx.com/mvn/snapshots</url>  
  34.  </snapshotRepository>  
  35. </distributionManagement>  
  36.   
  37. </project>  


 

然后执行  mvn deploy   即可.

如单独的打源码包可执行   mvn source:jar

<!--EndFragment-->

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics