Adding more source folders to a play framework project
Asked Answered
T

3

5

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.

Tactical answered 10/5, 2012 at 12:23 Comment(0)
E
4

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.

Engle answered 15/5, 2012 at 11:48 Comment(0)
C
3

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/

Chortle answered 14/5, 2012 at 4:13 Comment(0)
Z
0

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

Zendah answered 20/5, 2012 at 9:31 Comment(1)
Adding to build path only in eclipse wont be recognized by the Play server.Archaeo

© 2022 - 2024 — McMap. All rights reserved.