【发布时间】:2017-02-12 20:58:34
【问题描述】:
在我的项目中,模块 C 的父 B 有父 A。
父A pom
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
父母B 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清理默认目标目录?
如果不可能,还有哪些其他选项可以清理不需要的文件?
环境:Java:6,Eclipse:Luna,Maven:3.2
【问题讨论】:
标签: java eclipse apache maven maven-3