2016-07-23 15 views
7

Trong khi phát triển một maven cắm lỗi build in:maven-plugin-plugin: mục tiêu mô tả thất bại tại và các tập tin

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor (default-descriptor) on project default-method-demo: Execution default-descriptor of goal org.apache.maven.plugins:maven-plugin-plugin:3.3:descriptor failed: syntax error @[8,1] in file:/full/path/to/project/default-method/src/main/java/org/example/Iface.java -> [Help 1] 

dù rằng file Iface.java là compilable.

Iface.java:

package org.example; 

public interface Iface { 
    default String getString() { 
     return "string"; 
    } 
} 

từ pom.xml

<packaging>maven-plugin</packaging> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>3.3</version> 
      <configuration> 
       <source>1.8</source> 
       <target>1.8</target> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

<dependencies> 
    <dependency> 
     <groupId>org.apache.maven</groupId> 
     <artifactId>maven-plugin-api</artifactId> 
     <version>3.0.5</version> 
    </dependency> 
    <dependency> 
     <groupId>org.apache.maven.plugin-tools</groupId> 
     <artifactId>maven-plugin-annotations</artifactId> 
     <version>3.4</version> 
     <scope>provided</scope> 
    </dependency> 
</dependencies> 

gì gây ra vấn đề? Làm thế nào nó có thể được cố định?

Trả lời

13

Vấn đề là maven-plugin-plugin tạo trình mô tả plugin gặp khó khăn khi phân tích cú pháp giao diện Java 8 bằng các phương thức mặc định.

Nó có thể được cố định bằng cách nói một cách rõ ràng phiên bản plugin mới hơn trong pom.xml:

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-plugin-plugin</artifactId> 
      <version>3.4</version> 
     </plugin> 
     <!-- other plugins --> 
    </plugins> 
</build> 

Hoặc chỉ bằng cách tránh các phương pháp mặc định bằng cách di chuyển cơ thể họ đến các lớp học thực hiện.

Lỗi liên quan: MPLUGIN-272

Các vấn đề liên quan