2017-12-09 4 views
0

Spark not working with pureconfig에서 가져온 아래 해결책은 sbt에 대한 작업 솔루션 인 것처럼 보이지만 이렇게하기 위해 maven 버전을 찾는 데 어려움이 있습니다. pureconfig 0.8을 spark-2.1을 사용하여 spark-submit을 사용하여 작업하려고했지만 IntelliJ 외부에서 여전히 성가신 Exception in thread "main" java.lang.NoSuchMethodError: shapeless.Witness$.mkWitness(Ljava/lang/Object;)Lshapeless/Witness; 오류가 발생했습니다.Spark 2.1 with Pureconfig 0.8 Maven에 대한 해결 방법

assemblyShadeRules in assembly := Seq(
    ShadeRule.rename("shapeless.**" -> "[email protected]") 
    .inLibrary("com.chuusai" % "shapeless_2.11" % "2.3.2") 
    .inLibrary("com.github.pureconfig" %% "pureconfig" % "0.7.0") 
    .inProject 
) 

제안 된 솔루션을 Spark with Pureconfig - proper maven shade plugin configuration에서 시도했지만 아직 행운이 없습니다.

uber 항아리를 만들었지 만 메이븐 음영이 작동하는 방식을 완전히 이해하지 못하고 추가로 이름이 변경된 항아리를 만들지 않으려면 어떻게해야하는지 최종 구성입니다. 이상적으로는 생성 된 종속성이있는 jar를 다음과 같이 추가 항아리를 만들지 않으려합니다.

<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-shade-plugin</artifactId> 
     <version>3.0.0</version> 
     <executions> 
      <execution> 
       <phase>package</phase> 
       <goals> 
        <goal>shade</goal> 
       </goals> 
      </execution> 
     </executions> 
     <configuration> 
      <createDependencyReducedPom>false</createDependencyReducedPom> 
      <relocations> 
       <relocation> 
        <pattern>shapeless</pattern> 
        <shadedPattern>com.shaded.shapeless</shadedPattern> 
       </relocation> 
      </relocations> 
      <filters> 
       <filter> 
        <artifact>*:*</artifact> 
        <excludes> 
         <exclude>META-INF/*.SF</exclude> 
         <exclude>META-INF/*.DSA</exclude> 
         <exclude>META-INF/*.RSA</exclude> 
        </excludes> 
       </filter> 
      </filters> 
      <finalName>uber-${project.artifactId}-${project.version}</finalName> 
     </configuration> 
    </plugin> 
+0

무명 패키지 이름으로 예외가 발생하면 소스 코드 음영 또는 내부 종속성이 제대로 작동하지 않습니다. 메이븐에 음영 설정을 추가 할 수 있습니까? –

+0

감사합니다. 업데이트 된 질문은 내가 시도한 구성을 추가합니다. – horatio1701d

답변

0

너무 늦게 답변드립니다. 저는이 문제를 일으키는 것이 무엇인지 잘 모릅니다. 나는 0.8.0 (내 0.7.2을 사용하고 있었다)으로 나의 pureconfig 버전을 바꿨고, 모든 것은 여전히 ​​작동하는 것처럼 보인다.

쉬운 일이 아니기 때문에 프로젝트 구성 방법에 대해 더 많은 정보를 얻으려고합니다. 아마도 도움이 될 것입니다. 오, 그리고 btw, 나는 3.3.9을 사용하고 있습니다.하지만 누가 문제인지는 의심 스럽습니다.

그래서 내 프로젝트는 서브 모듈로 구성됩니다. 즉, 최상위 레벨이 <modules></modules> 인 모든 모듈에는 고유 한 pom이 있습니다.

지금, 최상위 POM에, 나는 플러그인 관리뿐만 아니라 의존성 관리를 사용, 그래서 다음과 같다 : 서브 모듈에서 지금

</dependencyManagement> 
    <dependencies> 
    <dependency> 
     <!-- some dependency --> 
    </dependency> 
    </dependencies> 
</dependencyManagement> 

<build> 
    <pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-dependency-plugin</artifactId> 
       <version>3.0.0</version> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-shade-plugin</artifactId> 
       <version>3.0.0</version> 
       <executions> 
        <execution> 
         <phase>package</phase> 
         <goals> 
          <goal>shade</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <createDependencyReducedPom>false</createDependencyReducedPom> 
        <relocations> 
         <relocation> 
          <pattern>shapeless</pattern> 
          <shadedPattern>com.matek.chuusai.shapeless</shadedPattern> 
         </relocation> 
        </relocations> 
       </configuration> 
      </plugin> 
     </plugins> 
    </pluginManagement> 
</build> 

, 종속성을 구성뿐만 아니라 받는다는 그늘 플러그인을 추가

<dependencies> 
     <dependency> 
      <!-- some dependency --> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-shade-plugin</artifactId> 
       <groupId>org.apache.maven.plugins</groupId> 
      </plugin> 
     </plugins> 
    </build> 

프로젝트에 하위 모듈이 있으면이 방법으로 구성하십시오. 희망이 도움이됩니다 (어떻게 든).