create eclipse project with gradle

The following two tabs change content below.
Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

Latest posts by Prasad Kharkar (see all)

We saw how to create a java project with gradle in previous article. What good are those if we cannot import them in any IDE, are we going to write code in only text editors? Obviously not. We will see how to create eclipse project with gradle in this article.

Create Eclipse Project With Gradle:

After we have compiled java source code and built necessary files, we want to import the project in eclipse and then continue working with it. But only built code will not be able to get imported in eclipse. Eclipse needs a .project, .classpath files and .settings folder which is essential for project to be recognized as eclipse project. Gradle eclipse plugin helps us create eclipse project with gradle. We simply need to add the plugin in build.gradle file as below.

If you have not built java project, do it using gradle build command as below

gradle ran successfully

Now we need to run gradle eclipse from command line. Navigate to the root directory where you have kept your java project and run as below.

eclise project built successfully

When we create eclipse project with gradle, all eclipse related tasks are executed and build is successful. Now you can simply open eclipse -> File -> Import -> Existing Projects into Workspace and select the root directory of our java project. Project will get imported successfully and you can see structure as below

2015-05-22 19_24_07-Java EE - javaproject_src_main_java_com_thejavageek_Hello.java - Eclipse

 

I hope the article helped created eclipse project with gradle

 

 

Share Button

Prasad Kharkar

Prasad Kharkar is a java enthusiast and always keen to explore and learn java technologies. He is SCJP,OCPWCD, OCEJPAD and aspires to be java architect.

2 thoughts on “create eclipse project with gradle

Leave a Reply

Your email address will not be published. Required fields are marked *