Java 命令行上的 Maven 依赖更新
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21239573/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Maven dependency update on commandline
提问by cobie
I have a maven project that was built on the commandline for eclipse and one of the dependencies is constantly changing. How do I update this dependency on the commandline as I have heard that it is a bad idea to mix m2e plugin and commandline. Furthermore, I tried running mvn eclipse:eclipse
on the command line and it messes up the project in eclipse removing the dependencies folder.
我有一个基于 Eclipse 命令行构建的 Maven 项目,其中一个依赖项在不断变化。我听说混合 m2e 插件和命令行是个坏主意,我如何更新对命令行的依赖。此外,我尝试mvn eclipse:eclipse
在命令行上运行,它在 eclipse 中删除了依赖项文件夹,从而弄乱了项目。
回答by gowtham
Simple run your project online i.e mvn clean install
. It fetches all the latest dependencies that you mention in your pom.xml and built the project
简单地在线运行您的项目,即mvn clean install
. 它获取您在 pom.xml 中提到的所有最新依赖项并构建项目
回答by Ben Dale
mvn clean install -U
-U
means force update of dependencies.
-U
意味着强制更新依赖项。
Also, if you want to import the project into eclipse, I first run:
另外,如果要将项目导入 eclipse,我先运行:
mvn eclipse:eclipse
then run
然后运行
mvn eclipse:clean
Seems to work for me, but that's just my pennies worth.
似乎对我有用,但这只是我的一分钱。
回答by user2039709
If you just want to re-load/update dependencies (I assume, with constantly changing you mean either SNAPSHOTS or local dependencies you update yourself), you can use
如果您只想重新加载/更新依赖项(我假设,不断变化意味着您自己更新的快照或本地依赖项),您可以使用
mvn dependency:resolve
回答by narendra kumar
mvn -Dschemaname=public liquibase:update