How to include remote jar dependency in Maven

自闭症网瘾萝莉.ら 提交于 2020-01-03 17:47:29

问题


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?


回答1:


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



来源:https://stackoverflow.com/questions/29750417/how-to-include-remote-jar-dependency-in-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!