2014-10-03 10 views
1

Play 프레임 워크에서 상당히 새로 추가되었지만 기본 프로젝트에 대한 하위 프로젝트 설치를 시도했지만 주 프로젝트의 경로를 하위 프로젝트로 리디렉션하려고 시도했을 때 하위 프로젝트 변수를 인식 할 수 없었습니다. 나는 여기 PlaySubProjectPlay Framework 2.3.4 하위 프로젝트에 대한 경로 재 지정

내 주요 프로젝트 구조는 아래 그림과 같이되어있는 설명서에 따라 따랐다 :

Main 
    app 
    conf 
     application.conf 
     routes 
    modules 
     sub 
     app 
     conf 
      sub.routes 
     build.sbt 
    logs 
    project 
    public 
    target 
    test 
    activator 
    activator-launch-1.2.10.jar 
    build.sbt 

이 내 주 build.sbt 파일입니다

name := """Main""" 

version := "1.0-SNAPSHOT" 

lazy val root = (project in file(".")).enablePlugins(PlayJava).aggregate(sub).dependsOn(sub) 

lazy val sub = (project in file("modules/sub")).enablePlugins(PlayJava) 

scalaVersion := "2.11.1" 

libraryDependencies ++= Seq(
    javaJdbc, 
    javaEbean, 
    cache, 
    javaWs 
) 

내 하위 프로젝트 빌드. sbt는 다음과 같습니다.

name := """Subproject""" 

version := "1.0-SNAPSHOT" 

scalaVersion := "2.11.1" 

libraryDependencies ++= Seq(
    javaJdbc, 
    javaEbean, 
    cache, 
    javaWs 
) 

마지막으로 이것이 내 주요 연구입니다 outes 파일.

# Routes 
# This file defines all application routes (Higher priority routes first) 
# ~~~~ 

# Home page 
GET  /     controllers.Application.index() 

# Map static resources from the /public folder to the /assets URL path 
GET  /assets/*file  controllers.Assets.at(path="/public", file) 

# SUB's 
-> /sub sub.Routes 

문제는 심지어 sub.Routes에서 마지막 줄에 하위 변수를 인식 할 수 없습니다,이 루트 파일에 있습니다. 이 문제를 해결하는 방법?

답변

0

특정 문제에 대해 잘 모르겠지만 충분히 잘 문서화 된 다중 프로젝트 예제를 https://github.com/josh-padnick/play-multiproject-template에 설치했습니다. 이것은 Play 2.2.3 (2.3.x 아님)을 기반으로 합니다만, 필요한 항목에 매우 가깝습니다.

+0

글쎄, 이건 정말 바보 야. . 내 문제는 Play Framework에서 발생하지 않았지만 Intellij IDEA의 빨간색이 sub.Routes에서 강조 표시 한 것과 혼동을 일으켰습니다. 귀하의 템플릿으로, 나는 이것이 사실이라고 생각했습니다. 나는 프로젝트를 실행하고 잘 작동합니다. 나는 그 부분에서 IntelliJ가 강조한 빨간색 텍스트를 무시하면됩니다. 고마워. –

+0

다행히 도왔습니다! –

1

프로젝트 구조가 모든 예제와 동일하지만 documenctations와 routes 파일이 올바른 위치에 있었지만 하위 프로젝트 경로 파일이 주 대상/scala-2.11에 배치되지 않았습니다. 그것은에 포함되는 하위 프로젝트의 conf 디렉토리에 파일을 추가 할 수 SBT 말할 것이다

.... 
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean) 
    .settings(commonSettings: _*) 
    .aggregate(core, providers, zms, api) 
    .dependsOn(core, providers, zms, api) 

lazy val core = (project in file("apps/core")).enablePlugins(PlayJava, PlayEbean) 
    .settings(commonSettings: _*) 
    .settings(
    name := "core" 
) 

lazy val zms = (project in file("apps/zms")).enablePlugins(PlayJava, PlayEbean) 
    .settings(commonSettings: _*) 
    .settings(
    name := "zms" 
) 
    .dependsOn(core) 

lazy val api = (project in file("apps/api")).enablePlugins(PlayJava, PlayEbean) 
    .settings(commonSettings: _*) 
    .settings(
    name := "api" 
) 
    .dependsOn(core) 


//Here are the lines that solved the problem 
unmanagedResourceDirectories in Compile += baseDirectory.value/"apps/core/conf" 
unmanagedResourceDirectories in Compile += baseDirectory.value/"apps/zms/conf" 
unmanagedResourceDirectories in Compile += baseDirectory.value/"apps/api/conf" 

fork in Compile := true 

:/경로와

을 찾을 수 없습니다 나는 build.sbt의 말에 unmanagedResourceDirectories in Compile += baseDirectory.value/"<path_to_project>/conf를 추가하여 해결 메인 프로젝트 classpath