Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] M2e configure WTP to publish one or more files from test-classes or src/test/resources?

Yes there's a pretty straightforward way to enable that behavior, which doesn't even require IDE specific settings : Use a combination of maven profiles and the maven-war-plugin webresources settings.

Simply configure a profile like :
<profile>
  <id>dev</id>
  <activation>
    <property> <!-- this will automatically be enabled when using m2e -->
      <name>m2e.version</name>
    </property>
  </activation>
  <build>
    <plugins>
      ...
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <!-- this will inherit existing maven-war-plugin configuration-->
        <configuration>
          <webResources>
            <resource>
              <directory>${project.build.testOutputDirectory}</directory>
              <includes>
                <include>**/some/test/resources/**</include>
              </includes>
              <targetPath>WEB-INF/classes/</targetPath>
            </resource>
          </webResources>
        </configuration>
      </plugin>
    </plugins>
  </build>
This dev profile will automatically be enabled when running with m2e (via the m2e.version property), but you can also use other activation triggers if needed. 

The selected test resources will be copied to target/m2e-wtp/web-resources/WEB-INF/classes, when using m2e-wtp, or the default war directory when using CLI or other IDEs, when the dev profile is enabled.

Now if you already defined webResources in your main maven-war-plugin configuration, you should use <webResources combine.children="append"> in the dev profile, so the test webResources are added to your original webresources. 

HIH

Fred


On Sun, Dec 7, 2014 at 12:39 PM, Jeff Jensen <jjensen@xxxxxxxxxx> wrote:
Since we use m2e to configure the Eclipse modules, I'm wondering if there is a configuration that will allow m2e/wtp to publish one or more files from test-classes or src/test/resources?

Specifically, I'm interested in having src/test/resources/logback-test.xml published, activating the testing configuration instead of the production one.

I'm trying to avoid temporary manual edits, such as locally changing logback.xml and manually adjusting the "Web Deployment Assembly" Eclipse config.

If there is not a configuration that does so, has anyone else solved this in a non-manual edits manner?


_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users



--
"Have you tried turning it off and on again" - The IT Crowd

Back to the top