gpt4 book ai didi

java - Maven:清理 gwt-unitCache 目录

转载 作者:搜寻专家 更新时间:2023-10-31 19:56:23 25 4
gpt4 key购买 nike

我有一个专家问题。

我有一个生成临时目录 gwt-unitCache 文件夹的 GWT 项目。我想在构建过程结束时将其删除。

我有这个插件配置:

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>

这通过删除 src/main 下自动生成的 gwt-unitCache 文件夹来完成它的工作。但是,它也删除了包含类和 war 文件的目标文件夹。

我不想删除目标文件,因此我通过删除以下部分修改了配置:

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
</execution>
</executions>
</plugin>

但是这次不行了。 gwt-unitCache 没有被删除。看起来插件是在构建过程的开始而不是结束时运行的。

我不擅长 Maven。有人可以帮忙吗?我如何配置它以便:

  1. gwt-unitCache 在构建过程结束时被删除。
  2. 目标文件夹未被删除。

我使用命令: maven 全新安装

构建它。

非常感谢。

最佳答案

未测试但maven-clean-plugin公开一个可以帮助完成这项工作的 excludeDefaultDirectories。像这样的东西:

<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<configuration>
<filesets>
<fileset>
<directory>src/main</directory>
<includes>
<directory>gwt-unitCache/**</directory>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
</configuration>
<executions>
<execution>
<id>gwt-unitCache</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>

附带说明一下,我不明白你为什么需要清除这个目录,你不能在你的 SCM 中忽略它吗?

关于java - Maven:清理 gwt-unitCache 目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15452040/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com