java maven 重建依赖
我有一个具有依赖项 A 的项目。 项目正在打包成 WAR 和依赖项 A - 打包成 jar。 还有另一个依赖项 B,它也依赖于 A。 我想打包项目,当项目 B 打包时,它必须重建其依赖项 A,而不是获取已编译的依赖项。 请帮忙,我怎样才能实现这个目标
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
安装时始终执行干净操作,即
mvn clean install
。这将确保项目中的所有模块都被重建、打包并安装在本地 .m2 存储库中,以便包含在父依赖项和项目中。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.您可能需要一个包含三个项目(WAR、A 和 B)的多模块项目。然后,您可以在多模块项目上运行 mvn package,它将构建并打包所有最新的项目代码,而无需先运行 mvn install 来更新本地存储库中的依赖项。
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.