简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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