Play in NetBeans IDE 7.3

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

Comments:

Thank you so much. Thanks.

Posted by Mircea on March 09, 2013 at 10:33 AM PST #

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)

Posted by Mircea on March 09, 2013 at 11:42 AM PST #

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.

Posted by Geertjan on March 09, 2013 at 12:17 PM PST #

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.

Posted by Geertjan on March 09, 2013 at 12:19 PM PST #

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

Posted by Geertjan on March 09, 2013 at 12:27 PM PST #

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.

Posted by Geertjan on March 09, 2013 at 01:57 PM PST #

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/

Posted by Geertjan on March 09, 2013 at 02:21 PM PST #

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"))

Posted by Geertjan on March 09, 2013 at 02:35 PM PST #

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?

Posted by Mircea on March 09, 2013 at 04:01 PM PST #

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?

Posted by Geertjan on March 09, 2013 at 11:08 PM PST #

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

Posted by guest on March 10, 2013 at 01:30 AM PST #

Sorry for not providing all the info, but I was very tired. :)
Glad to see that you found the errors.

Posted by Mircea on March 10, 2013 at 01:39 AM PST #

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

Posted by Vortilion on March 11, 2013 at 09:19 AM PDT #

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.

Posted by dcaoyuan on March 11, 2013 at 01:29 PM PDT #

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

Posted by Vortilion on March 11, 2013 at 04:22 PM PDT #

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

Posted by guest on March 11, 2013 at 10:17 PM PDT #

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());

Posted by guest on March 16, 2013 at 12:31 PM PDT #

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.

Posted by Brian on March 20, 2013 at 12:18 AM PDT #

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

Posted by Geertjan on March 20, 2013 at 12:25 AM PDT #

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

Posted by Tomas on March 20, 2013 at 07:25 AM PDT #

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

Posted by David on March 23, 2013 at 05:32 AM PDT #

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

Posted by guest on April 04, 2013 at 11:28 PM PDT #

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

Posted by guest on May 23, 2013 at 04:42 AM PDT #

has anyone been able to fix this classpath issues?

Posted by guest on May 30, 2013 at 10:14 AM PDT #

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.

Posted by Geertjan on May 31, 2013 at 01:20 AM PDT #

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

Posted by Anthony on May 31, 2013 at 11:35 AM PDT #

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

Posted by guest on June 24, 2013 at 01:47 PM PDT #

https://netbeans.org/kb/trails/java-ee.html

Posted by Geertjan on June 24, 2013 at 02:38 PM PDT #

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 )

Posted by pierz on July 16, 2013 at 08:28 AM PDT #

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.

Posted by yerlan on August 01, 2013 at 07:47 AM PDT #

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
)

}

Posted by guest on October 31, 2013 at 01:43 PM PDT #

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.

Posted by Jean-Claude Stritt on October 31, 2013 at 01:45 PM PDT #

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?

Posted by MadProgrammer on January 29, 2014 at 08:28 PM PST #

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.

Posted by guest on April 09, 2014 at 10:56 PM PDT #

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.

Posted by prakash on April 09, 2014 at 10:56 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today