使用命令行添加Maven依赖项(Adding Maven dependency with command line)

编程入门 行业动态 更新时间:2024-10-22 16:28:04
使用命令行添加Maven依赖项(Adding Maven dependency with command line)

我刚刚安装了Maven 3 - 我是Java新手,我想了解Maven是如何工作的。 现在,我知道我可以通过在maven项目中编辑POM文件来添加依赖项,但我想知道是否有一种“干净”的方式来使用命令行。 运行Windows 8.1,Java 8,Maven 3。

I've just installed Maven 3 - I'm new to Java and I want to learn how Maven works. For now, I know that I can add a dependency by editing POM file in the maven project, but I wonder if there is a 'clean' way to do it with command line. Running Windows 8.1, Java 8, Maven 3.

最满意答案

直接使用POM可能是一种更好的方法......但是你可以:

mvn install:install-file -Dfile = -DgroupId =“group-id”\ -DartifactId =“artifact-id”-Dversion =“version”-Dpackaging =“packaging”

https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

Using the POM directly is probably a better way, but yes you can do that:

mvn install:install-file -Dfile=<path-to-file> -DgroupId="group-id" \ -DartifactId="artifact-id" -Dversion="version" -Dpackaging="packaging"

https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

更多推荐

本文发布于:2023-07-08 20:04:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1080271.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令行   Maven   Adding   line   command

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!