Apache MAVEN: How can I specify a jar dependency from a non standard repository without a pom in the repo?

Nujufas

I am newbie to Maven, My question described below:

I have a jar file in the following repo: http://www.repo.com/custom/path/Jarfile-0.1.0.jar

I have added the repository to the pom file as follows

<repository>
<url>http://www.repo.com/custom/path </url>
<id>Custom_repo</id>
</repository>

I have set the dependency in the pom file as follows:

<dependancy>
<groupId>XXX<groupId>
<artifactId>Jarfile</artifactId>
<version>0.1.0</version>
</depandancy>

when I do a compile 'mvn compile' The output is:

Downloading: http:/www.repo.com/custom/path/XXX/Jarfile/0.1.0/Jarfile-0.1.0.pom
[ERROR] Failed to execute goal on project X: could not resolve dependencies for project ... could not transfer artifact from Custom_repo... 

There are two issues:

  1. The path(consisting of groupid, artifactid and version) /XXX/Jarfile/0.1.0/ gets appended to the Custom_repo which I do not want - how can I get rid of it?
  2. I want to get the jar file and not a .pom file. What can be done to get the jar? (I know about the <systemPath> - but that is taking the jar from the system - not from repo)

Thank You.

venergiac

The maven repo is a little bit more complex than a simple jar. You can try to install a reposotory server such as Nexus.

http://www.sonatype.org/nexus/

See also this post Maven Internal Repository, Is it Really This Hard?

You can also install the jar file on local repository through:

mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>

Maven Dependency Search Sequence

  • Step 1 - Search dependency in local repository, if not found, move to step 2 else if found then do the further processing.

  • Step 2 - Search dependency in central repository, if not found and remote repository/repositories is/are mentioned then move to step 4 else if found, then it is downloaded to local repository for future reference.

  • Step 3 - If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).

  • Step 4 - Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can I resolve one Maven dependency from one repo and another dependency from second repo in same POM?

From Dev

Can I resolve one Maven dependency from one repo and another dependency from second repo in same POM?

From Dev

Can I remove jar from local repository without pom.xml?

From Dev

New maven dependency version pulling pom, not jar into private nexus repo?

From Dev

Git - How can I ignore a file of my repo without removing it from the repository?

From Dev

Git - How can I ignore a file of my repo without removing it from the repository?

From Dev

How can I exclude some packages (within a JAR) from a Maven dependency?

From Dev

How can I include a set of jar's as a single dependency in Maven?

From Dev

How can I remove maven dependency jar in Eclipse

From Dev

Is there a way to create maven dependency in pom file from a local jar

From Dev

Is there a way I can specify a different repository for the CocoaPods master repo?

From Dev

How can I specify an argument for the Repository's constructor from the Controller?

From Dev

The POM for org.apache.maven.plugins:maven-war-plugin:jar:3.0 is missing, no dependency information available

From Dev

Can I specify a CodeSniffer standard as a dev composer dependency?

From Dev

How to resolve the path to an artifact in a maven pom without being a project dependency?

From Dev

Can find maven dependency on mvnrepository.com but not on repo.maven.apache.org/maven2/

From Dev

Install Maven jar with pom into local repository

From Dev

Install Maven jar with pom into local repository

From Dev

How can I access a class from a external maven dependency in GWT?

From Dev

read properties of pom.xml of a maven ear/ejb from a jar file which is as a part of maven dependency

From Dev

How can I update a property in a Maven POM?

From Dev

Yum or Reposync: How can I slowly remove a repository without unintended dependency issues?

From Dev

How to specify "sources" JAR for local JAR dependency?

From Dev

maven: how to build the dependency from source.jar to jar files and put the jar file as it dependency?

From Dev

Local Nexus repository pulls everything but the main jar through POM dependency

From Dev

How can I add JDT as a Maven dependency?

From Dev

How can I add LIRE dependency to Maven?

From Dev

How to get name of Maven dependency JAR (not full path) as a pom.xml variable

From Dev

How to add\install to maven dependency of newly created\third party jar in pom.xml

Related Related

  1. 1

    Can I resolve one Maven dependency from one repo and another dependency from second repo in same POM?

  2. 2

    Can I resolve one Maven dependency from one repo and another dependency from second repo in same POM?

  3. 3

    Can I remove jar from local repository without pom.xml?

  4. 4

    New maven dependency version pulling pom, not jar into private nexus repo?

  5. 5

    Git - How can I ignore a file of my repo without removing it from the repository?

  6. 6

    Git - How can I ignore a file of my repo without removing it from the repository?

  7. 7

    How can I exclude some packages (within a JAR) from a Maven dependency?

  8. 8

    How can I include a set of jar's as a single dependency in Maven?

  9. 9

    How can I remove maven dependency jar in Eclipse

  10. 10

    Is there a way to create maven dependency in pom file from a local jar

  11. 11

    Is there a way I can specify a different repository for the CocoaPods master repo?

  12. 12

    How can I specify an argument for the Repository's constructor from the Controller?

  13. 13

    The POM for org.apache.maven.plugins:maven-war-plugin:jar:3.0 is missing, no dependency information available

  14. 14

    Can I specify a CodeSniffer standard as a dev composer dependency?

  15. 15

    How to resolve the path to an artifact in a maven pom without being a project dependency?

  16. 16

    Can find maven dependency on mvnrepository.com but not on repo.maven.apache.org/maven2/

  17. 17

    Install Maven jar with pom into local repository

  18. 18

    Install Maven jar with pom into local repository

  19. 19

    How can I access a class from a external maven dependency in GWT?

  20. 20

    read properties of pom.xml of a maven ear/ejb from a jar file which is as a part of maven dependency

  21. 21

    How can I update a property in a Maven POM?

  22. 22

    Yum or Reposync: How can I slowly remove a repository without unintended dependency issues?

  23. 23

    How to specify "sources" JAR for local JAR dependency?

  24. 24

    maven: how to build the dependency from source.jar to jar files and put the jar file as it dependency?

  25. 25

    Local Nexus repository pulls everything but the main jar through POM dependency

  26. 26

    How can I add JDT as a Maven dependency?

  27. 27

    How can I add LIRE dependency to Maven?

  28. 28

    How to get name of Maven dependency JAR (not full path) as a pom.xml variable

  29. 29

    How to add\install to maven dependency of newly created\third party jar in pom.xml

HotTag

Archive