1.安裝到本地倉庫html
install jar to local fsjson
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.部署到遠程私有倉庫maven
在項目的pom.xml配置以下ui
<distributionManagement> <repository> <id>deploymentMetaApp</id> <url>http://233xyx.com:9001/repository/maven-snapshots/</url> </repository> </distributionManagement>
而後執行命令url
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配置以下spa
<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>