Eclipse:过滤资源时出错

Posted

技术标签:

【中文标题】Eclipse:过滤资源时出错【英文标题】:Eclipse : An error occurred while filtering resources 【发布时间】:2013-08-11 07:57:35 【问题描述】:

我正在构建一个 Spring MVC 项目,而 Eclipse 抛出了这个错误(见截图)。我的 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.bilitutor.cct</groupId>
    <artifactId>BiliTutor</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <spring.version>3.1.1.RELEASE</spring.version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>

    <dependencies>

        <!-- Spring framework -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>$spring.version</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>$spring.version</version>
        </dependency>
        <!-- Used for Hibernate4 LocalSessionFactoryBean -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>$spring.version</version>
        </dependency>

        <!-- This provides the Servlet API for building but excludes from deployment -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <!-- AOP dependency -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>2.2.2</version>
        </dependency>

        <!-- Persistence Management -->
        <!-- Apache BasicDataSource -->
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.2.2</version>
        </dependency>

        <!-- mysql database driver -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.20</version>
        </dependency>

        <!-- Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.1.3.Final</version>
        </dependency>

        <!-- Hibernate validator -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>1.1.0.Final</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
        </dependency>

        <!-- JSTL -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Logging -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.0.4</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>$org.slf4j-version</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>$org.slf4j-version</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>$org.slf4j-version</version>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
            <exclusions>
                <exclusion>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.jms</groupId>
                    <artifactId>jms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jdmk</groupId>
                    <artifactId>jmxtools</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.jmx</groupId>
                    <artifactId>jmxri</artifactId>
                </exclusion>
            </exclusions>
            <scope>runtime</scope>
        </dependency>

    </dependencies>
</project>

【问题讨论】:

【参考方案1】:

Maven -> 更新项目...为我解决了这个问题

【讨论】:

嗯,这也解决了我的问题。有人知道为什么会这样吗?总是假设 Eclipse 在您修改 pom.xml 时自动更新? 这个链接有更多信息(在 Maven 项目中,pom 带头而不是 eclipse)***.com/questions/20546962/… 仍然不明白为什么会发生错误,但已通过默认设置的 maven-update 项目解决 也解决了我的问题。但没搞明白这里有什么问题。 也为我工作。就我而言,它是由于“dependency.version 缺失”导致的“无效 POM”而发生的。没有多大意义……

以上是关于Eclipse:过滤资源时出错的主要内容,如果未能解决你的问题,请参考以下文章

过滤器的使用eclipse

更新 Eclipse 更新时出错

Eclipse C/C++ CDT 烦人的问题

eclipse javadoc出错

在 Eclipse 中配置 GCC 编译器时出错

Eclipse启动出错