Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to download and install jar in my local repo Maven

Tags:

maven-2

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.xml but the maven cannot download the 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?

like image 566
user1743405 Avatar asked Oct 13 '12 13:10

user1743405


1 Answers

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:

  1. Setup your own local network Maven repository, either using Artifactory, Nexus or other similar software systems.
  2. 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>
like image 155
Daniel Baktiar Avatar answered Sep 20 '22 02:09

Daniel Baktiar