Gabe Johnson
Gabe Johnson

Reputation: 1431

Can Eclipse be configured to disable warnings for derived source files?

I am using ANTLR to generate Java source files. I can make Eclipse understand the generated files are derived, but it still gives me warnings about harmless things (e.g. unnecessary imports and so on). I would like to configure Eclipse to ignore derived files when showing warnings. Is this possible?

Upvotes: 9

Views: 4459

Answers (3)

Luke Usherwood
Luke Usherwood

Reputation: 3141

Here's a more recent answer. Since Eclipse 3.8 we can ignore warnings on specific source folders.

Upvotes: 1

Carl Smotricz
Carl Smotricz

Reputation: 67780

I'm afraid that what you see (in the Preferences) is what you get.

However, if you're going to have ANTLR producing code for you anyway, why not go one step further and have your build script (ant, Maven, ...) wrap that code into a Jar for you? Set up that Jar file as your dependency in Eclipse and Eclipse won't have to look at the ugly auto-generated code and throw a fit about it.

Upvotes: 7

Andreas Dolk
Andreas Dolk

Reputation: 114797

You could put the derived or autogenerated files into a separate eclipse project and apply special project properties to that 'derived files' project, like to not show Warnings for unused imports.

Different settings in the same project for different packages or source folders are not possible, as far as I know.

Upvotes: 3

Related Questions