简体   繁体   English

应该如何从Maven项目中引用非Maven项目

[英]How is one supposed to reference non-Maven projects from a Maven project

While working on an open source project someone suggested I should turn it into a Maven enabled project. 在从事开源项目时,有人建议我将其转变为启用Maven的项目。 Which I tried straight away. 我立即尝试了。 The project has quite a few JAR dependencies on other "plugins" (my project is a Minecraft plugin). 该项目在其他“插件”上有很多JAR依赖项(我的项目是Minecraft插件)。 Thus I tried to find a way to add these in the pom.xml. 因此,我试图找到一种在pom.xml中添加这些内容的方法。 After looking through the docu and looking at other projects this seems to be the way: 看完文档并看了其他项目之后,这似乎是这样的:

      <dependency>
      <groupId>net.milkbowl.vault</groupId>
      <artifactId>Vault</artifactId>
      <version>1.2.21-SNAPSHOT</version>
      <scope>system</scope>
      <systemPath>${project.basedir}/lib/Vault.jar</systemPath>
      </dependency>

However, I also read that "system" scope is frowned upon and Netbeans complains about it. 但是,我还读到“系统”范围已被皱眉,Netbeans对此表示抱怨。

So my question is, what is the proper way of handling this? 所以我的问题是,处理此问题的正确方法是什么? Do I need to suggest each and every dev to switch over to Maven? 我是否需要建议每个开发人员切换到Maven? Or is there an alternative to the above configuration? 还是上述配置有替代方案?

Don't use scope system , it is designed mostly for libraries from JDK. 不要使用范围系统 ,它主要是为JDK中的库设计的。

Dependencies with the scope system are always available and are not looked up in repository. 与作用域系统的依赖关系始终可用 ,不会在存储库中查找。 They are usually used to tell Maven about dependencies which are provided by the JDK or the VM. 它们通常用于告知Maven JDK或VM提供的依赖项。

Put all not maven libraries (jars) into maven repository - this is proper way. 将所有非Maven库(罐)放入Maven存储库-这是正确的方法。

Read how to install artifact into maven repository 阅读如何将工件安装到Maven存储库

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM