-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Unable to download Hibernate Dependencies through Maven
PostPosted: Mon Mar 01, 2010 6:27 pm 
Newbie

Joined: Mon Mar 01, 2010 6:09 pm
Posts: 2
Hi, I'm new to Hibernate, as per Hibernate tutorial I tried to download on of the hibernate dependencies. I added the following entry in pom.xml
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>

When I ran maven compile, I got this error:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: com.hibernate:hibernate-prj
POM Location: /projects/hibernate-prj/pom.xml
Validation Messages:

[0] 'dependencies.dependency.version' is missing for org.hibernate:hibernate-core:jar
Reason: Failed to validate POM for project com.hibernate:hibernate-prj at /projects/hibernate-prj/pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for project com.hibernate:hibernate-prj at /projects/hibernate-prj/pom.xml
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:404)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:272)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.project.InvalidProjectModelException: Failed to validate POM for project com.hibernate:hibernate-prj at /projects/hibernate-prj/pom.xml
at org.apache.maven.project.DefaultMavenProjectBuilder.processProjectLogic(DefaultMavenProjectBuilder.java:1077)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildInternal(DefaultMavenProjectBuilder.java:880)
at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:508)
at org.apache.maven.project.DefaultMavenProjectBuilder.build(DefaultMavenProjectBuilder.java:200)
at org.apache.maven.DefaultMaven.getProject(DefaultMaven.java:604)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:487)
at org.apache.maven.DefaultMaven.getProjects(DefaultMaven.java:391)
... 12 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Mon Mar 01 22:15:29 GMT 2010
[INFO] Final Memory: 1M/3M
[INFO] ------------------------------------------------------------------------

Can anyone pl. let me know what I'm doing wrong here? If I add any other dependency like log4j mentioned below everything works
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
<scope>compile</scope>
</dependency>

When I add the above dependency then I'm not getting pom exceptions and it is downloaded properly.


Top
 Profile  
 
 Post subject: Re: Unable to download Hibernate Dependencies through Maven
PostPosted: Tue Mar 02, 2010 3:47 am 
Newbie

Joined: Mon Mar 01, 2010 7:17 am
Posts: 10
Hi,

You need to specify the version of Hibernate Core that you want to use. For example, for Hibernate 3.3.1GA:

Code:
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-core</artifactId>
  <version>3.3.1.GA</version>
</dependency>


As you can see, in your other dependency you have specified a version, that's the reason why it does not fail :)

Regards,
Nuno Guerreiro


Top
 Profile  
 
 Post subject: Re: Unable to download Hibernate Dependencies through Maven
PostPosted: Tue Mar 02, 2010 8:39 pm 
Newbie

Joined: Mon Mar 01, 2010 6:09 pm
Posts: 2
Thanks Nuno, Yes, I came around this problem after doing some research, I gave the dependency version as you mentioned and it worked. Should this thing have been mentioned in the sample pom.xml in the tutorial? After all any newbie like me fall in this trap!


Top
 Profile  
 
 Post subject: Re: Unable to download Hibernate Dependencies through Maven
PostPosted: Wed Mar 03, 2010 3:32 am 
Newbie

Joined: Mon Mar 01, 2010 7:17 am
Posts: 10
Yes, I believe it should have been included in the tutorial. AFAIK, you can only omit the version in plugins, not in artifacts on which a project depends.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.