Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import playframework sources into eclipse?

After cloning playframework from github and importing java sources into eclipse there are a lot of build errors shown.

Running the goals from ant file in eclipse works fine as well as building from cli directly.

How can i resolve these errors in eclipse?

I took the following steps to import play into eclipse:

  • new -> other -> Java>New Java Project from Existing Ant Buildfile
  • select play/framework/build.xml
  • checking the 'Link to the build file in the file system' checkbox
  • Finish
like image 352
Georg Engel Avatar asked Oct 14 '11 13:10

Georg Engel


People also ask

How do I run a play framework?

To run a Play application: Create a new Run Configuration – From the main menu, select Run -> Edit Configurations. Click on the + to add a new configuration. From the list of configurations, choose “sbt Task”


2 Answers

The errors result from differences between eclipse internal build path and classpath available for ant at runtime.

First Eclipse only imports rt.jar from system path. This may lead to missing dependecies in javax.net packages (e.g. javax.net.ssl.SSLException), which is located in jsse.jar. To fix, right click on project->Properties->Java Build Path->Libraries->Add Library-> JRE System Library.

Second, play has dependencies to classes from ant runtime. To fix, right click on project->Properties->Java Build Path->Libraries->Add Library->User Library There you have to add a new User Library (perhaps call it ANT) and add all ant-jars from your ant installation (/usr/share/ant/lib/ worked for me). Then add this user library to play projects build path.

like image 174
Oliver Sauder Avatar answered Sep 27 '22 17:09

Oliver Sauder


From the Oliver's answer, I had also to add the jce.jar lib in my classpath.

It comes from the $JDK/jre/lib directory.

like image 21
ndeverge Avatar answered Sep 27 '22 16:09

ndeverge