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?

Oh duh, I know better... yes that was it, in the profile.  Thank you again for your kind help.  This is a very helpful setup!


On Sun, Dec 7, 2014 at 3:45 PM, Fred Bricon <fbricon@xxxxxxxxx> wrote:
If you want to move the profile snippet up to the parent level, you need to move the <plugins> section under a <pluginManagement> node. Works for me.

On Sun, Dec 7, 2014 at 3:15 PM, Jeff Jensen <jjensen@xxxxxxxxxx> wrote:
Thank you Fred!  I did not know about the <webResources> feature.  This is very slick.

I have 8 components of a system, each builds to a war, and want to share this config in their common parent for DRY and when adding new components.  It is not working yet with the config in the parent, only in each module.  Is there something different to do when sharing like that to make it work?

On Sun, Dec 7, 2014 at 12:47 PM, Fred Bricon <fbricon@xxxxxxxxx> wrote:
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

_______________________________________________
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


_______________________________________________
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

_______________________________________________
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


Back to the top