Question

After starting Eclipse, Mven seems to set the compiler settings to 1.5 and forget all the other global code style settings to ensure a higher code quality.

Is there some way to disable this feature? Or can I specify all compiler and code style checks in my POM?

It is very annoying because Ecplise can't run the app because of not allowed override annotations for interfaces. The tick in Java compiler -> Enable project specific settings is always set after a restart.

Was it helpful?

Solution

You can set the compiler source and target (byte-code) versions in your pom.
See http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html

Code style checks can be configured in the pom as part of the maven reports, see http://maven.apache.org/plugins/maven-checkstyle-plugin/
but I'm not sure whether the integration will pick these up.

OTHER TIPS

The simplest way is to add to your POM

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
 <source>1.6</source>
 <target>1.6</target>
</configuration>

See default maven compiler setting for another solutions.

If you don't want the m2e eclipse plugin actively messing with your project settings, use the maven-eclipse-plugin's eclipse goal to generate your eclipse settings.

It'll generate your eclipse settings based off of what you have in your pom, so you'll still need to set the maven compiler settings in your pom if you don't want to set them every time you regenerate your eclipse project files when you update your pom.

If you take a look at the detailed configuration for that plugin, there are instructions for how to generate various pieces of eclipse metadata.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top