使用 Maven 进行库开发
这可能更多的是一个过程,而不是技术解决方案。我目前正在开发一个项目,该项目分为一个库和一个实施应用程序。这样做是在构建应用程序时调试库的一种非常有效的方法。我想对这两个项目使用 Maven,但我不想为每个微小的更改进行构建和部署。有没有办法让 Maven 几乎将项目引用为存储库?
This may be more of a process then technology solution. I am currently working on a project that is split into a library and an implementation application. Doing this has been a very effective way to debug the library as the application is built. I would like to use Maven for both projects but I do not want to do a build and deploy for each minor change. Is there a way for Maven to reference the project as the repository almost?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你说得对,这是一个流程问题。我将您的问题解释为希望避免将库的特定版本声明为实现中的依赖项。目的是独立更新任一组件,特别是您希望能够更新库而无需重建实现。
如果您进行更改,您显然需要重建并重新部署一些东西。但是,我可以看到两个步骤可以解决您的担忧。我将把你的组件称为“lib”和“app”。
希望这对您有意义,并且我已经正确解释了您的问题。
You're right, this is a process question. I interpret your question as wanting to avoid declaring a specific version of the library as a dependency in the implementation. The intent is to update either component independently, in particular you want to be able to update the library without having to rebuild the implementation.
You will obviously need to rebuild and redeploy something if you make a change. However, I can see two steps that should address your concern. I'm going to call your components 'lib' and 'app'.
Hopefully this makes sense to you and I've correctly interpreted your question.
您可以拥有一个包含两个子项目的“super-pom”。一个项目将是您的图书馆,另一个项目将是您的应用程序。两者都可以单独开发。
您的应用程序将依赖于带有库的项目。
例如:
“super-pom”:将此pom.xml存放在上级目录中。你会在里面有这样的东西:
然后你的库 pom.xml 会有这样的东西:
你的应用程序会有这样的东西:
You can have a "super-pom" which has two sub-projects. One project would be your library and the other project would be your application. Both can be developed individually.
Your application would have a dependency on the project with the library.
For example:
"super-pom": store this pom.xml in the higher up directory. You would have something like this in it:
Then your library pom.xml would have something like this:
And your app would have something like this:
看起来像我想要的。只需从项目运行它就会将其添加到本地存储库,其他应用程序可以拾取它。
Looks like what I want. Just running it from project will add it to the local repo and the other apps can pick it up.