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

Test resources are copied into production WAR file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.2.0
    • None
    • copy
    • None

    Description

      When specifying an outputDirectory for the Maven Resources plugin, as shown below we are seeing some weird behavior in the plug-in.

      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <configuration>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
          </configuration>
      </plugin> 

      When running a build with mvn clean install, we notice that our test resources from src/test/resources end up in the final WAR file that is created. It seems strange to us that test resource files would end up in a WAR file that will later on be deployed to production.

      Commenting out the outputDirectory in the above example, resolves the issue and the test resources end up in the correct place again.

      Why does setting outputDirectory to the same its default value explicitly cause this behavior? (see https://maven.apache.org/plugins/maven-resources-plugin/resources-mojo.html) Is this a bug?

      Attachments

        Activity

          People

            Unassigned Unassigned
            drieselliott@gmail.com Dries Elliott
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: