解析错误读取POM。原因:无法识别的标签:'hibernate.annotations.version'

时间:2014-01-08 13:42:29

标签: maven pom.xml

我正在尝试关注此问题pache CXF – JAX-WS – Simple Tutorial,但构建已下载的示例(开箱即用!)在第一步失败了:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: unknown
POM Location: C:\Users\introspective\Workspace\SampleWSCxfStub\pom.xml

Reason: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Workspace\SampleWSCxfStub\pom.xml


[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.reactor.MavenExecutionException: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Workspace\SampleWSCxfStub\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: Parse error reading POM. Reason: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34)  for project unknown at C:\Users\introspective\Downloads\SampleWSCxfStub\pom.xml
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1610)
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1571)
    at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromSourceFileInternal(DefaultMavenProjectBuilder.java:506)
    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
Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'hibernate.annotations.version' (position: START_TAG seen ...</packaging>\n  \n \t<hibernate.annotations.version>... @8:34) 
    at org.apache.maven.model.io.xpp3.MavenXpp3Reader.parseModel(MavenXpp3Reader.java:2130)
    at org.apache.maven.model.io.xpp3.MavenXpp3Reader.read(MavenXpp3Reader.java:3912)
    at org.apache.maven.project.DefaultMavenProjectBuilder.readModel(DefaultMavenProjectBuilder.java:1606)
    ... 18 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Wed Jan 08 08:25:25 EST 2014
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------

知道这意味着什么以及为什么会发生这种情况?

这是Maven的问题吗? Eclipse的问题? CXF问题? Hibernate的问题?项目配置问题? (按原样下载,为什么会这样?)

如何解决此错误,以便我可以继续学习the basics of building a CXF-based client


为方便起见(如果您不想下载the sample ZIP in the link),这是pom.xml的内容:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.areyes.sample.server</groupId>
  <artifactId>SampleWSCxfStub</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>jar</packaging>

    <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
    <hibernate.validator.version>3.0.0.GA</hibernate.validator.version>
    <hibernate.commons.annotations.version>3.3.0.ga</hibernate.commons.annotations.version>
    <hibernate.ejb3.persistence.version>1.0.2.GA</hibernate.ejb3.persistence.version>
    <hibernate.version>3.2.6</hibernate.version>

</project>

更新

在摆脱“无法识别的标签”错误后(感谢@ Tome的回答),我有一个不同的错误:

  -pource 1.3中不支持

“注释”(使用-source 5或更高版本   启用注释“

但我很快就能解决这个问题(再次,感谢来自@Tome的提示),将以下内容添加到pom.xml中:

<build>
<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.5</source>
      <target>1.5</target>
    </configuration>
  </plugin>
</plugins>
</build>

1 个答案:

答案 0 :(得分:2)

看起来他们忘了将他们的属性放在标签内。

<properties>
    <hibernate.annotations.version>3.3.1.GA</hibernate.annotations.version>
    <hibernate.validator.version>3.0.0.GA</hibernate.validator.version>
    <hibernate.commons.annotations.version>3.3.0.ga</hibernate.commons.annotations.version>
    <hibernate.ejb3.persistence.version>1.0.2.GA</hibernate.ejb3.persistence.version>
    <hibernate.version>3.2.6</hibernate.version>
</properties>