2014-09-18 7 views
11

에서 지원되지 않습니다 :메이븐 프로젝트 오류 : 다이아몬드/multicatch 연산자 때문에 다음과 같은 두 가지 오류로, 내 받는다는 자바 웹 애플리케이션을 구축 할 수 -source 1.5

diamond operator is not supported in -source 1.5 
    (use -source 7 or higher to enable diamond operator) 

multi-catch statement is not supported in -source 1.5 
    (use -source 7 or higher to enable multi-catch statement) 

내가 사용하기 때문에 내가 혼란 스러워요 내 프로젝트에 대한 자바 1.8.0, 내가 실제로이 문제 A를 원인이 될 수 무엇 1.5

enter image description here

enter image description here

을 사용하지 않았을 nd 어떻게 해결합니까?

나는 pom.xml 파일에서 follwing을 줄을 추가 한 후 그것을 만들려고했는데, succes에없는 :

<properties> 
     <sourceJdk>1.8</sourceJdk> 
     <targetJdk>1.8</targetJdk> 
</properties> 

답변

15

당신의 치어의 maven-compiler-plugin를 선언하십시오.

  <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
+0

예이 작품 당신의 pom.xml이를 포함하여도이 방법으로 추가 할 수 있습니다,하지만 지금은 내가 해결해야 할 다른 오류의 부하가 ( – MeesterPatat

0

또한

<properties> 
    <maven.compiler.source>1.7</maven.compiler.source> 
    <maven.compiler.target>1.7</maven.compiler.target> 
</properties>