Uploaded image for project: 'Maven Resources Plugin'
  1. Maven Resources Plugin
  2. MRESOURCES-260

copy-resources goal copies directories, but not files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 3.1.0
    • None
    • copy
    • None
    • Important

    Description

      Background

      the sample application source code can be found here:
      https://gitlab.com/openease/java-microservice-example

      this is a peculiar bug that is confusing me because the functionality works sometimes, but not always

      my machine:

      $ mvn -v
      Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
      Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
      Java version: 11.0.7, vendor: Amazon.com Inc., runtime: /Library/Java/JavaVirtualMachines/amazon-corretto-11.jdk/Contents/Home
      Default locale: en_CA, platform encoding: UTF-8
      OS name: "mac os x", version: "10.14.6", arch: "x86_64", family: "mac"
      

      The project, mentioned above, is a multi-module project that does a lot of things. One of the modules builds a Spring Boot WAR bundled together with a NPM application:
      https://gitlab.com/openease/java-microservice-example/-/blob/master/service/www/pom.xml
      the contents of the NPM build output is copied into the WAR package with the following execution:

      <execution>
        <id>copy-javascript-build-output-to-webapp</id>
        <phase>prepare-package</phase>
        <goals>
          <goal>copy-resources</goal>
        </goals>
        <configuration>
          <resources>
            <resource>
              <directory>${project.build.directory}/javascript/build</directory>
              <filtering>false</filtering>
              <includes>
                <include>**/*.css*</include>
                <include>**/*.htm*</include>
                <include>**/*.js*</include>
                <include>**/*.png*</include>
                <include>**/*.svg*</include>
                <include>**/*.txt*</include>
              </includes>
            </resource>
          </resources>
          <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes/public</outputDirectory>
        </configuration>
      </execution>
      

      Problem

      This execution works fine when you run:

      $ cd service/www/
      $ mvn clean prepare-package
      

      it copies over all of the NPM build output contents (directories and files)

      but this execution fails when you run:

      $ cd service/www/
      $ mvn clean install
      

      it copies over only the directory structure, but no files:

      target/
        java-microservice-example-service-www-1.0.0-SNAPSHOT/
          WEB-INF/
            classes/
              public/ (no files)
                static/
                  css/ (no files)
                  js/ (no files)
                  media/ (no files)
      

      I believe the other executions defined in the pom.xml don't seem to have a problem, just this one ...

      Attachments

        Issue Links

          Activity

            People

              hboutemy Herve Boutemy
              alan-czajkowski Alan Czajkowski
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: