Javide
Javide

Reputation: 2637

How to include remote jar dependency in Maven

I need to include a third party jar to my pom.xml (using Maven 3.2.5 on a Linux environment).

If the jar file is available on the same machine that runs the build I can just declare the dependency in this way:

 <dependencies>
    <dependency>
        <groupId>Foo</groupId>
        <artifactId>Foo</artifactId>
        <version>Foo-1.0</version>
        <scope>system</scope>
        <systemPath>/myspace/javalibs/foo-1.0.jar</systemPath>
    </dependency>
</dependencies>

But what if the jar is on a different server such as

    <repositories>
        <repository>
            <id>myrepo</id>
            <url>http://192.168.0.14/download/java/thirdparty_repo</url>
        </repository>
    </repositories>

In what element should I specify the name of the jar file?

Upvotes: 4

Views: 1824

Answers (1)

Evgeniy Dorofeev
Evgeniy Dorofeev

Reputation: 135992

Remove

  <scope>system</scope>
  <systemPath>/myspace/javalibs/foo-1.0.jar</systemPath>

from pom and Maven will find the jar in http://192.168.0.14/download/java/maven_repo automatically

Upvotes: 1

Related Questions