Assets are already defined as Assets objects

I am doing more advanced tests for the Play Subproject function, as described here: http://www.playframework.com/documentation/2.0/SBTSubProjects . But I get an error message:

Assets is already defined as object Assets 

An example application hosted on github: https://github.com/adis-me/PlayStrap

I defined an Asset controller for my subprojects as described here: Description of the Asset Controller , even for the main project, but the error continues to appear up. What is wrong with my project?

controller

 package com.company.playstrap.controllers; import controllers.AssetsBuilder; public class Assets { public static controllers.AssetsBuilder delegate = new AssetsBuilder(); } 

Route File

 # Routes # This file defines all application routes (Higher priority routes first) # ~~~~ # Home page GET / com.company.playstrap.controllers.Application.index() # Include sub projects -> /common common.Routes -> /admin admin.Routes -> /website website.Routes # Map static resources from the /public folder to the /assets URL path GET /assets/*file com.company.playstrap.controllers.Assets.delegates.at(path="/public", file) 
+6
source share
2 answers

This is a known bug: https://groups.google.com/forum/#!msg/play-framework/2Zk5wjAlIng/Jcec1lt7AzQJ

My workaround for my own administration module:

 package controllers.admin; import controllers.AssetsBuilder; import play.api.mvc.AnyContent; import play.api.mvc.Action; import play.mvc.*; public class Application extends Controller { private static AssetsBuilder delegate = new AssetsBuilder(); public static Action<AnyContent> asset(String path, String file) { return delegate.at(path, file); } } //routes file GET /assets/*file controllers.admin.Application.asset(path="/public", file) 
+5
source

I ran into this problem last week when I tried to write the Assets class as a Java class. I could solve the compilation problem by writing the Assets class in my submodule as a Scala class, as described in the docs: http://www.playframework.com/documentation/2.1.1/SBTSubProjects

Basically, my project structure:

 MyApplication | - app | - conf | - modules | - admin | - app | - controllers | - admin | - Assets.scala | - project | - public 


Contents of Assets.scala :

 package controllers.contabil object Assets extends controllers.AssetsBuilder 


And finally, the contents of my admin.routes file:

 GET /assets/*file controllers.admin.Assets.at(path="/public", file) # Home page GET /index controllers.admin.Application.index() 


Greetings

+1
source

All Articles