问题描述
这是我的pom.xml:
Here is my 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文件,如下所示:
I have a config.properties file in src/main/resources, which looks like this:
serverIp=${serverAddr}
然后我做
mvn clean resources:resources -Pprod
请注意,此处将配置文件指定为"prod",但是,无论我如何坚持,上述命令行后的config.properties文件看起来都像这样:
Note that the profile is specified here as "prod", and yet, no matter how I insist, the config.properties file looks like this after the above command line:
serverIp=localhost
应为:
serverIp=heliosophiclabs.com
如果我在此命令行中指定了不存在的配置文件,那么maven会给我一个错误,因此肯定是在做某事.
If I specify a non-existent profile in this command line, then maven gives me an error, so it's definitely doing something.
请...我在这里做错什么了吗?
Please... what am I doing wrong here??
根据要求,在此处提供"mvn -X -Pprod install"的输出. ,因为它太大了,无法在此处发布.
As requested, the output of "mvn -X -Pprod install" is available here, since it's far too big to post here.
这正是我所看到的:
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).
In entourage-0.0.1-SNAPSHOT.jar, config.properties is at the root, and its contents are the same as above (i.e., localhost).
我不是要编这些东西!
推荐答案
经过大量讨论,最终发现问题出在使用使用本机钩子或轮询刷新"(首选项>常规>工作区>使用本机钩子刷新).取消选中此选项可以解决问题.
After much discussion, it finally turned out that the issue was with the use of the "refresh using native hooks or polling" option ( preferences > general > workspace > refresh using native hooks ). Unchecking this option resolves the problem.
向Eclipse Foundation提交的错误报告.参见 https://bugs.eclipse.org/bugs/show_bug.cgi?id= 462027
Bug report filed with Eclipse Foundation. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=462027
这篇关于Eclipse + Maven:概要文件被忽略的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!