推送指定jar包到远程仓库
使用命令
mvn deploy:deploy-file -Dfile=jar包完整名称
-DgroupId=pom文件中引用的groupId名
-DartifactId=pom文件中引用的artifactId名
-Dversion=pom文件中引用的version版本
-Dpackaging=jar -DrepositoryId=仓库标识Id
-Durl=仓库Url
mvn deploy:deploy-file -Dfile=taobao-sdk-java-auto_1629765040336-source-ty.jar -DgroupId=taobao-sdk-source-ty -DartifactId=alihealth -Dversion=1.0.1 -Dpackaging=jar -DrepositoryId=nexusXX -Durl=http://192.168.188.xx:xxxx/content/repositories/thirdparty
mvn deploy:deploy-file -Dfile=taobao-sdk-java-auto_1629765040336-ty.jar -DgroupId=taobao-sdk-ty -DartifactId=alihealth -Dversion=1.0.1 -Dpackaging=jar -DrepositoryId=nexusXX -Durl=http://192.168.188.xx:xxxx/content/repositories/thirdparty
pom文件中配置仓库地址
<!-- 远程仓库地址 -->
<distributionManagement>
<repository>
<id>nexusXX</id>
<url>http://192.168.xx.xx:xxxx/content/repositories/thirdparty</url>
</repository>
<snapshotRepository>
<id>nexusXX</id>
<url>http://192.168.xx.xx:xxxx/content/repositories/thirdparty</url>
</snapshotRepository>
</distributionManagement>
命令解释:
-Dfile:如果在jar包所在目录中运行cmd,则直接写jar包名称即可;如果在其他路径运行cmd,则写jar包的绝对路径。
-DrepositoryId:仓库标识Id。pom文件中配置的仓库地址中查找。
-Durl:仓库Url。可在pom文件中配置的仓库地址中查找。
-DgroupId:在pom中引用该jar包的groupId。
-DartifactId:在pom中引用该jar包的artifactId。
-Dversion:在pom中引用该jar包的version。
mvn deploy:deploy-file -Dfile=jar包完整名称 -DgroupId=pom文件中引用的groupId名 -DartifactId=pom文件中引用的artifactId名 -Dversion=pom文件中引用的version版本 -Dpackaging=jar -DrepositoryId=仓库标识Id -Durl=仓库Url
安装jar包到本地仓库
安装jar包到本地仓库
mvn install:install-file -DgroupId=taobao-sdk -DartifactId=alihealth -Dversion=1.0.1 -Dpackaging=jar -Dfile=taobao-sdk-source.jar
/* 命令解释: */
mvn install:install-file -DgroupId=在pom中引用该jar包的groupId
-DartifactId=pom中引用的artifactId名称
-Dversion=pom中引用的version版本
-Dpackaging=jar -Dfile=第三方jar包
Maven打包命令
maven常用打包命令
1、mvn compile
编译,将Java 源程序编译成 class 字节码文件。
2、mvn test
测试,并生成测试报告
3、mvn clean
将以前编译得到的旧的 class 字节码文件删除
4、mvn pakage
打包,动态 web工程打 war包,Java工程打 jar 包。
5、mvn install
将项目生成 jar 包放在仓库中,以便别的模块调用
6、mvn clean install -Dmaven.test.skip=true
抛弃测试用例打包