Open minds leads to freedom

Communicating my thoughts on software development

Importing and debugging Eclipse projects in IntelliJ IDEA

Posted by rnaufal on 8th January 2017

Last week I faced a situation to import some Eclipse projects to IntelliJ IDEA, my default Java IDE. IntelliJ IDEA supports this integration, just go to File > New > Project from Existing Sources… and select a directory where Eclipse .project or .classpath files are located.

The project was imported successfully, it had some test compilation errors and it was all done for that moment. But, after running the project, I noted that I couldn’t debug some classes as well as I got used at Eclipse.

It was because, by default, IntelliJ IDEA uses the javac compiler and Eclipse has its own Java compiler that is part of JDT core. IntelliJ IDEA doesn’t proceed on code compilation when it finds the first error, even for test code or code that isn’t part of the build. The Eclipse compiler is able to proceed on code compilation even if it has compilation errors, so it is possible to run / debug code that doesn’t compile at all.

The solution, in this case, is to switch IntelliJ IDEA to use the Eclipse compiler. Just go to File > Settings > Build, Execution, Deployment > Compiler > Java compiler and change the drop down box "Use compiler:" to Eclipse and that is done.

I did that and now I am able to run / debug the Eclipse project using IntelliJ IDEA very well.

I have found the solution here:

Enable Partial Compile IntelliJ
What is the difference between javac and the Eclipse compiler?

Have you faced a situation like this? Have you done another solution than mine? Drop your comments here! 🙂

Tags: , , , ,
Posted in debug, eclipse, idea, intellij, java | No Comments »

Maven Eclipse plugin using project dependencies

Posted by rnaufal on 22nd August 2011

Some months ago I was noting the behavior of the Maven Eclipse plugin during the eclipse:eclipse goal.

I realized that its default behavior is to build the dependencies based on the Eclipse projects instead of the installed packages on the repository. During development time, it’s the behavior we need, but if you want to build the Eclipse files using the packages on the repository, you have to use the following command:

mvn eclipse:eclipse -Declipse.useProjectReferences=false

By default, the useProjectReferences flag is set to true, in other words, the plugin will create and reference the projects in Eclipse. Without it you’ll have to use mvn install to make changes available for dependent projects. Very interesting to note.

Update *: After creating the project dependencies, you have to execute mvn install to make it available for mvn eclipse:eclipse on dependent projects for the first time.

Tags: , , , , ,
Posted in Uncategorized | No Comments »

Eclipse Log4J template

Posted by rnaufal on 9th May 2010

My friend Bruno sent me an interesting tip on how to create a Log4J template at Eclipse. Just follow these steps:

  1. Go to Window > Preferences > Java > Editor > Templates
  2. Click New
  3. Write the string logger at the field Name (this name will be used to call the template)
  4. At the field Pattern, write the following:

    private static final Logger LOGGER = Logger.getLogger(${enclosing_type}.class);

  5. Click OK

The variable ${enclosing_type} refers to the enclosing type name. When you are ready, write down logger on the field class declaration to have a logger added to the class.

Tags: , , , ,
Posted in Uncategorized | No Comments »

Fixing Eclipse buttons for Ubuntu 9.10

Posted by rnaufal on 13th November 2009

I’ve just updated to the new Ubuntu Karmic 9.10 and I’ve found some weird problems running Eclipse. Some buttons didn’t work when they were clicked, but the keyboard shortcuts worked well. It looks like in Eclipse 3.6 the bug will be solved. It looks like it’s a hack between Eclipse SWT and GTK. More information here, here and here.

To fix the problem, just launch Eclipse through this shell script file, assuming Eclipse is installed at /home/rnaufal/eclipse/eclipse:


Tags: , , , , , ,
Posted in Uncategorized | 6 Comments »