【问题标题】:maven-plugin-plugin:3.2:descriptor failed: Index 22273 out of bounds for length 88maven-plugin-plugin:3.2:descriptor failed: Index 22273 out of bounds for length 88
【发布时间】:2020-07-06 17:53:01
【问题描述】:

JDK : JAVA 11

未能在项目构建工具上执行目标 org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor):执行目标 org.apache.maven.plugins:maven-plugin 的默认描述符-plugin:3.2:descriptor failed: Index 22273 out of bounds for length 88 -> [Help 1]

<artifactId>buildtools</artifactId>
<packaging>maven-plugin</packaging>
<name>MYPojo</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<executions>
<execution>
<id>mojo-descriptor</id>
<phase>process-classes</phase>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>


<!-- for maven plugin -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.6.3</version>
</dependency>
<!-- dependencies to annotations -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>3.0-alpha-2</version>
</dependency>

【问题讨论】:

  • 保持 maven-plugin-annotation 和 maven-plugin-plugin 的版本相同,而且你使用哪个 Maven 版本?此外,您保持 maven-artifact、maven-project、maven-core 和 maven-plugin-api 具有相同的版本。你有 Github 上的示例项目吗?

标签: java maven maven-plugin java-11


【解决方案1】:

在我这边,我在 java 11 中通过添加:

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-plugin-plugin</artifactId>
    <version>3.6.0</version>
    <executions>
      <execution>
        <id>default-descriptor</id>
        <phase>process-classes</phase>
      </execution>
      <!-- if you want to generate help goal -->
      <execution>
        <id>help-goal</id>
        <goals>
          <goal>helpmojo</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

【讨论】:

    【解决方案2】:

    我遇到了同样的问题并通过不定义较新的 Java 版本而是使用 Java 8 来解决它:

    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    

    【讨论】:

      【解决方案3】:

      对于 JDK11 支持,版本 3.0、3.1、3.2 中有一个错误。您必须使用 3.3 或更高版本:

      <build>
          <pluginManagement>
              <plugins>
                  <plugin>
                      <artifactId>maven-plugin-plugin</artifactId>
                      <version>3.3</version>
                  </plugin>
              </plugins>
          </pluginManagement>
      </build>
      

      【讨论】:

        猜你喜欢
        • 2015-11-19
        • 1970-01-01
        • 2022-08-17
        • 1970-01-01
        • 1970-01-01
        • 2021-02-03
        • 2021-05-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多