how to download and install jar in my local repo Maven

I am trying to download a jar for an internal repo with i have under tomcat and then install it to my local maven repo.

the jar file can be found under the path:http://10.11.250.14/strepo/ext/JSErrorCollector-0.2.jar

i edit my pom.xml providing the link of the internal repo and also add a dependency in the pom but the maven cannot downloaded thre jar.

<repositories>
    <repository>
      <id>internal.repo</id>
      <url>http://10.11.250.14/strepo/ext/</url>
          </repository>
 </repositories>

  <dependencies>   

     <dependency>
        <groupId>org.JS</groupId>
        <artifactId>JSErrorCollector</artifactId>
        <version>0.2</version>
    </dependency> 

Could you please anyone help me?


It's not just the jar only to make a Maven repository, there are a bunch of other stuffs required to be regarded as Maven repository. From the URL I think it is not a standard Maven repository layout.

So you have at least 2 options:

  • Setup your own local network Maven repository, either using Artifactory, Nexus or other similar software systems.
  • Download the file and add it to your local machine repository.
  • For option 2, just download the file, and then run the Maven mvn command as follow (assuming the file is at your current directory):

    mvn install:install-file -Dfile=JSErrorCollector-0.2.jar -DgroupId=strepo.ext -DartifactId=JSErrorCollector -Dversion=0.2 -Dpackaging=jar
    

    After that you can refer to that using:

    <dependency>
        <groupId>strepo.ext</groupId>
        <artifactId>JSErrorCollector</artifactId>
        <version>0.2</version>
    </dependency>
    
    链接地址: http://www.djcxy.com/p/29662.html

    上一篇: 如何预先构建在Maven中用作依赖项的jar

    下一篇: 如何在我的本地仓库Maven下载和安装jar