java maven 重建依赖
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4367665/
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
java maven rebuild dependency
提问by jdevrr
I have a project which has dependency A. Project is packing into WAR and dependency A - into jar. And another dependency B, which also depends on A. I want to pack project and when project B is packing it must rebuild its dependency A instead of getting compiled dependency. Please help, how can i achieve this
我有一个具有依赖项 A 的项目。项目正在打包到 WAR 和依赖项 A - 打包到 jar 中。还有另一个依赖B,它也依赖于A。我想打包项目,当项目B打包时,它必须重建它的依赖A而不是编译依赖。请帮忙,我怎样才能做到这一点
回答by jgifford25
Always perform a clean when doing an install, ie mvn clean install
. This will make sure that all modules in the project are rebuilt, packaged, and installed in the local .m2 repository for inclusion by parent dependencies and projects.
进行安装时始终执行清理,即mvn clean install
. 这将确保项目中的所有模块都被重建、打包并安装在本地 .m2 存储库中,以供父依赖项和项目包含在内。
回答by trask
What you may want is a multi-module project containing your three projects (WAR, A and B). Then you can run mvn package on the multi-module project and it will build and package all of the latest project code against each other without having to run mvn install to update the dependencies in your local repository first.
您可能需要一个包含三个项目(WAR、A 和 B)的多模块项目。然后,您可以在多模块项目上运行 mvn package,它将构建和打包所有最新的项目代码,而无需先运行 mvn install 来更新本地存储库中的依赖项。