如何 mavenize 标准 eclipse 项目但仅针对某些依赖项
我有一个现有的 Eclipse 项目,其类路径中具有标准依赖项。我需要通过 Maven 添加新的依赖项,但其余依赖项需要作为与项目捆绑在一起的 jar 保留在那里。
我正在使用 m2e,如果我右键单击该项目 -->行家 -->启用maven,创建pom文件。在此阶段,我可以通过 pom 文件添加新的依赖项,但所有现有的依赖项似乎都从类路径中消失了。
因此问题是:有没有办法创建一个同时具有标准依赖项和 Maven 依赖项的混合项目?
I have an existing eclipse project with standard dependencies in the classpath. I need to add a new dependency through maven but the rest of the dependencies need to stay there as jars bundled with the project.
I am using m2e, if I right click on the project --> maven --> enable maven, a pom file is created. At this stage I can add my new dependency through the pom file but all the existing dependencies seem to be gone from the classpath.
Hence the question: Is there a way to create a hybrid project that has both standard dependencies and maven dependencies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用范围“system”(和标签“systemPath”)添加旧依赖项吗?
请参阅http://maven.apache.org/guides/introduction/依赖机制简介.html。
You could add your legacy dependencies by using the scope "system" (and the tag "systemPath") ?
See http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html.
我认为你甚至不应该尝试创建这样的东西,而且我不知道你为什么想要这样做。
如果您想使用 Maven,那么您应该在 pom 中定义所有依赖项,以便 Maven 构建真正起作用。如果您的所有依赖项都没有定义,您如何期望 Maven 构建您的项目?
您需要决定要使用哪种依赖性解析方法,而不是尝试将两种方法混合在一起。
I don't think you should even attempt to create such a thing, and I don't know why you would want to.
If you want to use Maven, then you should define all your dependencies in your pom so that a maven build will actually work. If all your dependencies aren't defined, how do you expect maven to build your project?
You need to decide which means of dependency resolution you want to use instead of trying to mix two together.