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

Bug 356616

Summary: [xtext][validation] Don't create error markers in output folders
Product: [Modeling] TMF Reporter: Aaron Digulla <digulla>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: karsten.thoms, sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Screenshot: Error markers in target/classes none

Description Aaron Digulla CLA 2011-09-02 11:39:53 EDT
Please don't validate resource which are in folders that are marked as "Derived".

Alternatively (since the "Derived" flag easily gets lost), allow to define a set of folder per project (save that in the .settings folder in the project) which should not be validated.

Background: Tools like Maven or Ant copy the resources during build and validating those files is a) a waste of time and b) can potentially create duplicate error messages which annoy the user.
Comment 1 Sebastian Zarnekow CLA 2011-09-13 12:02:22 EDT
Fixed by excluding folders that are marked as output folders of java projects.

Please note that the derived flag does not seem to be a good indicator for marker creation, e.g. the JDT will produce error markers for derived java files, too.
Comment 2 Aaron Digulla CLA 2011-09-13 13:16:11 EDT
That only solves half of my issue because if have two sets of output folders (one is under control of Eclipse and the other is created by Maven).

With your fix, I still get errors in the Maven folders.
Comment 3 Sebastian Zarnekow CLA 2011-09-13 13:33:34 EDT
I'm afraid you have to keep your Eclipse project configuration in sync with your maven settings. Isn't that a good idea anyway?

One alternative that comes to my mind would be to have a concept of source folders for each Xtext language which doesn't sound too convenient to me and is not an option. 

Do you have another idea?
Comment 4 Aaron Digulla CLA 2011-09-13 14:42:10 EDT
The setup is normal if you need to run Maven from the command line as well as from within Eclipse. In that case, you need to tell Maven from the command line to compile into a different folder than Eclipse because otherwise, Eclipse gets really confused.

So I have a POM which sets the target folder based on two profiles.

In the project properties, there is an entry for "Validation" where you can fine-tune validation for XML, DTDs, etc. But that dialog is so hidden that most users never found it and b) it's so horrible that those who did wish they didn't.

But maybe you can add your validation there and allow me to add "ignore folders patterns" for Xtext.
Comment 5 Karsten Thoms CLA 2011-09-14 07:44:01 EDT
Created attachment 203331 [details]
Screenshot: Error markers in target/classes

(In reply to comment #3)
> I'm afraid you have to keep your Eclipse project configuration in sync with
> your maven settings. Isn't that a good idea anyway?
Depends. If you use Maven "classic" the sources are usually compiled with javac. Tycho uses JDT.

When using Tycho, this seems OK for me. The classes are compiled to target/classes, which is also configured as output folder. Then your fix would work. (I'm getting the same annoying validation messages so far, see screenshot)
Comment 6 Sebastian Zarnekow CLA 2011-09-14 08:08:20 EDT
Karsten,

which Xtext build do you have installed?
Did you mark target as default project output folder and target/classes as output folder for your source path's?
Comment 7 Karsten Thoms CLA 2011-09-14 10:10:30 EDT
(In reply to comment #6)
> which Xtext build do you have installed?
2.0.1.v201109090504

> Did you mark target as default project output folder and target/classes as
> output folder for your source path's?
Oh, it was still /bin! My fault, thought that Maven had configured that to target/classes.
Comment 8 Sebastian Zarnekow CLA 2011-09-14 10:18:40 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > which Xtext build do you have installed?
> 2.0.1.v201109090504
> 
> > Did you mark target as default project output folder and target/classes as
> > output folder for your source path's?
> Oh, it was still /bin! My fault, thought that Maven had configured that to
> target/classes.

Could you please double check if the latest changes in the master branch fix the error marker-issue for you if after you fixed your project setup?
Comment 9 Karsten Thoms CLA 2017-09-19 17:20:47 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 10 Karsten Thoms CLA 2017-09-19 17:32:06 EDT
Closing all bugs that were set to RESOLVED before Neon.0