当boolean属性属性时验证Maven pom.xml [英] Validating Maven pom.xml when boolean is a property

查看:143
本文介绍了当boolean属性属性时验证Maven pom.xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我有一个 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标记< filtering> $ {resource.filtering} / filter> 行与验证错误,因为模式告诉它应该是一个布尔值,并且看起来不像code>布尔。我不想关闭 pom.xml 验证,并且很烦的看到项目的错误。我的目标是能够控制是否基于Maven配置文件进行资源过滤。有没有办法通过Eclipse的验证?我正在使用Eclipse Luna(4.4)。

Eclipse marks the <filtering>${resource.filtering}</filtering> line with a validation error, because the schema tells it this should be a boolean, and that doesn't look like a boolean. I would rather not shut off the pom.xml validation, and it's annoying to see the error on the project. My goal is to be able to control whether resource filtering occurs based on Maven profiles. Is there a way of doing this that passes Eclipse's validation? I'm using Eclipse Luna (4.4).

推荐答案

我问了一个类似的问题,甚至尝试归档 Eclipse团队的错误报告。我得到的答案是这是描述pom格式的xsd和pom文件的目标之间固有的冲突的结果。所以除了关闭验证之外,这些错误消息还没有太多的人可以做。

I asked a similar question, and even tried filing a bug report with the Eclipse team. The answer I got was, "This is a result of an inherent conflict between the xsd that describes the pom format, and the aims of the pom file." So other than turning off validation, there isn't much one can do about these error messages.

这篇关于当boolean属性属性时验证Maven pom.xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