在使用maven 时,为了排除不需要的依赖包时忘记写父标签,代码如下:
<dependencies>
<dependency>
<groupId>com.simpledt.inject</groupId>
<artifactId>mes-injection-jdk8</artifactId>
<version>3.0.0</version>
</dependency>
<!-- mes-mould-jdk8 模具部分 -->
<dependency>
<groupId>com.simpledt.mould</groupId>
<artifactId>mes-mould-jdk8</artifactId>
<version>3.0.0</version>
<exclusions>
<exclusion>
<groupId>com.simpledt.base</groupId>
<artifactId>mes-base-jdk8</artifactId>
</exclusion>
</exclusions>
</dependency>
目的是:需要
<groupId>com.simpledt.mould</groupId>
<artifactId>mes-mould-jdk8</artifactId>
<version>3.0.0</version>
的jar 包依赖,但不需要 :
<groupId>com.simpledt.base</groupId>
<artifactId>mes-base-jdk8</artifactId>
所以使用 <exclusion> .... </exclusion> 将不需要依赖的jar包排除在外,当初忘记写 <exclusion> 的 父标签,也就是 <exclusions>,故maven报出以下错误:
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM D:\eclipse-workspace\MES-SQ\pom.xml: Unrecognised tag: 'groupId' (position: START_TAG seen ...<exclusions>\r\n \t<groupId>... @36:23) @ D:\eclipse-workspace\MES-SQ\pom.xml, line 36, column 23
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 94, column 21
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.tomo.mes:mes-sq:1.0.0 (D:\eclipse-workspace\MES-SQ\pom.xml) has 1 error
[ERROR] Malformed POM D:\eclipse-workspace\MES-SQ\pom.xml: Unrecognised tag: 'groupId' (position: START_TAG seen ...<exclusions>\r\n \t<groupId>... @36:23) @ D:\eclipse-workspace\MES-SQ\pom.xml, line 36, column 23 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
加上 <exclusions></exclusions>后顺利打包成功!
特此记一下这个错误,方便日后查阅。