Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a Play project in Eclipse

hello I've been trying to find how to run a Java Play project in eclipse but I can't find an easy way. Here is what I've done

Create a project

play new testApp

Go to the folder

cd testApp

Eclipsify the project

play eclipsify

Open eclipse and import as an existing project, but then I don't know how to run the server from eclipse

NOTE: I know that I can run it in the console also. The problem is that I've added an Eclispe project to the buildpath using Eclipse so If I run it in the console I think it will not work, or am I wrong?

like image 850
rogeliog Avatar asked May 28 '12 11:05

rogeliog


4 Answers

In newer versions of play, the command has changed to

play eclipse
like image 183
Gubatron Avatar answered Oct 05 '22 19:10

Gubatron


For Play 2.x.y, Activator is tool of choice

activator eclipse

or

./activator eclipse

to use project local activator copy (if exists)

like image 20
anthavio Avatar answered Oct 05 '22 19:10

anthavio


The following procedure may be followed to compile and import sbt play project into eclipse IDE:

  1. Go to your project folder and create text file plugins.sbt and add below code:

    addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "5.2.2")
    
  2. To force compilation add below code to your project's build.sbt file:

    EclipseKeys.preTasks := Seq(compile in Compile, compile in Test)
    
  3. Ensure that Scala IDE is installed in eclipse (download from: scala-ide.org)

  4. At command prompt type sbt to compile sbt play project.

  5. After successful compilation, In sbt use command eclipse to create Eclipse project files > eclipse. Check for [info] Successfully created Eclipse project files for project(s):

  6. Go to eclipse IDE and use Import Wizard to import Existing Projects into Workspace

like image 33
Hanumanth s Avatar answered Oct 05 '22 19:10

Hanumanth s


Play eclipsify creates a run configuration for you.

Run --> Run Configurations --> Java Applications --> testApp

If you need to debug first run the application as indicated then

Run --> Debug Configurations --> Remote Java Applications --> Connect JPDA to testApp

like image 21
emt14 Avatar answered Oct 05 '22 19:10

emt14