How do I use Play Framework 2.0 in netbeans
Asked Answered
T

9

11

Play Framework 2.0 doesn't seem to have much / any support for Netbeans. I'm currently just using it as an editor (loading the files using the favorites tab), but it's a little frustrating that Netbeans doesn't recognise any of the libraries / api's.

This means that EVERYTHING is underlined in red.

Trying to create a free-form project requires a build file, so I get stuck there too.

Any ideas appreciated...

Tightfisted answered 11/4, 2012 at 20:54 Comment(0)
T
14
  1. Create a play project as per normal way.
  2. From the play CLI select play eclipsify to create an eclipse project.
  3. From netbeans, select File > Import Project > Eclipse Project
  4. Select Import Projects Ignoring Dependencies
  5. In Project to Import, insert the root of your play application.
  6. In Destination Folder, also insert the root of your play application.
  7. Press Finish.
Tightfisted answered 24/10, 2012 at 16:36 Comment(1)
Every now and again, I use "File > Import > Resync Eclipse Project" to get the new libs recognized in Netbeans.Tightfisted
E
10

Use the eclipse support to generate an eclipse project and then import that into NetBeans

Espionage answered 20/10, 2012 at 20:33 Comment(0)
I
6

NetBeans now has Native Support for Play Framework 2.3.x and above: http://nbpleasureplugin.com/documentation/installation.html No Command line needed at all.

The most important features are:

  • Create, run, debug and test your app directly in the IDE
  • Routes files support (Syntax coloring, Syntax Error highlighting, Autocompletion, Code navigation, Show implementation code (without navigate to source), Hint to Create method when it doesn’t exist, formatting, Mark occurrences)
  • Scala Template support (Syntax coloring, Syntax Error highlighting, Autocompletion, Code navigation, Show implementation code (without navigate to source), formatting, Mark occurrences)
  • Dependency Management
  • Test Single File
  • SBT file minimal support
  • Configurations (Formatting indentation, syntax coloring, port to use, activator parameters, etc.)
  • Support play version from 2.3.x and above

Note: I created this plugin.

Inspectorate answered 28/10, 2015 at 17:33 Comment(0)
E
2

Just want to tack on to these other responses. As this was the first google result for me when solving this problem. The current build of Play uses the 'eclipse' command instead of the 'eclipsify' command. Also, it should be ran from the Play environment.

Navigate to your project directory:

Enter the Play environment: [projectdir] [username]$ play

Eclipsify the project: [projectname] $ eclipse

Then import in netbeans, following the top voted answers direction.

Eugeniaeugenics answered 24/1, 2014 at 14:5 Comment(0)
S
1

The following works for Play 2.4 and NetBeans 8.0.2. Posting here since this question shows up in search results regardless of Play version and the official documentation is too brief and does not provide specific steps.

Pre-requisites: activator (tested with 1.3.5), NetBeans with all scala-related available plugins installed (in my case this included nbscala mentioned in Play docs, but not nbsbt).

  1. Add nbsbt to your plugin definition file. You can use either the global one at ~/.sbt/0.13/plugins/plugins.sbt or the project-specific one at PROJECT_DIR/project/plugins.sbt:

    // for sbt 0.13.x addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.1.4") // for sbt 0.12.x addSbtPlugin("org.netbeans.nbsbt" % "nbsbt-plugin" % "1.0.2")

    [from nbsbt README] Or else you can just create a separate netbeans.sbt file next to plugins.sbt and add to .gitignore if you prefer to separate IDE-specific config from the rest of the project.

  2. On command line go to the project root and run activator specifying that you want to create a netbeans configuration:

    $ cd PROJECT_DIR

    $ activator netbeans

    Running activator will first resolve all the dependencies (including nbsbt) and then create NetBeans files. I you should see .classpath_nb file in the root as a result of this command.

  3. Finally, just go to NetBeans and simply do File > Open Project...

Schaaf answered 28/7, 2015 at 17:27 Comment(0)
D
0

There is no native support for Netbeans at this time.

Check Play 2.0 IDE documentation for Netbeans section.

There are also some suggestions of workaround in the Google Groups topic

Deedee answered 12/4, 2012 at 10:10 Comment(2)
I'm aware of this, thank you. I'm not looking for a compile, build, run solution - simply a way to get Netbeans to recognize the classes - and get rid of those grizzly red underlines. Thanks :)Tightfisted
I didn't try Netbeans with Play 2.0 however I assume that any of the tips from mentioned GG topic should work. I tested Eclipse and it worked almost fine (required manual refreshing of the files after dev-mode recompilation - maybe configuration matters). IntelliJ Idea 11+ works pretty well as well, so maybe one of them could let you work without grizzlies :)Deedee
H
0

Take a look at play2-maven-plugin which provides a nice mavenized interface to the Play/SBT/Ivy universe. One small pom.xml then lets you leverage all of NetBeans' Maven goodness to get rid of those red underlines...

Heracliteanism answered 4/1, 2013 at 11:29 Comment(0)
S
0

Just use the command : play netbeansify myApp

Sandlin answered 9/5, 2013 at 8:42 Comment(1)
You should mention that this only works for version 1.Fortyish
M
0

I was going through the same trouble a few days ago. What I found out is that NetBeans has a plugin in its plugins repository that is called Pleasure Plugin[http://plugins.netbeans.org/plugin/61050 ] and is designed for NetBeans 8.

This plugin is awesome because it opens the Play project and shows all the packages and folders divided as they should be. It allows you to execute the project, to debug the back-end easily (just put a break point and run the project in debug mode) among other features.

The only problem is that this plugin has a Commercial License and you can use it for free for a 30 day trial.

Mylor answered 17/12, 2015 at 11:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.