2014-09-18 17 views
11

tôi không thể xây dựng ứng dụng web maven java của tôi, bởi vì trong hai lỗi sau đây:Maven Lỗi dự án: Diamond điều hành/multicatch không được hỗ trợ trong -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) 

Tôi bối rối, vì tôi sử dụng java 1.8.0 cho dự án của tôi, tôi không bao giờ có thực sự sử dụng 1,5

enter image description here

enter image description here

Điều gì có thể gây ra vấn đề này một nd làm thế nào để tôi giải quyết nó?

Tôi cố gắng để xây dựng nó sau khi thêm dòng follwing trong pom.xml, nhưng không có succes:

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

Trả lời

15

Cố gắng tuyên bố maven-compiler-plugin trong pom của bạn.

  <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

Có công trình này, nhưng bây giờ tôi có một tải trọng của các lỗi khác tôi phải giải quyết; ( – MeesterPatat

0

Bạn cũng có thể thêm nó theo cách này cũng bằng cách bao gồm này trong pom.xml của bạn

<properties> 
    <maven.compiler.source>1.7</maven.compiler.source> 
    <maven.compiler.target>1.7</maven.compiler.target> 
</properties> 
Các vấn đề liên quan