facebook

Maven for Myeclipse uses(forces) incorrect JDK/JRE version

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #309851 Reply

    copyrightwitness
    Participant

    Creating projects using ‘Java Maven Project’ or ‘Maven Project’ causes the project to be set to use 1.4 compiler compliance as a project specific setting and the JRE system libraries to be set to J2SE-1.4.

    This is contrary to the setup in the preferences where projects should use Java 1.6 compliance and JDK1.6 libraries. Creating a ‘Java Project’ works correctly.

    Additionally creating a maven project from the command line and adding eclipse to it works correctly:

    mvn archetype:generate -DgroupId=blah -DartifactId=blah -DarchetypeArtifactId=maven-archetype-webapp
    cd blah
    mvn eclipse:eclipse

    [Now import as existing project into eclipse]

    The compile compliance uses workspace settings and the correct system libraries. BUT when turning on ‘Enable Dependency Management’ the project is set to use project specific settings for compiler compliance and these are set to 1.4. Furthermore the system libraries are CHANGED to J2SE-1.4.

    Any ideas?

    #309877 Reply

    Ram
    Member

    copyrightwitness,

    Creating projects using ‘Java Maven Project’ or ‘Maven Project’ causes the project to be set to use 1.4 compiler compliance as a project specific setting and the JRE system libraries to be set to J2SE-1.4.

    Let me clarify that this is already an existing issue in MyEclipse.

    [Now import as existing project into eclipse]

    Are you able to import and execute the project in MyEclipse.

    Can you send what steps you followed with MyEclipse to replicate the issue

    #309882 Reply

    copyrightwitness
    Participant

    File | Import…| Existing project into workspace
    Select the project. Import
    [NOTE: The project is now using JRE System Library [Sun JDK 1.6.0_13] according to the package explorer display and by right clicking the project and choosing properties and going to Java Compiler confirms the project is on workspace defaults (1.6 compliance).
    In the package explorer, select the package. Right click ‘MyEclipse Maven’ | ‘Enable Dependency Mangement’
    Immediately the package explorer changes – the 1.6 JDK is removed and replaced with JRE System Library [J2SE-1.4]. (I only have 1 JDK installed though…so its using compatibility to achieve this). Right click the project – Properties – Java Compiler – the project is now using project specific settings and 1.4 compliance.

    To reverse the effects (to keep deependency management but with teh right compiler / libs).
    Right click the project | java compiler
    Uncheck project specific.
    Under Java Build Path select the J2SE-1.4 libs and remove.
    Then Add Library, JRE System Library , Next, ensure workspace default is selected and Finish.

    Life may now continue 🙂

    #309883 Reply

    copyrightwitness
    Participant

    Oops. To answer your question – after the import the project works fine but shows reference libraries rather than maven dependencies as a folder.

    #309945 Reply

    Ram
    Member

    copyrightwitness,

    Let me clarify that the way you are trying to import maven project is wrong.

    Please follow the below steps:
    ========================
    From command Line:

    1) execute command
    mvn archetype:generate -DgroupId=blah -DartifactId=blah -DarchetypeArtifactId=maven-archetype-webapp
    2) CD to blah
    3) issue the maven command mvn eclipse:myeclipse

    From Myeclipse

    4) Select import
    5) Select Maven4Myeclipse>Existing Maven Projects
    6) Select the above created project in Root directory.
    7) Select the POM file listed in Projects pane.
    8) click Finish
    This will import your Maven based web project with J2EE1.4 Libraries. Now you can change J2EE1.4 to 1.6

    #310184 Reply

    copyrightwitness
    Participant

    Please read the title.

    It has nothing to do with importing. Create a new project gets it wrong and goes against eclipse global workspace settings.

    #310186 Reply

    copyrightwitness
    Participant

    The issue is J2SE1.4 libraries + 1.4 compiler settings are FORCED onto the project contrary to workspace settings.

    It explicitly sets project specific settings to do this.

    I do not see why MyEclipse Maven support needs to even go near the project specific settings or the libraries being used. Its a bug straight and simple.

    #310187 Reply

    copyrightwitness
    Participant

    Try this:

    Create a Java Maven Project
    It is incorrectly created with J2SE1.4 dependencies. (Create a java project from eclipse works correctly – the Java Maven Project gets it wrong).

    disable dependency management.
    Change Libs (Project – Properties – Java build Path)
    Change project settings back to workspace default (Project – properties – Java Compiler)
    Turn on dependency management.

    et voila. Project specific compiler settings return and is set to 1.4. The java build path has been altered and set to use 1.4 libs NOT 1.6 as it was already specified.

    See what I mean!? Just why has it messed about with these settings? That is where the fault lies.

    All these 3 actions show the fault:

    Create Java Maven Project
    Enable Dependency Management
    Import Existing project (Only if usin Maven2MyEclipse).

    #310222 Reply

    Ram
    Member

    copyrightwitness,

    Let me clarify that as already informed, creating Java Maven Project using wizard will set compiler compliance to J2SE1.4.This is already an existing bug.In case of web or ejb projects created using the IDE this is not true.
    If the user creates a Mavenized Web or Ejb projects those will set to compiler compliance level based on workspace settings(J2EE6).

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: Maven for Myeclipse uses(forces) incorrect JDK/JRE version

You must be logged in to post in the forum log in