Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding more source folders to a play framework project

How can i have multiple source folders in a play project? I am using play 1.2.4 and the eclipse plugin. What I want to do is use a source folder from another project (e.g. a normal java project) in the play project.

The normal way by adding the folder as a source folder via properties->java build path->link source does not work. So where do i have to add the dependencies to tell play what i want? I know that if I want to link a jar file i have to write it in the dependencies.yml file, so can i do the same for a folder full of normal java files?

And is it possible to add a third source folder to a play project, so "1. app 2. test 3. mysoucefolder" for example.

like image 974
Simon Avatar asked May 10 '12 12:05

Simon


People also ask

How do you set content type explicitly on play?

Changing the default Content-Type Will automatically set the Content-Type header to text/plain , while: JsonNode json = Json. toJson(object); Result jsonResult = ok(json); will set the Content-Type header to application/json .

Which property is used to specify supported languages of the play application?

To ensure that languages are resolved correctly, specify the languages your app supports using the resConfigs property in the module-level build.


2 Answers

You can create the package hierarchy you want in app/.

For example :

app/
    controller/
    models/
    views/
    org/
        myproject/
            MyClass.java
conf/
...

MyClass can be accessed in your play project with import org.myproject.MyClass

If what you re trying to do deals with constraints on folders hierarchy, you can give a try to symbolic links.

like image 92
kheraud Avatar answered Oct 15 '22 01:10

kheraud


I think you can achieve that by creating a Play Module with your source folder from another project.

A module in play is actually little more than an organisation of your code base.

You can read more about Play Module here:

http://www.playframework.org/documentation/1.2.4/modules

http://playframework.wordpress.com/2011/02/27/play-modules/

like image 3
Linh Nguyen Avatar answered Oct 15 '22 02:10

Linh Nguyen