Play! 2.0 framework multi Module project

后端 未结 3 1421
情书的邮戳
情书的邮戳 2021-01-06 20:55

I would need to have two different projects, let\'s say internal and external, which use the same data layer, and I would like to avoid replicating the configuration file fo

3条回答
  •  南方客
    南方客 (楼主)
    2021-01-06 21:24

    We are using submodules like this (where "core" is the shared submodule):

    Build.scala

    val coreModule = PlayProject(appName + "-core", "1.0", appDependencies, path = file("modules") / "core")
    
    val main = PlayProject(appName + "-app", appVersion, appDependencies, mainLang = SCALA).settings(
      // Add your own project settings here      
    ).dependsOn(coreModule).aggregate(coreModule)
    

    Unfortunatelly submodules have to live under the project tree ("../core" as path isn't possible) - so we are using git submodules to get the shared module into the tree:

    git submodule add git://git.example.com/modules.git modules
    
    git submodule init
    
    git submodule update
    

    Propably SVN externals, mercurial submodules etc. will do this job too.

提交回复
热议问题