Remove error-indication in IntelliJ in Play Framework project

My method in my Application-class shows an error in IntelliJ that isn't an error. The method works fine in my browser and as you know (if you're familiar with Play) compile-errors will show in your browser when you run the program. My method works just as planned, but the error-indication in the IDE won't go away.

If you use Eclipse (Scala IDE) you just run the activator eclipse command in the command-line and the IDE won't complain anymore - is there a similar fix for IntelliJ?

Edit: I use Play 2.4, so the activator idea command doesn't work either: Play Framework 2.4 and IntelliJ Idea

Edit 2: Not a duplicate of IntelliJ Ultimate can't find routes in Play 2.3 (Java) project tests because that one is about the IDE not finding routes, and mine is about wrong error-indication with different solutions to different problems. For the correct solution see the accepted answer.

-------------Problems Reply------------

IDEA 14.1.3 doesn't set the classpath correctly when importing a Play 2.4 application. By default target folder is excluded from the classpath. However the twirl templates and routes are compiled to the target folder and need to be available to the classpath.

To fix the issue

  1. Make sure your classes and templates are compiled: Build > Make
  2. Open File > Project Structure
  3. Go to Modules menu and select the root module
  4. Go to the Sources tab
  5. Remove the target folder from the excludes by clicking on the X next to it in the right panel
  6. Click Apply

You can then see that target\scala-2.11\routes\main and target\scala-2.11\twirl\main are recognized as source folders properly.

Your error should then go away.

Category:eclipse Views:0 Time:2019-01-11

