Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Maven doesn't find a jar that's in my local repo

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all!

I made an
$mvn install:install-file -Dfile=mylib.jar -DartifactId=mylib -DgroupId=mygroup -Dversion=6.1 -Dpackaging=jar -DgeneratePom=true

And it seems to succes as I find in my local repository both the jar and the pom where they should be. The problem is later when I run mvn package in another project which has mylib as a dependency. It tries to download it from the central m2 repository and of course it fails. It shows the error "Failed to resolve to artifact".

Any clue what's going on?

Thank you very much!

antonio
 
Ranch Hand
Posts: 93
IntelliJ IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please, copy here the dependency that you have written in your pom.xml.
 
Antonio Fornie
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My dependency is

<dependency>
<groupId>ibm.websphere</groupId>
<artifactId>j2ee</artifactId>
<version>${pda.was.version}</version>
<scope>provided</scope>
</dependency>

My local settings include this property:
<pda.was.version>6.1</pda.was.version>

And my command to install was

mvn install:install-file -Dfile=j2ee.jar -DgroupId=ibm.websphere -DartifactId=j2ee -Dversion=6.1 -Dpackaging=jar -DgeneratePom=true


So now, for the project to package it should be straightforward, shouldn't it?

Thank you.

antonio
 
Eduardo Yañez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So the path to your local file within the repository is:

$HOME/.m2/repository/ibm/websphere/j2ee/6.1/j2ee-6.1.jar

Is it right?, could you check it, please?

I think the problem is that you ran:

mvn install:install-file -Dfile=j2ee.jar -DgroupId=ibm.websphere -DartifactId=j2ee -Dversion=6.1 -Dpackaging=jar -DgeneratePom=true

But it should be:

mvn install:install-file -Dfile=j2ee-6.1.jar -DgroupId=ibm.websphere -DartifactId=j2ee -Dversion=6.1 -Dpackaging=jar -DgeneratePom=true
 
Antonio Fornie
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Eduardo.

First of all, thank you very much for your replies.

My local repository is set in my settings.xml, and so I have:
$MyLocalMavenRepo/ibm/websphere/j2ee/6.1/j2ee-6.1.jar

The -Dfile arg must be the name of the file you've got in your source folder and is not the same as the name itwill have inside the repository. My source was j2ee.jar and the result in the repository is j2ee-6.1.jar.

Anyway my problem was I wrote a different artifactId for the pom of the project and the pom of the library... Just a mistake because of a single character and I couldn't see it. Sorry :#

antonio
 
Eduardo Yañez Parareda
Ranch Hand
Posts: 93
IntelliJ IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Antonio Fornie wrote:Hello Eduardo.

Anyway my problem was I wrote a different artifactId for the pom of the project and the pom of the library... Just a mistake because of a single character and I couldn't see it. Sorry :#

antonio



That was I suspected, therefore I ask you to write your dependency XML, but I didn't see anything wrong.

Good luck!
 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic