maven-plugin-plugin:描述符目标在文件的和处失败
maven-plugin-plugin:descriptor goal fails at the and of file
开发 Maven 插件时构建打印错误:
[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]
尽管文件 Iface.java
是可编译的。
Iface.java
:
package org.example;
public interface Iface {
default String getString() {
return "string";
}
}
来自 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>
导致问题的原因是什么?如何解决?
问题是 maven-plugin-plugin
生成插件描述符难以解析 Java 8 个具有默认方法的接口。
可以通过在 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>
或者只是通过移动他们的身体来实现 类.
来避免默认方法
相关错误:MPLUGIN-272
开发 Maven 插件时构建打印错误:
[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]
尽管文件 Iface.java
是可编译的。
Iface.java
:
package org.example;
public interface Iface {
default String getString() {
return "string";
}
}
来自 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>
导致问题的原因是什么?如何解决?
问题是 maven-plugin-plugin
生成插件描述符难以解析 Java 8 个具有默认方法的接口。
可以通过在 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>
或者只是通过移动他们的身体来实现 类.
来避免默认方法相关错误:MPLUGIN-272