Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] wb-resource removed from org.eclipse.wst.common.component

Actually there's a way to deploy test resources in m2e-wtp, using a pom.xml configuration hack :

<profile>
<id>deploy-tests</id>
<!-- This profile is only activated when building in Eclipse with m2e -->
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<webResources>
<resource>
<directory>src/test/resources/</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
<resource>
<directory>${project.build.directory}/test-classes/</directory>
<targetPath>WEB-INF/classes</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>

This deploy-test profile is automatically enabled when run within eclipse, or using with -Pdeploy-tests in command line.
Normally, we should only reference ${project.build.directory}/test-classes/ here but the processed resources are not always picked up as expected, so, explicitely referencing their source folder (not entirely correct if you expect resource filtering) is the most reliable way to get them copied to target/m2e-wtp/web-resources/. I've tested it deploys as expected on Wildfly 8.1


Fred


On Fri, Oct 17, 2014 at 2:44 PM, Fred Bricon <fbricon@xxxxxxxxx> wrote:
Removing test resources from deployment descriptor is expected from m2e-wtp, but I'm pretty sure this behavior predates Luna, as seen with [1].

I'm sorry but, currently, we have no way to allow user-defined resources be preserved in org.eclipse.wst.common.component, across project updates. I have a vague idea for that (using custom attributes/child nodes like pom.derived, similar to what is used in .classpath), but I'm not even sure it's possible to implement against current WTP's APIs. 

So you're options are :
- keep restoring the file contents manually, until someone fixes m2e-wtp/wtp
- contribute a fix to m2e-wtp/wtp. You can find instructions on setting up m2e-wtp development environment and instructions on submitting patches via gerrit at [2]. We can discuss about finding a proper solution on the m2e-wtp-dev list [3]


Fred


On Fri, Oct 17, 2014 at 12:53 PM, Flavio Orfano <forfano@xxxxxxxxxxx> wrote:
Lads,

I am not sure if the issue I am facing is related to m2eclipse or to Eclipse itself. So apologize if I am sending it to wrong place.
After a migration to eclipse-luna we realized that when we do a Maven => Update Project (and set Force update of snapshots/Releases) for a specific project we then end up with the project's org.eclipse.wst.common.component changed in a way that the following tags are removed from it:

 <wb-resource deploy-path="/" source-path="/src/test/java"/>
        <wb-resource deploy-path="/" source-path="/src/test/resources"/>



The original  org.eclipse.wst.common.component contains :

<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="Project_NAME">
        <wb-resource deploy-path="/" source-path="/src/main/java"/>
        <wb-resource deploy-path="/" source-path="/src/main/resources"/>
        <wb-resource deploy-path="/" source-path="/src/test/java"/>
        <wb-resource deploy-path="/" source-path="/src/test/resources"/>
</wb-module>
</project-modules>


Am I missing any extra configuration or could this be a bug? 

PS: It may look strange having src/test/* sdtuff in deploy but that is something that we haven´t change in the pass and it used to work so we leave it as it is. 

Also after the Force update I then re-edit the  org.eclipse.wst.common.component file putting back the removed tags and all worked fine. I mean we need the src/test/* in the deploy so the server starts fine in eclipse. 


I thank you help/comments in advance!


Cheers!


Flavio 



_______________________________________________
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



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

Back to the top