Thanks for suggestions, Barrie and Wayne! I will have a look at 
maven-eclipse-plugin source code later.

To clarify,
  <source>1.5</source> corresponds to javac "-source" option and to ECJ 
"org.eclipse.jdt.core.compiler.source" setting
  <target>1.6</target> corresponds to javac "-target" option and to ECJ 
"org.eclipse.jdt.core.compiler.codegen.targetPlatform" setting
  org.eclipse.jdt.core.compiler.compliance is an ECJ setting, which doesn't 
have a direct counterpart either in javac options or in maven-compiler-plugin 
settings. I've really tried hard to figure out what exactly it means but 
Eclipse documentation [1] is vague about the meaning of this option. According 
to the JDT settings compatibility table [2], codegen.targetPlatform specifies 
the target VM version, and should never be less then the source version, 
whereas the source version and compliance settings are quite similar, but the 
former seems to be a refinement of the latter. After reading [3], [4] and [5] 
my best guess is that
   - compliance corresponds to Java language version,
   - source corresponds to Java class library version (see -bootclasspath 
option for javac),
   - target corresponds to Java VM version,
   - and Execution Environment setting would correspond to Java runtime version 
(see [6]).

At least, this explanation clarifies why I was able to use Java6 syntax sugar 
(@Override on interface implementation) with compliance set to 1.6, whereas 
source and target were set to 1.5. Still I may be wrong and the only way to get 
an authoritative answer is to ask on the JDT DEV mailing list. I'll ask them 
and hopefully come back later with an answer.

As for Sun's javac, it seems that compliance is always set to the jdk level, 
e.g. "javac -source 1.5 -target 1.5" with javac from jdk6u27 allows using 
@Override annotation on interface implementation.

[1] 
http://help.eclipse.org/juno/topic/org.eclipse.jdt.doc.user/reference/preferences/java/ref-preferences-compiler.htm
[2] Open 
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_api_options.htm
 , scroll down to "JDT Core options descriptions", click on "Builder options" 
and scroll a bit up to see the compatibility table
[3] https://bugs.eclipse.org/bugs/show_bug.cgi?id=323633#c23
[4] 
http://grepcode.com/file/repository.grepcode.com/java/eclipse.org/3.7/org.eclipse.jdt/core/3.7.0/org/eclipse/jdt/internal/compiler/batch/Main.java#Main.validateOptions%28boolean%29
[5] http://wiki.eclipse.org/index.php/Execution_Environment
[6] http://wiki.eclipse.org/PDE/Resources/Execution_Environments

Regards,
Mikhail

----- Original Message -----
From: "Barrie Treloar" <[email protected]>
To: "Maven Users List" <[email protected]>
Sent: Friday, July 27, 2012 12:29:04 AM
Subject: Re: JDT compiler compliance level as a parameter for eclipse:eclipse 
target of maven-eclipse-plugin

On Fri, Jul 27, 2012 at 7:57 AM, Barrie Treloar <[email protected]> wrote:
> On Fri, Jul 27, 2012 at 7:13 AM, Wayne Fay <[email protected]> wrote:
>>> Long story short, I tried to modify eclipse project generation so that
>>> in the .settings/org.eclipse.jdt.core.prefs instead of this:
>>>     org.eclipse.jdt.core.compiler.compliance=1.5
>>> I get this (look at the compliance):
>>>     org.eclipse.jdt.core.compiler.compliance=1.6
>>> but didn't find a way to configure maven-eclipse-plugin.
>>
>> Most likely you are the first person to want this specific
>> configuration of the plugin, thus it does not currently exist. You'll
>> probably need to scratch your own itch.
>>
>> Pull down the source code for maven-eclipse-plugin, tweak it somehow
>> to add this feature, and contribute the code back for (possible)
>> inclusion in a future release.
>>
>> Here's a hint: you're going to want to adjust EclipseSettingsWriter
>> and probably some Eclipse plugin Mojo code too since this should be an
>> extra configuration item in the plugin...
>> http://maven.apache.org/plugins/maven-eclipse-plugin/xref/org/apache/maven/plugin/eclipse/writers/workspace/EclipseSettingsWriter.html
>
> Also remember, that the maven-eclipse-plugin reads the configuration
> of the maven-compiler-plugin.
> See 
> http://maven.apache.org/plugins/maven-eclipse-plugin/trouble-shooting/jdk-being-used-is-different-than-expected.html
>
> So you ideally need to configure that the way you want.
> I'm not sure what
> org.eclipse.jdt.core.compiler.compliance=1.6
> actually does.
> Is this equivalent to
>
> <plugin>
>    <artifactId>maven-compiler-plugin</artifactId>
>    <version>2.0.2</version>
>    <configuration>
>        <source>1.5</source>
>        <target>1.6</target>
>    </configuration>
> </plugin>

Alternatively, you can fix your problem with the overrides and mark it
as something to worry about manually.
The time invested to fix this automatically may not be worth the effort.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to