【问题标题】:maven-resources-plugin overwrite output directory not workingmaven-resources-plugin 覆盖输出目录不起作用
【发布时间】:2021-06-06 19:26:43
【问题描述】:

我有一个 Spring Boot 应用程序,它也提供 vue 静态文件。在 pom.xml 中,我使用 maven-resources-plugin 将静态文件复制到资源文件夹。它第一次按预期工作,但由于某种原因,当我更改 vue 项目的文件并再次构建项目时,即使我使用<overwrite>true</overwrite>,它也不会覆盖输出目录。当我删除输出目录手册并再次构建时 - 它工作正常。

我的 pom.xml:

<plugin>
  <artifactId>maven-resources-plugin</artifactId>
  <executions> 
    <execution>
      <id> Copy vue resources </id>
      <phase> generate-resources </phase>
      <goals>
        <goal> copy-resources </goal>
      </goals>
      <configuration>
        <overwrite> true </overwrite>
        <outputDirectory> src/main/resources/public </outputDirecroty>
        <resources>
          <resource>
            <directory> ${project.basedir}/../c4i-vue/target/dist </directory>
            <includes>
              <include>static/</include>
              <include>index.html</include>
            </includes>
          </resource>
        </resources>
      </configuration>
    </execution>

  </executions>
</plugin>

我也尝试将&lt;overwrite&gt;true&lt;/overwrite&gt; 放在外部配置中,但效果不佳:

<plugin>
  <artifactId>maven-resources-plugin</artifactId>
  <configuration>
    <overwrite> true </overwrite>
  </configuration>
  <executions> 
    <execution>
      <id> Copy vue resources </id>
      <phase> generate-resources </phase>
      <goals>
        <goal> copy-resources </goal>
      </goals>
      <configuration>
        <outputDirectory> src/main/resources/public </outputDirecroty>
        <resources>
          <resource>
            <directory> ${project.basedir}/../c4i-vue/target/dist </directory>
            <includes>
              <include>static/</include>
              <include>index.html</include>
            </includes>
          </resource>
        </resources>
      </configuration>
    </execution>

  </executions>
</plugin>

我很想得到一些帮助,谢谢!

【问题讨论】:

    标签: java spring-boot maven


    【解决方案1】:

    它应该工作正常.. 也许文件已更新,但文件夹仍有最后更新日期?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-25
      • 2016-02-13
      • 1970-01-01
      • 2018-02-18
      • 2013-09-05
      • 2021-03-31
      相关资源
      最近更新 更多