Settings and Preferences for Eclipse IDE for JAVA Developers (Luna)


  • ADMIN

    To maintain code style and format across developers contribution,
    we have to use the following style files on ecplise IDE for MyController Java codes.

    Clean Up Templates

    File: mycontroller-eclipse-preferences-java-codestyle-cleanup.xml

    • Window -> Preferences -> Java -> Code Style -> Clean Up -> Import…
    • Select mycontroller-eclipse-preferences-java-codestyle-cleanup.xml -> and click OK

    Import Code Templates

    File: mycontroller-eclipse-preferences-java-codestyle-codetemplates.xml

    • Window -> Preferences -> Java -> Code Style -> Code Templates -> Import…
    • Select mycontroller-eclipse-preferences-java-codestyle-codetemplates.xml and click OK

    Import Formatter

    File: mycontroller-eclipse-preferences-java-codestyle-formatter.xml

    • Window -> Preferences -> Java -> Code Style -> Formatter-> Import…
    • Select mycontroller-eclipse-preferences-java-codestyle-formatter.xml and click OK

    Import correct import order settings

    File: mycontroller-eclipse-preferences-java-codestyle-organizeimports.importorder

    • Window -> Preferences -> Java -> Code Style -> Organize Imports -> Import…
    • Select mycontroller-eclipse-preferences-java-codestyle-organizeimports.importorder and click OK

    Install lombok project in eclipse



  • It seems that lombok is needed too.
    I did not succeed in installing it on eclipse mars for now.


  • ADMIN

    @gbrd
    Yes, we need to install lombok in eclipse. Thank you for this. I have added tutorial video how to install lombok in eclipse.



  • @jkandasa ok clean project in eclipse mars seems enough to make it work.

    http://stackoverflow.com/questions/31297342/lombok-not-working-in-eclipse-mars



  • @jkandasa I have a some issue installing the project.
    I’m using mac os 10.10.5, eclipse neon , lombok 1.16.12 and java 8.

    I can build from maven without issue, but eclipse still show me error about :

    *APPLICATION_JSON cannot be resolved to a variable AuthenticationHandler.java /mycontroller/modules/core/src/main/java/org/mycontroller/standalone/api/jaxrs line 48 Java Problem

    ALLOW_ANONYMOUS_PROPERTY_NAME cannot be resolved to a variable BrokerConfiguration.java /mycontroller/modules/core/src/main/java/org/mycontroller/standalone/mqttbroker line 67 Java Problem

    ClientResponse cannot be resolved to a type PushbulletUtils.java /mycontroller/modules/core/src/main/java/org/mycontroller/standalone/operation line 110 Java Problem

    ConnectionSource cannot be resolved to a type DataBaseUtils.java /mycontroller/modules/core/src/main/java/org/mycontroller/standalone/db line 63 Java Problem*

    Annotation @Slf4j also show in red. I thought at first it’s because of lombok but it’s actually installed (I can see it from about eclipse). But I created a simple test project, I can use lombok with annotation « @data » and @Slf4j without red warning.

    I also switch to lombok 1.16.10 and eclipse luna but no luck.

    Any idea what I missing, what is your project configuration eclipse, lombok version ?


  • ADMIN

    @Fraid I never worked with MAC. However, the eclipse will be common on all platforms.

    Can you try to build as eclipse project via maven by executing the following command? And import as Existing project in to workspace

    git clone https://github.com/mycontroller-org/mycontroller
    cd mycontroller/
    mvn eclipse:eclipse
    


  • Same issue, Build SUCCESS, no warning either but eclipse still showing red warning.



  • Not sure what happen, I previously has other project on maven, maybe there was some conflict.

    I make it work now, by reinstalling/downloading everything from scratch (workspace deleted, m2 repo was also removed) then I run "mvn eclipse:eclipse", open eclipse.
    Import maven project and worked now.



  • I think there is an issue with the Copyright settings.
    When you create a new class, select "generate comments", the generated copyright will start like :
    " Copyright 2016 Jeeva Kandasamy (jkandasa@gma...."

    while maven license will check for header starting with:
    "Copyright 2015-2016 Jeeva Kandasamy (jkandasa@gma...".
    The build will failed.

    Also formating code doesn't work as expected.
    In GatewayUtils.java class for exemple, formating goes from the following :


    SERIAL("Serial"),
    ETHERNET("Ethernet"),
    MQTT("MQTT"),
    PHANT_IO("Sparkfun [phant.io]"),
    PHILIPS_HUE("Philips Hue");
    

    to this:


    SERIAL("Serial"), ETHERNET("Ethernet"), MQTT("MQTT"), PHANT_IO("Sparkfun [phant.io]"), PHILIPS_HUE("Philips Hue");
    


  • ADMIN

    @Fraid Have you imported all the 4 files mentioned on main section for eclipse?

    To add license file use the following command

    mvn license:format
    


  • @jkandasa Yes I did over four time. Formatter and CleanUp section as for profile "MyController.org".
    I'm using mac with Eclipse Helios.


  • ADMIN

    @Fraid I am using Eclipse Luna. Let me try with Helios.


Log in to reply