Hi Fred,

What is the expected m2e-wtp behavior when a file of the same name exists
in both src/main/resources and src/test/resources - which of the two files
should exist in tmp0\wtpwebapps\(app-name)\WEB-INF\classes?

What I'm seeing is even when the src/test/resources file is in
target/m2e-wtp/web-resources/WEB-INF/classes, usually the
src/main/resources one is in the deployment
(tmp0\wtpwebapps\(app-name)\WEB-INF\classes) dir.  I have not yet
determined the super-secret sequence that chooses the test one! ;-)


Here are other behaviors I consistently see with this configuration:

1. m2e-wtp isn't copying the configured files with Eclipse build to
target/m2e-wtp/web-resources/WEB-INF/classes after editing and saving.  To
get it to (usually) copy them again, I have to exit Eclipse, mvn clean
install, then launch Eclipse.

2. Sometimes target/m2e-wtp/web-resources/WEB-INF/classes is empty;
sometimes target/m2e-wtp/web-resources/WEB-INF does not exist.  This seems
to only happen with an Eclipse clean build.


I'm wondering if you have any thoughts or advice?


On Sun, Dec 7, 2014 at 12:47 PM, Fred Bricon <[email protected]> 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 <[email protected]> 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
>> [email protected]
>> 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
> [email protected]
> 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
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to