编译打包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。
本文介绍如何为自编译的hello-world.jar指定版本号并使用Maven命令将其安装到本地仓库。包括如何正确命名Jar包及使用mvn install:install-file命令的具体参数说明。
897

被折叠的 条评论
为什么被折叠?



