X
  • March 9, 2013

Play in NetBeans IDE 7.3

Geertjan Wielenga
Product Manager

The NetBeans plugin for Play, by Yann D'Isanto and myself, is available for the first time in the NetBeans Plugin Portal, ready to use in NetBeans IDE 7.3:

http://plugins.netbeans.org/plugin/47637/?show=true

Install the plugin into 7.3 and then you're able to create new Play projects via the New Project dialog or open any existing Play project, such as the sample applications in the Play distro:

This is how opened Play projects look like in the IDE:


Related reading:

The sources of the plugin (in the form of a Maven module) are available here:

http://java.net/projects/nbplay/sources/nbplay

Do you want to contribute to this plugin? You are MORE than welcome to do so, please leave a message here either with your ideas or with your username on java.net so that you can be added as a committer to the project.

Issue tracker:

http://java.net/jira/browse/NBPLAY

Join the discussion

Comments ( 37 )
  • Mircea Saturday, March 9, 2013

    Thank you so much. Thanks.


  • Mircea Saturday, March 9, 2013

    I tried it on stable 7.3. I installed the plugin, I pointed to play framework, I created a project and I tried to run it. It does the same when I try to use autocompletion.

    This is the output when I try to run:

    :: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS

    unresolved dependency: org.scala-sbt#sbt;0.11.3: not found

    Error during sbt execution: Error retrieving required libraries

    (see C:\Users\Mircea\Documents\play-2.1.0\framework\.\sbt\boot\update.log for complete log)

    Error: Could not retrieve sbt 0.11.3

    java.lang.NullPointerException

    at org.netbeans.play.PlayFramework.findFile(PlayFramework.java:120)

    at org.netbeans.play.PlayFramework.lookupPlayJarFile(PlayFramework.java:99)

    at org.netbeans.play.classpath.BootClassPathImplementation.getResources(BootClassPathImplementation.java:48)

    at org.netbeans.api.java.classpath.ClassPath.entries(ClassPath.java:350)

    at org.netbeans.api.java.classpath.ClassPath.getRoots(ClassPath.java:262)

    at org.netbeans.api.java.classpath.ClassPath.findResource(ClassPath.java:448)

    at org.netbeans.modules.java.source.parsing.JavacParser.validateSourceLevel(JavacParser.java:838)

    at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:731)

    at org.netbeans.modules.java.source.parsing.JavacParser.createJavacTask(JavacParser.java:717)

    at org.netbeans.modules.java.source.parsing.CompilationInfoImpl.getJavacTask(CompilationInfoImpl.java:398)

    at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:495)

    at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:169)

    at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:606)

    at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:247)

    [catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:718)

    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

    at java.util.concurrent.FutureTask.run(FutureTask.java:166)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:722)


  • Geertjan Saturday, March 9, 2013

    You can see very clearly what the problem is:

    unresolved dependency: org.scala-sbt#sbt;0.11.3: not found

    Anyway, instead of creating a project, can you try to open one of the samples, such as the one that you can see in the screenshot above, that comes with the Play distribution? I'm curious to know if you'll get the same error then.


  • Geertjan Saturday, March 9, 2013

    PS: Possibly the Scala samples and Scala projects don't work right now. Could you try the Java samples and a Java project instead? I'll be blogging about Scala, Play, and NetBeans IDE 7.3 soon.


  • Geertjan Saturday, March 9, 2013

    No, even with Scala projects, there's no problem at all in compiling. However, code completion doesn't work, unless you have the NetBeans Scala plugin installed, more on that in another blog entry.

    Maybe this will help, though it took me 2 minutes to find via Google, so I'm guess you've seen this:

    http://stackoverflow.com/questions/14989154/org-scala-sbtsbt0-11-3-not-found-when-try-to-run-existing-project


  • Geertjan Saturday, March 9, 2013

    Identified the problem and fixed it. Better solution is needed, but please download the the plugin again and try again, for me, I can see code completion working fine now.


  • Geertjan Saturday, March 9, 2013

    Also, for Scala support in NetBeans IDE 7.3, you'll need this plugin:

    https://sourceforge.net/projects/erlybird/files/nb-scala/7.x_2.10.x/


  • Geertjan Saturday, March 9, 2013

    Something else is that the templates for creating new projects needs to be updated, I'll do that in the plugin sources soon, but in the meantime, do the following manually after creating a new project:

    In project/build.properties, change the content to this:

    sbt.version=0.12.2

    In project/plugins.sbt, change the last line to this:

    addSbtPlugin("play" % "sbt-plugin" % Option(System.getProperty("play.version")).getOrElse("2.0"))


  • Mircea Sunday, March 10, 2013

    I removed the old, then I installed the new plugin.

    I added your settings into project files and I was able to run it.

    The problem is that it doesn't see all the classes. I tried to open one of the samples and it's the same.

    I created an empty project. It worked like that. Still, it can't find some methods/classes/packages.

    Moreover, just after I create a Java Play project I get this error in NetBeans:

    java.lang.IllegalArgumentException: Malformed \uxxxx encoding.

    at java.util.Properties.loadConvert(Properties.java:568)

    at java.util.Properties.load0(Properties.java:391)

    at java.util.Properties.load(Properties.java:341)

    at org.netbeans.play.sbt.SbtHelper$1.run(SbtHelper.java:45)

    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1454)

    [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2048)

    From the default Application.java contained into the Java Play new project it doesn't find "index":

    package controllers;

    import play.*;

    import play.mvc.*;

    import views.html.*;

    public class Application extends Controller {

    public static Result index() {

    return ok(index.render("Your new application is ready."));

    }

    }

    One more question: what about templates? Right now NetBeans doesn't seem to like it. It shows many html errors. Is it because I don't have Scala plugin installed?


  • Geertjan Sunday, March 10, 2013

    What does "doesn't see all the classes" mean? And what does "it can't find some methods/classes/packages"?

    Does it mean that code completion doesn't work for some (which?) classes? Does it mean that red error marks are shown for some (which?) classes?

    What does "it doesn't find 'index' mean"? Red error marks? What, exactly?

    "I tried to open one of the samples and it's the same." -- which sample, specifically? Can you help me by giving me steps to reproduce what you're describing?


  • guest Sunday, March 10, 2013

    Ah, seeing the problems now -- all classpath related. Working on fixing them.


  • Mircea Sunday, March 10, 2013

    Sorry for not providing all the info, but I was very tired. :)

    Glad to see that you found the errors.


  • Vortilion Monday, March 11, 2013

    Does the plugin only support play 2? Or play 1 as well?


  • dcaoyuan Monday, March 11, 2013

    Hi Gj,

    Are you using the latest package from plugins.netbeans.org? if so, it's ok. Or if it's from sourceforge.net, you'll need nbscala-7.x_2.10.x-1.6.1.1.zip instead of nbscala-7.x_2.10.x-1.6.1.zip. The newest one, I fixed some issues related to multiple sources folders under Play!, for example, managed_sources. And you may also need to clear/delete NetBeans cache so as to let NetBeans Scala module re-scan/indexing them.


  • Vortilion Monday, March 11, 2013

    Will there be a play 1 plug in? I prefer using the old play 1.2.5...


  • guest Tuesday, March 12, 2013

    is this plugin could also be used for creating scala - play projects


  • guest Saturday, March 16, 2013

    Very interesting plugin. However when trying to open the sample Play 2.1.0 projects or the project created as part of the Play TodoList tutorial I get red error marks in quite a few places in my Java classes. For example it seems to not recognise any import in play.data (although it does recognise play.mvc) as well as the routes managed class, so I get a red error mark for return redirect(routes.Application.tasks());


  • Brian Wednesday, March 20, 2013

    yea, I added some new dependencies, but no code completion. I also tried checking out and building with no sucess... I guess I'll wait for an update.


  • Geertjan Wednesday, March 20, 2013

    Brian, can you be slightly specific so that I can try to reproduce your scenario?


  • Tomas Wednesday, March 20, 2013

    Hi Geertjan, can you please advise how to get rid of red errors such as import package play.data.* and using the Form class in the sample project Zentasks?

    Is necessary to install scala plugins for java projects?

    Thanks


  • David Saturday, March 23, 2013

    I'm having the same issues with code completion :/

    Here's a screenshot of what netbeans confronts me with: http://i.imgur.com/AkM7jju.png

    It would be great if anyone could help!

    Thanks in advance, David


  • guest Friday, April 5, 2013

    Hi Geertjan, Could you add an update xml. so one can get updates as soon as they come?


  • guest Thursday, May 23, 2013

    Hi Geertjan,

    I'm looking into play and having been a long-term Netbeans user, I thought things would be pretty straightforward.

    The first issue, outside of what you have here, is that Play's website points you to a "sbt-netbeans-plugin" that is a couple of years old and won't compile ...

    Second, I've installed the plugin that this page mentions and I too am having a raft of CLASSPATH issues with packages and classes not being found. I can send screen shots and more than happy to pitch-in where I can to help resolve this for the platform.

    Regards,

    Anthony


  • guest Thursday, May 30, 2013

    has anyone been able to fix this classpath issues?


  • Geertjan Friday, May 31, 2013

    Are any of the commenters here interested in contributing code to the plugin? That would help a lot to improve it, it's definitely not complete and a work in progress.


  • Anthony Friday, May 31, 2013

    Hi Geertjan,

    I took your challenge to contribute. I pulled the plugin code from SVN and was faxed with more "red marks" than I could poke a stick at :(

    Knowing that my problem was class related I went for a walk through the code...

    in "BootClassPathImplementation", line 55, there is a hard-coded reference to Scala 2.9.1 - My install, a recent one is 2.9.2 so I'm guess that's part of the problem.

    The issue then is how to avoid using hard-coded pathing like this?

    I'm willing to go further but I have a series of "lock" icons on each of the directories ...

    Anthony


  • guest Monday, June 24, 2013

    Hi,

    I am finding it tough to select the right startup book for building web applications with java (servlets and jsp) specifically in netbeans. Any body with the much needed help? I really need your help....

    Thanks


  • Geertjan Monday, June 24, 2013
  • pierz Tuesday, July 16, 2013

    Hi Geertjan, thanks for your plugin, do you plan to fix the classpath issue ? It doesn't recognize stuff like : "import javax.persistence", "import play.*" "import com.avaje.ebean.*" ...

    Do you think we can have a working syntax highligther for scala.html template ? (I think there is a template for sublime2 here https://github.com/guillaumebort/play2-sublimetext2 )


  • yerlan Thursday, August 1, 2013

    Hi Geertjan,

    Thanks for the plugin.

    I am interested in Java and Play development and planning to contribute to this plugin.

    Just one question - is this plugin forward compatible with NB 7.4 and onwards?

    Because, I hate to work on "legacy" stuff.


  • guest Thursday, October 31, 2013

    Hi Geertjan,

    Thank you for this plugin developed. I'm a fan of NetBeans and Play framework.

    Unfortunately some of the files included in the creation of a Play project with this plugin are no longer compatible with the latest versions of Play as the latest Play 2.2.1 October 2013. I changed some files and give them to you below. Please could you recreate a release of this plugin with the changes that I give you, because I have no idea how to do this in NetBeans (creating a plugin). Thank you in advance.

    ---plugins.sbt---

    // Comment to get more information during initialization

    logLevel := Level.Warn

    // The Typesafe repository

    resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

    // Use the Play sbt plugin for Play projects

    addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")

    ---build.properties---

    sbt.version=0.13.0

    ---build.scala---

    import sbt._

    import Keys._

    import play.Project._

    object ApplicationBuild extends Build {

    val appName = "PlayProject3"

    val appVersion = "1.0-SNAPSHOT"

    val appDependencies = Seq(

    // Add your project dependencies here,

    javaCore

    )

    val main = play.Project(appName, appVersion, appDependencies).settings(

    // Add your own project settings here

    )

    }


  • Jean-Claude Stritt Thursday, October 31, 2013

    Hi Geertjan,

    Thank you for this plugin developed. I'm a fan of NetBeans and Play framework.

    Unfortunately some of the files included in the creation of a Play project are no longer compatible with the latest versions of Play as the latest Play 2.2.1 October 2013. I changed some files and can send you 3 files that change. Please could you recreate a release of this plugin with the changes that I give you, because I have no idea how to do this in NetBeans (create plugin). Thank you in advance.


  • MadProgrammer Thursday, January 30, 2014

    Picked up Play 2.2.1 and installed the plugin. Now, with complete respect, I understand that the plugin doesn't really support this level of Play.

    When I open an project (created via the "play new" command") I get and exception

    java.lang.NullPointerException

    at org.netbeans.play.PlayFramework.findFile(PlayFramework.java:128)

    at org.netbeans.play.PlayFramework.lookupPlayJarFile(PlayFramework.java:99)

    .

    .

    .

    I tracked this down to a change the Play frameworks repository from "repository/local/play/play_2.10/" to "repository/local/com.typesafe.play/"

    As I think has already being mentioned, this is not the only change. Curios to know if this is the only place this might be a problem?


  • guest Thursday, April 10, 2014

    Hi Geertjan,

    you have done a woderfull job.But i am not able to add jar files in the netbeans play project and i am not able to get automatic prediction of classes while typing in it.

    so if i import the classes manually in the java program it is giving me exceptions like

    play.PlayExceptions$CompilationException: Compilation error[error: package javax.persistance does not exist]

    So what can i do for that.can you give me solution for this.


  • prakash Thursday, April 10, 2014

    Hi Geertjan,

    you have done a woderfull job.But i am not able to add jar files in the netbeans play project and i am not able to get automatic prediction of classes while typing in it.

    so if i import the classes manually in the java program it is giving me exceptions like

    play.PlayExceptions$CompilationException: Compilation error[error: package javax.persistance does not exist]

    So what can i do for that.can you give me solution for this.


  • o58 Friday, August 22, 2014

    Hey guys,

    Wonderful plugin, many kudos for writing it. Due to the latest changes in Play framework, however, the path in settings for locating Play's installation folder doesn't work anymore. Consequently, the plugin cannot find the sources because 'play' command has been dropped in favor of a more generic tool called 'activator'.

    It would be great if the plugin is also upgraded to account for that? Thanks in advance.

    /O58


  • guest Thursday, August 28, 2014

    instralled the play plugin as of aug 27 2014,

    am using NB 7.4

    " invalid home play path"

    do I need to go back to 7.3

    regard

    rob r


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
Oracle

Integrated Cloud Applications & Platform Services