用apache-maven-3.1.1 编译工程,提示 Non-parseable POM :Unrecognised tag: 'parent' (position: S TART_TAG),恳请.高手大神们看看。

113 views
Skip to first unread message

malf...@gmail.com

unread,
Dec 9, 2013, 12:29:19 PM12/9/13
to mave...@googlegroups.com
用apache-maven-3.1.1 编译工程,提示 Non-parseable POM :Unrecognised tag: 'parent' (position: S TART_TAG),恳请.高手大神们问问诊。


 

apache-maven-3.1.1 编译工程,提示 Non-parseable POM Unrecognised tag: 'parent' (position: S TART_TAG seen ...</relativePath>\r\n  <parent>.., 报错日志打印截图如下:

 

 

具体的项目目录结构和pom.xml定义如下。

 

 

1. 项目的目结构录:


截图中,itts-parent定义了模块的聚合和继成配置,与itts-platform下的各个模块是同级的,

但为了方便,把itts-parent目录下的 pom.xml 提到 itts-platform 下。

 

2. itts-platform/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.itrace.itts</groupId>

  <artifactId>itts-parent</artifactId>

  <version>1.0.0-SNAPSHOT</version>

  <packaging>pom</packaging>

  <name>ITTS Platform Parent Module</name>

  <url></url>

 

  <modules>

                                                                                      <module>itts-common</module>

                                                                                      <module>itts-core</module>

                                                                                      <module>itts-persist</module>

                                                                                      <module>itts-service</module>

                                                                                      <module>itts-web</module>

  </modules>

 

<properties>

……..

</properties>

 

 

<dependencyManagement>

…….

</dependencyManagement>

 

<distributionManagement> 

.…..

</distributionManagement> 

 

</project>

 

3. itts-common/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>

 

  <parent>

    <groupId>com.itrace.itts</groupId>

    <artifactId>itts-parent</artifactId>

    <version>1.0.0-SNAPSHOT</version>

    <relativePath>pom.xml</relativePath>

  <parent>

 

  <artifactId>itts-common</artifactId>

  <packaging>jar</packaging>

  <name>ITTS Platform Common Module</name>

 

  <dependencies>

  ……….

  </dependencies>

 

</project>

 


用apache-maven-3.1.1 编译工程报错.doc

malf...@gmail.com

unread,
Dec 9, 2013, 8:39:36 PM12/9/13
to mave...@googlegroups.com
帖子中图片显示不出来,请大家看附件文档对问题的描述,谢谢。

在 2013年12月10日星期二UTC+8上午1时29分19秒,malf...@gmail.com写道:

刘勇坡

unread,
Dec 10, 2013, 10:17:18 PM12/10/13
to mave...@googlegroups.com
子工程中parent标签中的relativePath应该是../pom.xml,而不是pom.xml。

另外,根据你的描述,我想说的是itts-parent已经完全没有意义了,那为何不把他和itts-platform合并呢?


--
您收到此邮件是因为您订阅了 Google 网上论坛的“Maven中文”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到 maven-zh+u...@googlegroups.com
要向此网上论坛发帖,请发送电子邮件至 mave...@googlegroups.com
通过以下网址访问此论坛:http://groups.google.com/group/maven-zh。
要查看更多选项,请访问 https://groups.google.com/groups/opt_out。

第二少

unread,
Dec 11, 2013, 10:06:20 AM12/11/13
to mave...@googlegroups.com
itts-common的pom.xml

<parent>

 <groupId>com.itrace.itts</groupId>

 <artifactId>itts-parent</artifactId>

 <version>1.0.0-SNAPSHOT</version>

 <relativePath>../pom.xml</relativePath> <!-- 如果放在tts-parent目录下, 那么就是 ../tts-parent/pom.xml -->
</parent> <!-- 这里少了个"/"啊!! -->

另外, 如果你想通过GAV解析parent pom(而不是通过relativePath的话), 需要在itts-common的pom.xml里显式定义至少一个<repository>, 否则即便你在settings.xml里设置了mirror, 并且设置了mirrorOf=*, 也是不会起作用的(maven的bug? 还是故意这样设计?)
--
Best regards and wishes.

Follow me(@dearshor) on Twitter http://twitter.com/dearshor or weibo.com/dearshor

Dearshor(第二少) | Software Developer | Wuxi China
Reply all
Reply to author
Forward
0 new messages