Vincent
Vincent

Reputation: 1477

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. Which I tried straight away. The project has quite a few JAR dependencies on other "plugins" (my project is a Minecraft plugin). Thus I tried to find a way to add these in the 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.

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? Or is there an alternative to the above configuration?

Upvotes: 1

Views: 189

Answers (1)

MariuszS
MariuszS

Reputation: 31595

Don't use scope system, it is designed mostly for libraries from 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.

Put all not maven libraries (jars) into maven repository - this is proper way.

Read how to install artifact into maven repository

Upvotes: 1

Related Questions