Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 359390

Summary: Add a validation exclude groups for target folder
Product: [Technology] M2E-WTP Reporter: Axel H. <noirbizarre>
Component: CoreAssignee: Project Inbox <m2e-wtp.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: c.luick, fbricon, igor, manderse, snjezana.peco
Version: unspecified   
Target Milestone: Kepler M7   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Test project none

Description Axel H. CLA 2011-09-29 05:58:02 EDT
By default Eclipse try to validate the target folder content.
It shouldn't because it raises a lots of errors.
Comment 1 Igor Fedorenko CLA 2011-09-29 07:22:10 EDT
This does not provide enough information for us to be able to troubleshoot the problem. Feel free to reopen, but make sure to attach complete standalone sample project and exact steps to reproduce the problem, i.e. detailed description of desired/expected compared to observed behaviour. 

Since m2e does not validate anything by itself, I suspect that some additional eclipse plugins are involved here. To be able to identify these plugins please also attach eclipse configuration details (about_eclipse_sdk->installation_details->configuration).
Comment 2 Christof Luick CLA 2012-09-27 05:45:19 EDT
The problem isn't only that it raises strange errors (i.e. the tag handler validator produces strange errors when validating ".tagx" files in the target folder, but this is a bug in the validator). It takes a notable amount of build time depending on how many files are present in the target folder and depending on the type of these files. In my workspace, where I make heavy use of the war-plugin with overlays, the validation of files in the target folder at least doubles the build time.

Worst-Case-Example:
Given you have a maven project of type "war". When you run a "clean package", maven creates a folder named like the artifact inside the target folder and copies all webapp files from the eclipse project into it (if you have a big webapp, the validation of this folder can also take a notable amount of time). Guessing you additionally use the war-plugin to apply overlays to your webapp, the overlays will be extracted by the war plugin into a folder named "target/war/work". If you export the project to a tomcat-server (WTP) to debug the web application, the m2e-wtp-extension will also extract the overlays into a folder named "target/m2e-wtp/overlays". When you now select "Project > clean" in the eclipse menu, all the files in the target dir will be validated.

To speed up the build, you can add a exclude-rule for folder "target" to the validator rules. Unfortunately, eclipse juno doesn't allow to specify global exclude-rules so you have to create an exclude-rule for each validator related to webapps. When you create an exclude-rule for a validator, you have to select a specific folder from the workspace. Fortunately, "target" folders are excluded generally from the validation even if you select a "target" folder from a specific project.

To reproduce the problem: 
- Take the attachment "WarProjectWithBigOverlay.zip". Extract it, import it into the workspace. 
- Update the maven dependencies and execute a "clean package".
- Add the web-project to an tomcat server (WTP) and publish it.
- Ensure that the overlays are extracted into "target/war/work" and "target/m2e-wtp/overlays". 
- Now clean the project and keep an eye to the status bar (Validating...).

To compare the build time with a build where the validation is disabled, enable the option "Suspend all validators" in the project specific validator settings.
Comment 3 Christof Luick CLA 2012-09-27 05:46:14 EDT
Created attachment 221559 [details]
Test project
Comment 4 Christof Luick CLA 2012-09-27 05:47:19 EDT
Could you please review this bug ?!
I added an detailed description an a test project to reproduce the problem.
Comment 5 Igor Fedorenko CLA 2012-09-27 06:59:27 EDT
broken/inefficient validators is one of many reasons I stay away from wtp, but maybe somebody from m2e/wtp team can suggest a way to make it work less bad for you.
Comment 6 Fred Bricon CLA 2012-10-21 05:02:40 EDT
I've been thinking at either 
- excluding the target folder from all validators on m2e-wtp startup. But I'm afraid it might cause deadlocks on startup
- adding a button in m2e-wtp preferences that would do the exclusions.
- maybe popping a warning message up, urging users to trigger the aforementioned exclusion thing, on workspace startup.
Comment 7 Fred Bricon CLA 2013-05-06 18:29:20 EDT
Fixed in http://git.eclipse.org/c/m2e-wtp/org.eclipse.m2e.wtp.git/commit/?id=b259cf15f70166646170bb3e2ec5246c58c44abb

The WTP configurators now disable the validators on the build output folder. It's *very* effective on WarProjectWithBigOverlay :-)