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

Usage of copy-resources changes testResources copying behaviour

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.4.2, 2.5
    • None
    • copy
    • None

    Description

      Create a dummy project, add foo.txt to src/test/resources
      do a "mvn clean package"
      foo.txt appears in target/test-classes/foo.txt and is not in packaged jar (as supposed)

      Add build step to copy some additonal files to classpath/jar and again do a "mvn clean package"

          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-resources-plugin</artifactId>
                      <version>2.5</version>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>copy-resources</goal>
                              </goals>
                              <phase>process-resources</phase>
                          </execution>
                      </executions>
                      <configuration>
                          <resources>
                              <resource>
                                  <directory>src/main/additional</directory>
                              </resource>
                          </resources>
                          <outputDirectory>${project.build.outputDirectory}</outputDirectory>
                      </configuration>
                  </plugin>
              </plugins>
      

      now what happens:
      the files in "additional" are copied to target/classes (as supposed) but the foo.txt AS WELL (not supposed)
      target/test-classes is now empty and all the test resources are packaged into jar
      So specifying the copy-resource goal results in an reconfiguration of the test-resources copy operation?!

      [DEBUG] copy C:\Users\myron\workspace\test\src\test\resources\foo.txt to C:\Users\myron\workspace\test\target\classes\foo.txt
      complete debug attached

      Attachments

        1. resources-debug.txt
          71 kB
          Myron

        Activity

          People

            Unassigned Unassigned
            myron Myron
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: