2016-06-08 8 views
0

프로젝트의 동일한 폴더에 java 및 scala 파일의 코드베이스가 있습니다 (총 5 개의 파일). 몇개의 자바 파일은 하나의 scala 파일로 정의 된 클래스를 참조합니다. 필자는 scala-maven-plugin (v3.2.2)을 사용하여 소스를 컴파일합니다. 최신 mvn-compiler-plugin (v3.5.1)을 사용하려고 할 때 scala 컴파일러가 먼저 실행되고 모든 파일 (java 및 scala 모두)을 컴파일하더라도 나중에 maven-compiler-plugin이 실행되어 java를 컴파일하려고 시도합니다 파일 만, 스. 라 파일에 정의 된 오브젝트의 경우 : 기호를 찾을 수 없음 - 메시지와 함 2 실패합니다.Maven 컴파일러 플러그인이 혼합 된 (자바 - 스칼라) 코드베이스에 대한 심볼을 찾지 못했습니다.

다음은 일부 출력입니다.

[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ GraphDB --- 
[INFO] Deleting /home/xx/GraphDB 
[INFO] 
[INFO] --- scala-maven-plugin:3.2.2:compile (default-cli) @ GraphDB --- 
[INFO] /media/xx/GraphDB/src/main/java:-1: info: compiling 
[INFO] Compiling 5 source files to /home/xx/GraphDB/classes at 1465363494733 
[INFO] prepare-compile in 0 s 
[INFO] compile in 4 s 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ GraphDB --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 1 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) @ GraphDB --- 
[INFO] Changes detected - recompiling the module! 
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent! 
[INFO] Compiling 3 source files to /home/xx/GraphDB/classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] /media/xx/GraphDB/src/GraphTest.java:[23,30] cannot find symbol 
    symbol: variable TitanGraphProvider 
    location: class com.ilabs.dsi.titan.GraphTest 
[ERROR] /media/xx/GraphDB/src/AddStatic.java:[229,24] cannot find symbol 
    symbol: variable TitanGraphProvider 
    location: class com.ilabs.dsi.titan.AddStatic 

"TitanGraphProvider"기호는 스칼라 파일에 있습니다.

이렇게하려면 "mvn clean scala : compile package"명령을 사용하고 있습니다. 나는 명령을 "mvn clean scala : compile"과 "mvn package"로 나누면 첫 번째 명령은 통과하지만 두 번째 명령은 같은 단계에서 같은 오류로 실패합니다. 나중의 자바 컴파일 단계가 패키지 단계에서 시작되는 것처럼 보입니다.

이 유형의 시나리오에서 mvn 패키지를 얻는 올바른 방법은 무엇입니까?

편집 : 완전한 시나리오를 제공하지 않은 것처럼 보입니다. 데비안을 실행하는 Virtualbox VM의 공유 폴더에서 코드베이스를 컴파일하려고 시도하고 있으며 기본 파일 시스템은 Windows (10)입니다. VM에서 비공유 위치로 폴더를 옮겼을 때 문제가 없었습니다. 내가 데비안을 실행하는 버추얼 VM의 공유 폴더에서 코드베이스를 컴파일하려고했다

   <plugin> 
        <groupId>net.alchim31.maven</groupId> 
        <artifactId>scala-maven-plugin</artifactId> 
        <version>${scala-maven-plugin.version}</version> 
        <executions> 
         <execution> 
          <id>scala-compile-first</id> 
          <phase>process-resources</phase> 
          <goals> 
           <goal>add-source</goal> 
           <goal>compile</goal> 
          </goals> 
         </execution> 

         <execution> 
          <phase>compile</phase> 
          <goals> 
           <goal>compile</goal> 
           <goal>testCompile</goal> 
          </goals> 
         </execution> 
        </executions> 
        <configuration> 
         <scalaVersion>${scala.version}</scalaVersion> 
        </configuration> 
       </plugin> 

답변

0

및 기본 파일 시스템은 윈도우 (10)이었다

0

당신이해야합니다. VM에서 비공유 위치로 폴더를 옮겼을 때 문제가 없었습니다.

그러나 모든 스칼라 파일로 구성된 프로젝트를 컴파일하는 동안 위의 설정에 아무런 문제가 없었습니다. 무엇을 줄지는 모르지만, 적어도 이것이 위의 문제에 대한 해결책입니다. 희망이 사람을 도움이됩니다.

+0

안녕하세요. 나는 이미 동일한 플러그인을 가지고 있었고 두 번째는 블럭 (config 블럭과 함께)이었다. 내 첫 번째 블록을 추가하고 다시 시도했지만 도움이되지 않았습니다. 나는 같은 오류가있다. –