gpt4 book ai didi

java - 无法将 pom.xml 中的打包作为 war 添加到 eclipse 中的 Maven 项目中

转载 作者:行者123 更新时间:2023-12-01 19:40:10 27 4
gpt4 key购买 nike

我是 Maven 新手。我一直在 eclipse 中使用 pom.xml 开发一个 Maven 项目,如下所示:

 <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.walmart.move.nim.damage</groupId>
<artifactId>damages-external-services-parent</artifactId>
<version>1.0.36-SNAPSHOT</version>
<packaging>war</packaging> #### THIS LINE IS GIVING ERROR
</parent>
<artifactId>damages-external-services</artifactId>
<name>damages-external-services</name>
<description>Damages external services. This is the war.</description>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
<springframework.version>4.3.4.RELEASE</springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.javadoc.skip>true</maven.javadoc.skip>

</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>7.0.62</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.walmart.move.nim.damage</groupId>
<artifactId>damages-utils</artifactId>
<version>1.0.2214</version>
<!-- <version>1.0.4-SNAPSHOT</version> -->
</dependency>
</dependencies>

由于上述打包行,在 eclipse 中执行 mvn clean install 时,出现以下错误:

[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[ERROR] Malformed POM /Users/a0m0466/workspace/damage.damages-orchestrator.dc-external-services/damages-external-services/pom.xml: Unrecognised tag: 'packaging' (position: START_TAG seen ...</version>\n <packaging>... @7:16) @ /Users/a0m0466/workspace/damage.damages-orchestrator.dc-external-services/damages-external-services/pom.xml, line 7, column 16
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.walmart.move.nim.damage:damages-external-services:1.0.36-SNAPSHOT (/Users/a0m0466/workspace/damage.damages-orchestrator.dc-external-services/damages-external-services/pom.xml) has 1 error
[ERROR] Malformed POM /Users/a0m0466/workspace/damage.damages-orchestrator.dc-external-services/damages-external-services/pom.xml: Unrecognised tag: 'packaging' (position: START_TAG seen ...</version>\n <packaging>... @7:16) @ /Users/a0m0466/workspace/damage.damages-orchestrator.dc-external-services/damages-external-services/pom.xml, line 7, column 16 -> [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.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/ModelParseException

最佳答案

包装<packaging>标签应该在 </parent> 之外标签。

</parent>
<packaging>war</packaging>

关于java - 无法将 pom.xml 中的打包作为 war 添加到 eclipse 中的 Maven 项目中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55604709/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com