This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Maven can't find pom/jar from local repository

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to maven, and I am having trouble getting it to resolve some dependencies in a pom.xml file that I inherited. Rather than try to tackle all the failed dependencies, I decided to try and resolve just one. I took the original pom.xml and cut out everything except one dependency that was failing.
I know the jar file is in my local repository, but I keep getting an error message from maven that it cannot be found.

Here is my .m2/setttings.xml file. Offline is 'true' because I want to force maven to find the dependency in my local repository.


Here is my pom.xml file:


Here is the physical location of the jboss-jsf-api_2.1_spec artifact:



Here is my attempt to re-add the jar (got an error that it was already in the repository):
mvn install:install-file -Dfile=/Users/admin/.m2/repository/org/jboss/javax/faces/jboss-jsf-api_2.1_spec/2.0.1.Final/jboss-jsf-api_2.1_spec-2.0.1.Final.jar -DgroupId=org.jboss.javax.faces -DartifactId=jboss-jsf-api_2.1_spec -Dversion=2.0.1.Final -Dpackaging=jar

By the way, when I set offline to 'false' in settings.xml, I get this error message:
Could not find artifact org.jboss.javax.faces:jboss-jsf-api_2.1_spec:jar:2.0.1.Final in central (http://repo.maven.apache.org/maven2) -> [Help 1]

Here is what I get if I take maven offline by setting offline to 'true' in settings.xml:

 
author & internet detective
Posts: 39789
797
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Warren,
That looks correct. Two things to try:

1) Check the permissions on your repository? Does your user id have read access? I know it implies you are an admin, but check anyway
2) Can you run that build without any dependencies? Try running "mvn install" and then check if it worked. Ideally it wrong to your local Maven repo. Although Maven giving a clearer error message of why it can't would be helpful too.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


<dependency>
<groupId>org.jboss.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.1_spec</artifactId>
<version>2.0.1.Final</version>
</dependency>


That doesn't look right. The groupId should be org.jboss.spec.javax.faces as can be seen here http://repo1.maven.org/maven2/org/jboss/spec/javax/faces/jboss-jsf-api_2.1_spec/2.0.1.Final/jboss-jsf-api_2.1_spec-2.0.1.Final.pom. So the dependency should be:



It looks like Maven finds the pom file in the directory that you listed and reads the information out of it and then sees that the groupId noted in that pom doesn't match the directory structure within the local repository and then throws that error. I'm not sure, just guessing.

So you might want to fix that groupId in your dependency first and then have the jar placed in the correct location within your local repo.

 
Warren Weis
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The dependency information was not correct. That seems to have been the problem. Thanks very much for catching that.
The odd thing is that this worked with a build I was doing using a group repository that had been set up for me.
I didn't start having problems until I tried to update hibernate-core to version 4.3.

Perhaps this triggered Maven to try and look for the file, when it had not been doing so previously?

At any rate, thanks again. Here is the revised pom.xml file:

 
If you settle for what they are giving you, you deserve what you get. Fight for this tiny ad!
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!