Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven not downloading dependency for org.eclipse.persistence

 
Eric Lopez-Fernandez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey there,

I am having trouble with maven. I do have the following POM.xml file



And here is the error message I'm getting

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5:compile (default-compile) on project chapter02: Compilation failure: Compilation failure:
[ERROR] ~\05292012\src\main\java\Book.java:[3,0] package javax.persistence does not exist

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

It seems like maven was not able to download the dependency for org.eclipse.persistence

Has somebody had that problem before?

Any help will be greatly appreciated!
Eric
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If mvn failed to download something you usually get an error message stating that fact. Are there any other error messages before the one you posted?
 
Eric Lopez-Fernandez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply E Armitage!

That is the first error message. If I go to ~\.m2\repository I am not able to find anything related to org.eclipse.persistence, however I am able to find stuff related to maven-compiler-plugin

I was wondering if the problem is with the repository that I'm specifying or with the version number for the dependencies. Do you have any idea?
 
James Boswell
Bartender
Posts: 1051
5
Chrome Eclipse IDE Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that URL for the EclipseLink repo exists anymore.

Have you tried the repo at java.net instead?

 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try removing the <dependencyManagement> tags. That is, delete lines 13 and 42.

Because you are getting a compiler error, the problem you are having is not with downloading artifacts. Instead, the issue is that the compiler classpath doesn't include the JARs that you need. I think that the <dependencyManagement> tags are causing this, hence my suggestion to remove them. One way to check this is to use the -X option and observe what the compiler classpath gets set to.
 
Eric Lopez-Fernandez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The problem was fixed by removing the <dependencyManagement> tag. Somehow it was not allowing to download everything.

Thank YOU all for your help!
 
E Armitage
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Lopez-Fernandez wrote:
.. Somehow it was not allowing to download everything.

The explanation (which is always better than the solution) has already been given.
DependencyManagement doesn't state what your artifact depends on and so doesn't state what requires to be downloaded so no download was being done.
It specifies versions so that if you do add dependencies to your project then the project doesn't have to specify the versions since they are already in DependencyManagement.
When you add the actual dependencies the should not be under DependencyManagement.

 
Eric Lopez-Fernandez
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the explanation, I appreciate that!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic