7

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?

1 Answer 1

11

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>
4
  • ok, if i understood there is no way for a repo not a maven one to take a jar file and install it,so i need to dwnload in the local repo and then run the mvn install:install-file in order to create the pom file. i didnt understand why i need the dependency in the pom file since i installed the jar file? Commented Oct 13, 2012 at 15:34
  • 1
    When you do the install:install-file it actually creates a local copy in your local disk (default to $HOME/.m2/repository, unless you configure it to somewhere else). After it is in your local disk, you still need to refer it from your pom.xml file so that Maven binaries knows that your project is referring to that artifact. Commented Oct 15, 2012 at 4:16
  • And yet another Maven repository question with no real answer. Does anyone actually know how to make this work?
    – Anton
    Commented Dec 1, 2016 at 13:47
  • @WillByers The original question by user1743405 was assuming that just by providing binaries in the correct path will make that works. So I came with the suggestion to install Maven repository instead of using plain Tomcat. Those stuff works. Let me know if you are having problem, and probably post separate question on it. Commented Dec 2, 2016 at 1:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.