How do I use Play Framework 2.0 in netbeans

2019-04-05 03:24发布

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...

9条回答
可以哭但决不认输i
2楼-- · 2019-04-05 03:37

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...

查看更多
倾城 Initia
3楼-- · 2019-04-05 03:41

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

查看更多
劳资没心,怎么记你
4楼-- · 2019-04-05 03:43

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

查看更多
Viruses.
5楼-- · 2019-04-05 03:47

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.

查看更多
The star\"
6楼-- · 2019-04-05 03:48
  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.
查看更多
神经病院院长
7楼-- · 2019-04-05 03:50

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...

查看更多
登录 后发表回答