문제

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?

올바른 솔루션이 없습니다

다른 팁

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

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top