There were so many issues and the post was getting big so I am splitting it into different posts. you can skip reading the 'preface' section of the other posts in this series.
Problem 1 of 6:
Missing version information in the pom.xml
I started the tutorial to go back to basics and brush-up on my hibernate knowledge, and I was really excited about learning Maven in the process. Just a few steps into the tutorial (section 1.1.5), I was trying to compile using the maven command:
mvn compile
And I hit my first road-block - I was getting the following error:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.hibernate.tutorials:hibernate-tutorial
POM Location: C:\Users\Krishna\workspace\hibernate\pom.xml
Validation Messages:
[0] 'dependencies.dependency.version' is missing for org.hibernate:hibernate-core:jar
[1] 'dependencies.dependency.version' is missing for javax.servlet:servlet-api:jar
[2] 'dependencies.dependency.version' is missing for org.slf4j:slf4j-simple:jar
[3] 'dependencies.dependency.version' is missing for javassist:javassist:jar
Reason: Failed to validate POM for project org.hibernate.tutorials:hibernate-tutorial at C:\Users\Krishna\workspace\hibernate\pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Failed to validate POM for project org.hibernate.tutorials:hibernate-tutorial at C:\Users\Krishna\workspace\hibernate\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:597)
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 org.hibernate.tutorials:hibernate-tutorial at C:\Users\Krishna\workspace\hibernate\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: Tue May 11 15:18:01 PDT 2010
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
I fixed it by adding the necessary version information. Here is the updated pom.xml
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.hibernate.tutorials
hibernate-tutorial
1.0-SNAPSHOT
First hibernate tutorials
${artifactId}
org.hibernate
hibernate-core
3.3.1.GA
javax.servlet
servlet-api
[2.4,)
org.slf4j
slf4j-simple
1.5.6
javassist
javassist
[3.0,)
junit
junit
3.8.1
test
No comments:
Post a Comment