Eclipse + maven:配置文件被忽略

Eclipse + maven : profile ignored

这是我的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.heliosophiclabs</groupId>
<artifactId>artifactId</artifactId>
<version>0.0.1-SNAPSHOT</version>

<profiles>
    <profile>
        <id>local</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
            <serverAddr>localhost</serverAddr>
        </properties>
    </profile>
    <profile>
        <id>prod</id>
        <properties>
            <serverAddr>heliosophiclabs.com</serverAddr>
        </properties>
    </profile>
</profiles>

<build>
    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
    </resources>
</build>

我在 src/main/resources 中有一个 config.properties 文件,它看起来像这样:

serverIp=${serverAddr}

然后我做:

mvn clean resources:resources -Pprod

请注意,这里的配置文件指定为 "prod",然而,无论我如何坚持,在上述命令行之后 config.properties 文件看起来像这样:

serverIp=localhost

而应该是:

serverIp=heliosophiclabs.com

如果我在这个命令行中指定了一个不存在的配置文件,那么 maven 就会给我一个错误,所以它肯定在做一些事情。

请...我在这里做错了什么??

编辑:

根据要求,"mvn -X -Pprod install" 的输出可用 here,因为这里 post 太大了。

这正是我所看到的:

C:\Users\Marc\workspace_mars_2\entourage>mvn -X -Pprod install > mvn.out
C:\Users\Marc\workspace_mars_2\entourage>more target\classes\config.properties
serverAddr=localhost

在entourage-0.0.1-SNAPSHOT.jar中,config.properties在根目录下,内容同上(即localhost)

这不是我瞎编的!

经过多次讨论,最终发现问题出在 "refresh using native hooks or polling" 选项的使用上(首选项 > 常规 > 工作区 > 使用本机挂钩刷新)。取消选中此选项可解决问题。

向 Eclipse 基金会提交错误报告。参见 https://bugs.eclipse.org/bugs/show_bug.cgi?id=462027