Documentation

Browse versions

Browse APIs

Language

Browse

Contents

Books

You are viewing the documentation for Play 1. The documentation for Play 2 is here.

Setting-up your preferred IDE

Working with Play is easy. You don’t even need a sophisticated IDE as Play compiles and refreshes the modifications you make to your source files automatically. So you can easily work using a simple text editor.

However, using a modern Java IDE provides cool productivity features like auto-completion, on-the-fly compilation, assisted refactoring and debugging. Play supports the NetBeans, IntelliJ IDEA and Eclipse platforms.

Play provides a command to simplify Eclipse configuration. To transform a Play application into a working Eclipse project, use the eclipsify command:

# play eclipsify myApp

You then need to import the application into your Workspace with the File/Import/General/Existing project… menu.

The eclipsify command generates several launchers for the application. The main launcher in only usable with the Run As Eclipse command. You can then use the Connect JPDA launcher using Debug As to start a debugging session at any time. Stopping the debugging session will not stop the server.

If you make any important changes to your application, such as changing the classpath, use eclipsify again to regenerate the configuration files.

Additionally, an Eclipse plugin is available in your Play distribution, in the support/eclipse/ directory. To install it, simply copy the JAR file you will find to your Eclipse installation’s dropins folder.

Do not commit Eclipse configuration files when you work in a team!

The generated configuration files contain absolute references to your framework installation. These are specific to your own installation. When you work in a team, each developer must keep his Eclipse configuration files private.

Play provides a command to simplify NetBeans configuration. To transform an existing application to a valid NetBeans project, use the netbeansify command:

# play netbeansify myApp

Then you can just open the application as a NetBeans project.

Use the standard Run button to start the application. When the application is started you can attach a debugging session at any time using the Debug button. Stopping the debugging session doesn’t stop the server.

If you make any important change to your application such as changing the classpath, use netbeansify again to regenerate the configuration files.

Do not commit the nbproject/ directory when you work in a team!

The generated configuration files contains absolute references to your framework installation. These are specific to your own installation. When you work in a team on the same application, each developer must keep his NetBeans configuration files private.

Play provides a command to simplify IntelliJ IDEA configuration. To transform an existing application to a valid IntelliJ IDEA module/project, use the idealize command:

# play idealize myApp

Then you can just import the application in IntelliJ using the import module facility.

You can use the Run and Debug using the context menu.

Do not commit the .iml files when you work in a team!

The generated configuration files contains absolute references to your framework installation. These are specific to your own installation. When you work in a team on the same application, each developer must keep his IntelliJ IDEA configuration files private.

Play automatically reloads Java classes when the Java sources are modified. However as Java does not fully support class reloading, the JDPA debugger can easily get confused: breakpoint submission may fail or the debugger may stop on the wrong line when you step into the code.

To avoid this behavior, a better way is to start a fresh debugging session after a code modification. Luckily, JPDA supports the ability to connect and disconnect the debugger at any time without restarting the JVM.

So the correct workflow for debugging is:

Make changes to your source code.

Refresh the browser to see the results. (At this time Play will reload your code modifications and redefine classes in the JVM.)

If something goes wrong and you need to debug, start a new debug session.

Debug and correct your code.

Disconnect the debugger.

By using this work-flow you will always have a debugger synchronized with the code loaded in the JVM.