如何手动将jar文件加入到maven的local repository中

来源:互联网 发布:java 如何encode 编辑:程序博客网 时间:2024/06/08 12:55

编译打包hello-world.jar后,为了符合Maven的规定,需要给hello-world.jar一个版本号,故将hello-world.jar改名为hello-world-1.0.jar,此后便可以用mvn来安装此包到Maven的local repository中了:

mvn install:install-file -Dfile=../hello-world-1.0.jar -DgroupId=com.qq -DartifactId=hello-world -Dversion=1.0 -Dpackaging=jar

1.-Dfile选项对应jar文件所在路径,../hello-world-1.0.jar 代表所在当前项目下。
2.-DgroupId 对应的groupId,即依赖中所对应的路径,在pom.xml中设置中

        <dependency>            <groupId>com.qq</groupId>            <artifactId>hello-world</artifactId>            <version>1.0</version>        </dependency>

对应groupId。

阅读全文
0 0
原创粉丝点击