How to share application.conf file between subprojects?
Asked Answered
E

2

6

I'm using Play Framework 2.2.1 and have a project named "management" with one subproject named "security" (I used the tutorial located here ). Here's my project structure:

management
  + app
     + controllers
     + models
     + views
  + conf
     + application.conf
  + modules
     + security
         + app
            + controllers
            + models
            + views
         + test
            + models
               + ModelsTest.java
           build.sbt
  + test
      + models
          + ModelsTest.java
    build.sbt

When I run the test command, Play returned me with this error: javax.persistence.PersistenceException: The default EbeanServer has not been defined? This is normally set via the ebean.datasource.default property. Otherwise it should be registered programatically via registerServer()

If I add the application.conf file inside the security/conf directory, it works. How can I do to make the sub-project works with the root application.conf file?

Edessa answered 3/3, 2014 at 12:34 Comment(0)
D
2

In your management/modules/security/build.sbt, add the line: unmanagedResourceDirectories in Test += baseDirectory.value / ".." / ".." / "conf"

Draw answered 12/2, 2018 at 1:46 Comment(0)
A
1

I think that you should configure the sub-project to share the unmanaged source directory with the parent one. This is usually done in sbt by adding something like the following:

unmanagedResourceDirectories in Test <+= file("...") // Put here the path to the parent project resources folder

If you have both projects defined in the same sbt file you can also say something like:

unmanagedResourceDirectories in Test <++= (unmanagedResourceDirectories in Test in parentProject)

The Test bit is a way to scope a setting by configuration axis; this page will tell you something more about that. I think this should put you on the right path, if you are still stuck please share your build.sbt files to help with a better solution.

Auditory answered 6/3, 2014 at 12:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.