如何将jar包打入到本地maven库中
程序员文章站
2022-06-18 17:16:04
...
(1) 首先选中项目右击,export,然后选中源文件,填上保存路径即可得到jar包。
(2)为方便起见,可以先将jar包放入d盘根目录下
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\lenovo>mvn -v
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: C:\Program Files (x86)\Java\apache-maven-3.0.4\apache-maven-3.0.4\bi
n\..
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_79\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
C:\Users\lenovo>d:
(3)执行命令
D:>
mvn install:install-file -Dfile=D:\SocketServiceResource.jar -DgroupId=com.c
mbc.socketservice -DartifactId=com.cmbc.socketservice -Dversion=1.0.0.RELEASE -D
packaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-po
m ---
[INFO] Installing D:\SocketServiceResource.jar to d:\repository\com\cmbc\sockets
ervice\com.cmbc.socketservice\1.0.0.RELEASE\com.cmbc.socketservice-1.0.0.RELEASE
.jar
[INFO] Installing C:\Users\lenovo\AppData\Local\Temp\mvninstall51317731576048254
84.pom to d:\repository\com\cmbc\socketservice\com.cmbc.socketservice\1.0.0.RELE
ASE\com.cmbc.socketservice-1.0.0.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.970s
[INFO] Finished at: Mon Mar 27 18:57:54 CST 2017
[INFO] Final Memory: 5M/244M
[INFO] ------------------------------------------------------------------------
D:\>mvn install:install-file -Dfile=D:\SocketServiceResource.jar -DgroupId=com.cmbc.socketservice -DartifactId=com.cmbc.socketservice -Dversion=1.0.0.RELEASE -Dpackaging=jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) @ standalone-po
m ---
[INFO] Installing D:\SocketServiceResource.jar to d:\local_repository\com\cmbc\s
ocketservice\com.cmbc.socketservice\1.0.0.RELEASE\com.cmbc.socketservice-1.0.0.R
ELEASE.jar
[INFO] Installing C:\Users\lenovo\AppData\Local\Temp\mvninstall58792773539181329
45.pom to d:\local_repository\com\cmbc\socketservice\com.cmbc.socketservice\1.0.
0.RELEASE\com.cmbc.socketservice-1.0.0.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.689s
[INFO] Finished at: Mon Mar 27 19:07:35 CST 2017
[INFO] Final Memory: 6M/308M
[INFO] ------------------------------------------------------------------------
D:\>mvn install:install-file -Dfile=D:\SocketServiceResource.jar -DgroupId=com.c
mbc.socketservice -DartifactId=com.cmbc.socketservice -Dversion=1.0.0.RELEASE -D
packaging=jar
(4)然后在项目中的pom文件中引用即可
<dependency>
<groupId>com.cmbc.socketservice</groupId>
<artifactId>com.cmbc.socketservice</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
(5) 然后点击项目右击 maven-install即可
上一篇: java发送邮件
下一篇: Maven打jar包,并将依赖包打进去
推荐阅读
-
Maven手动添加jar包到本地仓库
-
在maven中引入本地jar包的方法
-
小记-----如何把本地jar包加载到maven库中
-
Maven将jar包install到本地仓库deploy到远程仓库命令
-
手动添加jar包到本地maven仓库-小白实操记录
-
Springboot中引入本地jar包,并通过maven把项目成功打包成jar包部署
-
maven03_私服的安装启动、maven上传下载配置、安装第三方jar包到本地仓库、第三方jar安装到私服
-
maven命令安装第三方jar包到本地仓库和私服
-
maven配置安装项目依赖的本地jar包到本地仓库上并引用
-
【maven】maven 将依赖的jar包打入jar包中