1.安装到本地仓库

install jar to local fs

mvn install:install-file -Dfile=/home/hotspot/autoBuild/project/licenseVerify-0.0.1.jar -DgroupId=com.bonc -DartifactId=licenseVerify-0.0.1.jar -Dversion=0.0.1 -Dpackaging=jar

 2.部署到远程私有仓库

在项目的pom.xml配置如下

<distributionManagement>
    <repository>
        <id>deploymentMetaApp</id>
        <url>http://233xyx.com:9001/repository/maven-snapshots/</url>
    </repository>
</distributionManagement>

然后执行命令

mvn deploy:deploy-file -DgroupId=com.gexin.platform -DartifactId=gexin-rp-fastjson -Dversion=1.0.1 -Dpackaging=jar \
-Dfile=gexin-rp-fastjson-1.0.1.jar \
-Durl=http://233xyx.com:9001/repository/maven-snapshots/ -DrepositoryId=deploymentMetaApp
-DrepositoryId=deploymentMetaApp 是 pom.xml中指定的repository的id,与settings.xml中的servers>server>id 相对应。

需要在本机maven/conf/setting.xml配置如下

<servers>
	<server>
		<id>deploymentMetaApp</id>
		<username>admin</username>
		<password>Manager.123</password>
	</server>
</servers>
<mirrors>
	<mirror>
		<id>nexus-aliyun</id>
		<mirrorOf>*</mirrorOf>
		<name>Nexus aliyun</name>
		<url>http://maven.aliyun.com/nexus/content/groups/public</url>
	</mirror>
</mirrors>

<profile>     
	<!--profile的id-->  
	<id>dev</id>     
	<repositories>     
	<repository>    
		<!--仓库id,repositories可以配置多个仓库,保证id不重复-->  
		<id>deploymentMetaApp</id>     
		<!--仓库地址,即nexus仓库组的地址-->  
		<url>http://233xyx.com:9001/repository/maven-snapshots/</url>     
		<!--是否下载releases构件-->  
		<releases>
			<enabled>true</enabled>     
		</releases>     
		<!--是否下载snapshots构件-->  
		<snapshots>     
			<enabled>true</enabled>     
		</snapshots>     
	</repository>     
	</repositories>    
	<pluginRepositories>    
		<!-- 插件仓库,maven的运行依赖插件,也需要从私服下载插件 -->  
		<pluginRepository>    
			<!-- 插件仓库的id不允许重复,如果重复后边配置会覆盖前边 -->  
			<id>deploymentMetaApp</id>    
			<name>Public Repositories</name>    
			<url>http://233xyx.com:9001/repository/maven-public/</url>    
		</pluginRepository>
	</pluginRepositories>
</profile>  
<activeProfiles>
	<activeProfile>dev</activeProfile>
</activeProfiles>

  

 

 posted on 2017-07-26 15:43  ChaseForFuture  阅读(806)  评论(0编辑  收藏  举报