Play integration is a disaster - can't add even a single dependency

*** Please view post #2 of this thread, it seems IntelliJ and Play integration is broken because you can add event a single dependency without getting errors that prevent compilation ***

I want to use the REST Assured library - - for testing REST components of a Play application.

I added the REST Assured dependency to Build.scala -

  val appDependencies = Seq(
    // Add your project dependencies here,
    "com.jayway.restassured" % "rest-assured" % "1.8.0" % "test"

And added some import statement to my file -

import static com.jayway.restassured.RestAssured.*;
import static com.jayway.restassured.matcher.RestAssuredMatchers.*;
import static org.hamcrest.Matchers.*;

I have errors in my file for these three import statements even though I have added the dependency in Build.scala - "Cannot resolve symbol"

I cannot run my Play app or the tests and I get the following errors in the Messages - Make/Compile window -
Compilation completed with 14 errors and 0 warnings in 3 sec
14 errors
0 warnings
scala: warning: [options] bootstrap class path not set in conjunction with -source 1.6
scala: C:\Users\I013114\Development\my_workspace\my_application\test\ error: package com.jayway.restassured does not exist
scala: import static com.jayway.restassured.RestAssured.*;
scala: C:\Users\I013114\Development\my_workspace\my_application\test\ error: package com.jayway.restassured.matcher does not exist
scala: import static com.jayway.restassured.matcher.RestAssuredMatchers.*;
scala: C:\Users\I013114\Development\my_workspace\my_application\test\ error: cannot find symbol
scala: import static org.hamcrest.Matchers.*;
scala:   symbol:   class Matchers
scala:   location: package org.hamcrest

The "run", "test" and "compile" commands work without any errors if I use my app from the command line, the problem only appears with IntelliJ. I am using IntelliJ 12.1.1 and Play 2.1.0. What could be causing this problem and how can I fix it?

1 comment
Comment actions Permalink

OK so it seems IntelliJ basically has terrible integration with Play. I can't even add the Google Guice DI library as a dependency, in other words I can't add any dependencies.

Steps to reproduce -
1. Create a new Play Java Project
2. Alter Build.scala file as follows -

  val appDependencies = Seq(
    // Add your project dependencies here,
    "" % "guice" % "3.0"

3. Import Google Guice -

4. Create a default Play 2 App Run Configuration

5. Run the app

I get an error on this import saying - Cannot resolve symbol 'inject'

So I try doing Build->Make Project, I get an error in the Messages windows - scala: C:\Users\Me\Development\myguice\app\controllers\ error: package does not exist

I then try editing the run configuration and removing the Before launch 'Make' command and replacing it with SBT, and selecting test:compile for the SBT Action. This just hangs IntelliJ with a background task "Executing SBT Action"

So is the true state of the IntelliJ - Play integration? Because it is completely broken if it is not possible to add a dependencies to the project. Is there some fix for this that I haven't come across in the last 8 eight hours I've spent trying to get IntelliJ and Play working together?


Please sign in to leave a comment.