【问题标题】:Validating Maven pom.xml when boolean is a property当布尔值是属性时验证 Maven pom.xml
【发布时间】:2023-03-03 07:09:24
【问题描述】:

如果我有一个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</groupId>
    <artifactId>test-project</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <properties>
        <resource.filtering>true</resource.filtering>
    </properties>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>${resource.filtering}</filtering>
                <includes>
                    <include>environment.properties</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

Eclipse 用验证错误标记&lt;filtering&gt;${resource.filtering}&lt;/filtering&gt; 行,因为架构告诉它这应该是boolean,而它看起来不像boolean。我宁愿不关闭pom.xml 验证,而且看到项目上的错误很烦人。我的目标是能够控制是否基于 Maven 配置文件进行资源过滤。有没有一种方法可以通过 Eclipse 的验证?我正在使用 Eclipse Luna (4.4)。

【问题讨论】:

    标签: java xml eclipse maven


    【解决方案1】:

    我问了similar question,甚至尝试提交bug report with the Eclipse team。我得到的答案是,“这是描述 pom 格式的 xsd 与 pom 文件的目的之间固有冲突的结果。”因此,除了关闭验证之外,对这些错误消息无能为力。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-09-18
      • 1970-01-01
      • 2015-08-02
      • 2011-05-07
      • 2016-03-13
      • 2014-06-05
      • 2020-09-19
      • 1970-01-01
      相关资源
      最近更新 更多