2014-09-18 13 views
11

desteklenmez:Maven projesi hatası: Elmas/multicatch operatörü çünkü aşağıdaki iki hatalar, benim maven java web uygulaması inşa edemeyiz -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) 

i kullanmak çünkü kafam karıştı Projem için java 1.8.0 i aslında bu sorunun a neden olabilecek ne 1.5

enter image description here

enter image description here

kullandık asla Bunu nasıl çözebilirim?

ben pom.xml'Bu follwing satırları ekledikten sonra inşa etmeye çalıştı, ancak başarıya olmadan:

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

cevap

15

senin pom içinde maven-compiler-plugin ilan deneyin.

  <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

Evet bu işleri sizin pom.xml'Bu dahil ederek de bu şekilde ekleyebilirsiniz, ama şimdi ben çözmek zorunda diğer hatalar bir yük var; ( – MeesterPatat

0

Ayrıca

<properties> 
    <maven.compiler.source>1.7</maven.compiler.source> 
    <maven.compiler.target>1.7</maven.compiler.target> 
</properties> 
İlgili konular