【问题标题】:Maven Doesnot Overwrite files in target folderMaven 不会覆盖目标文件夹中的文件
【发布时间】:2021-08-20 21:06:12
【问题描述】:

我正在使用 maven 进行构建,从 artifactory 下载战争,并在 src/main/webapp/WEB-INF/ 文件夹中自定义了一个文件,但在 target//WEB_INF/ 中,该文件没有被自定义文件覆盖最后的战争。 我在 Maven 资源插件中使用了 true。 例如:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                    <id>copy-app</id>
                    <!-- <phase>process-resources</phase> -->
                    <phase>validate</phase>
                    <goals>
                        <goal>copy-resources</goal>
                    </goals>
                    <configuration>
                      <overwrite>true</overwrite>
                      <outputDirectory>${project.artifactId}-${project.version}/WEB-INF</outputDirectory>
                        <resources>
                            <resource>
                                <directory>src/main/webapp/WEB_INF</directory>
                                <includes>
                                <include>app.xml</include></includes>
                                <filtering>true</filtering>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

【问题讨论】:

标签: java maven pom.xml


【解决方案1】:

首先运行 mvn clean 将删除目标,然后运行 ​​mvn install 应该会创建具有最新更改的工件。

如果mvn clean 没有删除目标文件夹,请检查是否存在访问问题

【讨论】:

  • 我正在使用命令作为 - clean install -X,但仍然没有覆盖
猜你喜欢
  • 2019-07-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-11-09
  • 2013-11-27
  • 2016-08-30
  • 2022-01-04
  • 1970-01-01
相关资源
最近更新 更多