Related post

  • How to access a resource file using relative path in play framework project? 2011-06-21

    My play framework project uses resource files like CSV files that I have under resources directory which I created under play project root directly so it is at the same level as other directories like app, public etc. From within Java or Scala files

  • Error.invalid overwritten message in play framework 2015-01-26

    I'm working on a java Play Framework 2.2.3 project and i put some constraints on variables like that : @Constraints.Required(message = "Field required") public float prix; The only problem I have is that I've got an "error.invalid" (because it is a n

  • Where to put dependent jars in its own folder in play framework project? 2011-06-10

    I have a situation where I need to place very large number of jars coming from different third party sources under lib folder of play framework and that should work. But it would be much better if I can create subfolders under project_root/lib folder

  • JPA error with oneToMany relation in play framework 2012-02-12

    I'm using play-1.2.3. I have two classes some kind of these: LabelItem: @Entity @Table(name="T_LABEL_ITEM") public class LabelItem extends Model{ @OneToMany(mappedBy="labelItem") public List<LabelValue> labelValues; } LabelValue: @Entity @Table

  • Download third party source code in Play Framework project through IntelliJ 2012-04-20

    See attachement, how can I make IntelliJ download the source code from Maven in a Play Project? I know Play 2.0 uses sbt, but as I have understood sbt also uses the Maven repository infrastructure. --------------Solutions------------- I guess you nee

  • Failure to run Play Framework project from Eclipse, after "eclipsify" 2012-01-10

    I created a small Play project. Initially, I was able to load it in Eclipse (using play eclipsify...), and run the app from Eclipse. After few cycles of development (made outside Eclipse), I made an attempt to get back to Eclipse - and failed. After

  • What is the preferable location for putting java libraries in play framework project? 2013-05-15

    I have a source code of some java library, so what is the preferable way of using it? Where should I put it? Should I jar it? Or compile it? Or go ahead and use it as is? --------------Solutions------------- It depends on many factors, are there more

  • Unexplainable ClassCastException thrown in Play Framework 2011-12-10

    I've been experiencing a strange error while working on my Play Framework project. While my project is running, I will sometimes receive a ClassCastException, but the error is this: ClassCastException occured : models.Person cannot be cast to models.

  • Sending emails from local host - Play Framework 2011-08-21

    Does anybody know the smtp settings that need to be applied within the application.conf file of a Play Framework project for sending emails on localhost? During my unit testing I am getting the error: A play.exceptions.MailException has been caught,

  • parameter validation with net.sf.oval (in play framework) 2011-12-19

    I would love to use the @NotNull annotation (or @Required or anything) for my own methods. While this works quite well in Controller and Model classes I cant get it to work in my own. This probably is more of a net.sf.oval question then play framewor

  • Zend Framework project some pages are showing application error for docrine queries on webhost but works fine on localhost 2012-03-21

    My zend framework project is works nicely on localhost but when i upload it to the webspace some pages are working fine but some of them are showing application errors. this is my first Zend framework Project. I am using Doctrine Model classes for ac

  • Using external URL in Play framework script tag 2014-09-19

    How can I refer to external urls from the script tag in my view? I have a view html file in my Play framework project and I want to refer to some external urls for the javascript part. Here is what I have! <div id=”twitter_update_list”> <scr

  • Play Framework replying not modified when static assets are changed 2015-01-14

    I moved a Play Framework Project to a new PC and everything is working fine but there is one annoying problem: All static assets return the 304: Not Modified header even after I edit them. And I think I found the origin of the problem, play framework

  • Where to put service classes in Play Framework? 2011-06-09

    In Grails we have service classes that contain business logic that is called from controllers. Where do I put service classes in Play Framework project? And if I define methods in controller that are not request actions but utility methods such as in

  • Should I use MongoDb module or morphia module or Casbah in play framework for MongoDb? 2011-06-25

    I am working on a play framework project with scala in which I want to have Scala domain classes (or even Java domain classes) using MongoDb as data store. I want maximum performance while serving hundreds of thousands if not millions of requests per

  • Play framework scala Intellij IDE action not found 2011-09-02

    I'm trying to setup basic play scala application with Intellij IDE (v 10.5.1). I followed the instructions When I start the application from the IDE everything is OK: 01:

  • Java out of memory errors on large WSDLs (play framework) 2012-03-09

    We've got a problem when trying to generate and use a really large proxy file (For the record, it's from a MSCRM Dynamics WSDL). Before I get to the issue: we already have this working in a stand alone app using NetBeans. We generated all the proxy f

  • Errors in Eclipse for Scala project generated by Play Framework 2011-05-30

    I would like to use Eclipse as IDE for a Scala web application using Play Framework. I downloaded Eclipse 3.6.2. Then I installed Scala IDE 2.0 (beta) for Eclipse. I downloaded Play Framework 1.2.2RC1 and installed the Scala Module using play install

  • REST URL error handling using the Play framework 2011-06-07

    Currently when I (or more importantly, a user) type in one of my rest functions into the URL, it works, with the 200 status code. But if you type a wrong one or mispell it, a 404 page is generated, with a 404 status code when looking at it through a

  • How to get Scala imports working in IntelliJ IDEA with the Play framework? 2011-06-18

    I'm using the Scala plugin for IDEA and normally, it works (almost) perfectly. However, it seems to have problem with the import statements for the Play framework: I often get the error "Cannot resolve symbol x". Now that doesn't stop the program fro

  • Play framework test error 2011-10-24

    While trying to execute the tests on my project in play framework ? getting error : Not found GET /@tests *These routes have been tried, in this order : GET /@documentation/cheatsheet/{category} PlayDocumentation.cheatSheet GET /@documentation/module

  • Play Framework error and changes are useless 2011-10-26

    i just playing java with Play Framework tonight, it is easy and then i get this error: i have changed the script and refreshing the website but there's no changes. --------------Solutions------------- The error is very well

  • Cannot run individual test case for play framework in Intellij Idea 2011-11-28

    When I try to run individual test case in a test class using Intellij Idea, It runs all the test cases in the class. I think this is due to superclass UnitTest. Is there any work around? How do I solve this problem? I guess this problem is unique to

  • Play framework. receive "A JPA error occurred" 2012-01-22

    I am new to play framework. tried to follow the tutorial when i added the following user class (as instructed in tutorial) package models; import java.util.*; import javax.persistence.*; import

  • Error in character encoding in "Hello World" application of Play Framework 2.0 2012-03-15

    I'm learning about Play Framework. So I decided to start with this tutorial. After creating the first application and trying to see it in localhost:9000. I receive an error. In Google Chrome when I try to open the page, the tab closes immediatly and

Copyright (C), All Rights Reserved.

processed in 0.214 (s). 11 q(s)