maven 重复查找器插件看起来是一种检测相同资源何时存在于多个模块中的好方法。我需要的是更简单的东西:在同一个模块中检测相同的资源。
(更新:针对 maven 重复查找器插件提交了一个问题,以查看它是否可以检测到这种情况。)
这是 Maven 重复查找器插件无法检测到我关心的那种情况的演示:
$ cat 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.stackoverflow.mattmchenry</groupId>
<artifactId>mvn-dups</artifactId>
<version>1.0</version>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/resources_es</directory>
</resource>
</resources>
</build>
</project>
$ find src/ -type f
src/main/resources/Strings_es.properties
src/main/resources/Strings.properties
src/main/resources_es/Strings_es.properties
$ mvn com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.2:check[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.stackoverflow.mattmchenry:mvn-dups:jar:1.0
[INFO] task-segment: [com.ning.maven.plugins:maven-duplicate-finder-plugin:1.0.2:check]
[INFO] ------------------------------------------------------------------------
[INFO] [duplicate-finder:check {execution: default-cli}]
[INFO] Checking compile classpath
[INFO] Checking runtime classpath
[INFO] Checking test classpath
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Nov 22 22:44:40 EST 2012
[INFO] Final Memory: 7M/88M
[INFO] ------------------------------------------------------------------------