一、背景
1、maven项目在打包时不会把import导入项目的jar包放到打好的包中。
二、具体操作
1、命令行中在
目录下或配置过MAVEN_HOME的命令行中执行如下命令
2、将新生成的jar部署到maven私服上的命令。
mvndeploy:deploy-file -DgroupId=com.zhicall.esb -DartifactId=myjar -Dversion=1.0.0 -Dpackaging=jar -Dfile=jta.jar-Durl=http://192.168.131.8:8081/nexus/content/repositories/thirdparty/(私服地址) -DrepositoryId=thirdparty
3、将第三方jar包安装到本地maven仓库中。
mvn install:install-file -Dfile=D:mvnspring-context-support-3.1.0.RELEASE.jar -DgroupId=com.zhicall.esb -DartifactId=myjar -Dversion=3.1.0.RELEASE -Dpackaging=jar
4、引用时只需在pom文件中添加如下配置就可引用3中jar包。
<dependency>
<groupId>com.zhicall.esb</groupId>
<artifactId>myjar</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>