0

I've installed my jar in my local repo as said in maven docs :

mvn install:install-file
  -Dfile=<path-to-file>
  -DgroupId=<dans>
  -DartifactId=<dans-lib>
  -Dversion=<1.0.0>
  -Dpackaging=<jar>
  -DgeneratePom=true

I can see in my /home/.m2/repository that the location is created and in the dans/dans-lib/1.0.0 there is my jar file. Unfortunately when I'm trying to add maven dependency in my pom.xml

<dependency>
     <groupId>dans</groupId
     <artifactId>dans-lib</artifactId>
     <version>1.0.0</version>
</dependency>

I got error Dependency dans:dans-lib not found. I've got no idea what might be the problem

0

1 Answer 1

1

First solution is to add local repo to pom.xml something like this

<repositories>
    <repository>
        <id>local-maven-repo</id>
        <url>file:///${project.basedir}/local-maven-repo</url>
    </repository>
 </repositories>

2nd solution woudld be to load jar file

<dependency>
 <groupId>dans</groupId
 <artifactId>dans-lib</artifactId>
 <version>1.0.0</version>
    <scope>system</scope>
    <systemPath>${project.basedir}/src/main/resources/Name_Your_JAR.jar</systemPath>
</dependency>
Sign up to request clarification or add additional context in comments.

3 Comments

actually after 10000 reload maven clicks it finally started to work.
Do not use system scope anymore cause it's deprecated for a long time...
@mario Sounds like your IDE cached a previous response. Always do things like this from the command line.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.