gpt4 book ai didi

java - Eclipse 忽略 failOnMissingWebXml 用户属性

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:42:40 25 4
gpt4 key购买 nike

我使用 Eclipse Mars 和 Maven 3.3.3 创建了一个空的 Web 项目。目前,该项目仅包含 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.example.project</groupId>
<artifactId>web-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>

<build>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<!-- <artifactId>maven-war-plugin</artifactId> -->
<!-- <version>2.6</version> -->
<!-- <configuration> -->
<!-- <failOnMissingWebXml>false</failOnMissingWebXml> -->
<!-- </configuration> -->
<!-- </plugin> -->
</plugins>
</build>
</project>

现在 Eclipse 提示缺少 web.xml 文件。从 maven-war-plugin 的文档中可以set the user property failOnMissingWebXml,所以不需要进一步配置这个插件。这可以从命令行使用 Maven,项目已成功构建。但是 Eclipse 仍然提示缺少 web.xml。

有人知道如何通过使用这个用户属性来消除 Eclipse 中的这个 Maven 配置错误吗?

更新:我有另一个使用 Eclipse Luna SR1 和 Maven 3.2.5 的开发环境,它不会提示新创建的 Web 项目中缺少 web.xml。所以我想知道这个错误是否被 m2e 插件以某种方式抑制了。

最佳答案

http://download.eclipse.org/m2e-wtp/snapshots/mars/ 安装 wtp-m2e 1.2.1为我解决了这个问题。

关于java - Eclipse 忽略 failOnMissingWebXml 用户属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31402864/

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