在我的項目,模塊C具有己父A.運行Maven潔淨的插件不清洗默認目標目錄
父父B A POM
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
父乙POM
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-extra-files</id>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<filesets>
<fileset>
<directory>C:\foo\bar</directory>
<includes>
<include>foo*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
模塊C POM
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-extra-files</id>
<phase>pre-integration-test</phase>
</execution>
</executions>
</plugin>
當我運行mvn clean pre-integration-test
[INFO] --- maven-clean-plugin:3.0.0:clean (clean-extra-files) @ foo-c ---
[INFO] Deleting C:\dev\workspace\foo-a\foo-b\foo-c\target
[INFO] Deleting C:\foo\bar (includes = [foo*.jar], excludes = [])
兩個默認的目標目錄,我的其他目錄中清洗。但是,我只希望清理附加目錄。
如何防止clean-extra-files
清除默認目標目錄?
如果這是不可能的,還有什麼其他選項用於清理不需要的文件?
ENV:Java的:6時,Eclipse:月神,Maven的:3.2
這隻在我在文件集中定義的目錄上排除。目標目錄上的默認清除仍然會觸發。 –