Simon
Simon

Reputation: 13283

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.

Upvotes: 5

Views: 2468

Answers (3)

Robert de W
Robert de W

Reputation: 306

In Eclipse, Properties on your project: Java Build Path > Project "Required project on the build path" > Add?

Upvotes: 0

kheraud
kheraud

Reputation: 5288

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.

Upvotes: 4

Linh Nguyen
Linh Nguyen

Reputation: 659

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/

Upvotes: 3

Related Questions