现在的位置: 首页 > 综合 > 正文

将项目生成maven模板(构件)并且上传到googlecode

2013年10月19日 ⁄ 综合 ⁄ 共 1739字 ⁄ 字号 评论关闭

===========项目生成maven模板 start=======================

call mvn eclipse:clean
call mvn clean
call mvn archetype:create-from-project  
cd target/generated-sources/archetype
call mvn install  -DcreateChecksum=true  
cd ../../../
call mvn eclipse:eclipse
REM OK
:end
pause

将上述内容保存为bat,并且在项目根目录下执行
===============项目生成maven模板 end====================

============安装nexus服务器 start================
下载 nexus(http://www.sonatype.org/nexus/),安装并且启动.   .

默认管理员  admin/admin123
登录系统后  把release目录(仓库)由[Disable Redeploy]切换成[Allow Redeploy].
note*  
Maven区别对待release版本的构件和snapshot版本的构件,snapshot为开发过程中的版本,实时,但不稳定,release版本则比较稳定。Maven会根据你项目的版本来判断将构件分发到哪个仓库。
==============安装nexus服务器 end================

=============准备maven配置 start=====================
在maven的setting.xml中添加 
-----------------

  <server>  
     <id>nexus-releases</id>  
    <username>deployment</username>    
  <password>deployment123</password>  
  </server>  
  <server>  
 
  <id>nexus-snapshots</id>    
  <username>deployment</username>  
    <password>deployment123</password>  
  </server>  

-----------------

===============准备maven配置 end====================

================配置构件的pom.xml start=========================
切换到项目的[\target\generated-sources\archetype]目录  ,在该目录下的pom.xml文件中新增

-----------------

  	 nexus-releases Nexus Release Repository http://nexus-server-ip:8081/nexus/content/repositories/releases/ nexus-snapshots Nexus Snapshot Repository http://nexus-server-ip:8081/nexus/content/repositories/snapshots/

-----------------

==============配置构件的pom.xml end================

把nexus的[\sonatype-work\nexus\storage]下的release目录svn到 google code上.
以后就可以方便的用该模板快速的生成项目了.

example  :
mvn archetype:generate -B -DarchetypeGroupId=com.cyjt.ipms  -DarchetypeArtifactId=bus-web-archetype -DarchetypeVersion=1.0 -DarchetypeRepository=http://myfirst-cmcc.googlecode.com/svn/repository/ -DgroupId=com.company.project -DartifactId=srs -Dversion=1.0

抱歉!评论已关闭.