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

Bug 353781

Summary: m2eclipse fails when maven-compiler-plugin targets "5", "6", or "7"
Product: z_Archived Reporter: Tim O'Brien <tobrien>
Component: m2eAssignee: Project Inbox <m2e.core-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: anders.g.hammar, igor, matthew_sandoz
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Patch for ./src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
none
Patch for m2e-core, small change to AbstractJavaProjectConfigurator
igor: iplog+
Patch for m2e-core-tests none

Description Tim O'Brien CLA 2011-08-03 11:06:53 EDT
The Java compiler's documentation states that -source and -target accept the following values:

"5" as a synonym for "1.5", "6" as a synonym for "1.6", and (assumption) "7" as a synonym for "1.7".

In the current release of m2eclipse, if your pom.xml contains the configuration:

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

m2eclipse will ignore this setting and use a different source and target level.   This will lead to inconsistent results from the same build run via the command-line vs. m2eclipse.   

I've attached a patch for ./src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java which adds the synonyms to SOURCES and TARGETS and which adds some logic to catch the synonyms for source and taget.
Comment 1 Tim O'Brien CLA 2011-08-03 11:07:25 EDT
Created attachment 200821 [details]
Patch for ./src/org/eclipse/m2e/jdt/internal/AbstractJavaProjectConfigurator.java
Comment 2 Igor Fedorenko CLA 2011-08-03 11:24:04 EDT
*** Bug 350353 has been marked as a duplicate of this bug. ***
Comment 3 Tim O'Brien CLA 2011-08-03 15:10:42 EDT
Created attachment 200847 [details]
Patch for m2e-core, small change to AbstractJavaProjectConfigurator
Comment 4 Tim O'Brien CLA 2011-08-03 15:11:16 EDT
Created attachment 200848 [details]
Patch for m2e-core-tests
Comment 5 Igor Fedorenko CLA 2011-08-03 21:57:49 EDT
Applied the patches. Thank you.
Comment 6 Igor Fedorenko CLA 2011-09-12 07:26:38 EDT
*** Bug 357364 has been marked as a duplicate of this bug. ***
Comment 7 Denis Roy CLA 2021-04-19 13:26:35 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/