maven-plugin-plugin:3.2:descriptor failed: Index 22273 out of bounds for length 88
Asked Answered
C

5

17

Jdk : JAVA 11

Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor (default-descriptor) on project buildtools: Execution default-descriptor of goal 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>
Counterpunch answered 26/3, 2020 at 5:30 Comment(1)
Keep the maven-plugin-annotation and maven-plugin-plugin with the same version furthermore which Maven version do you use? Furthermore you you keep maven-artifact, maven-project, maven-core and maven-plugin-api having the same version. Do you have an example project on Github?Johore
K
16

On my side, I solved it in java 11 by adding:

  <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>
Katiakatie answered 10/4, 2020 at 12:10 Comment(0)
N
11

For JDK11 (JDK8 respectively) support there is a bug in version 3.0,3.1,3.2. You must use 3.3 or later:

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.3</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
Nomadize answered 15/7, 2020 at 12:43 Comment(3)
This solved the issue for me when using JDK 8 and using lambdas in my code - just adding this plugin. I followed tutorials for a "hello world" plugin, none mentioned this plugin at all...Cranford
As of 2022, version 3.6.4 is working like a charmSchram
version 3.6.4 works with JDK 8 and JDK 11. Tested with Kotlin 1.7.21Bookstand
S
1

I got the same problem and fixed it by not definig a newer Java Release but using Java 8:

<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
Sagittate answered 3/4, 2020 at 17:59 Comment(0)
C
0

The combination that worked for me was:

<properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-plugin-api</artifactId>
        <version>3.6.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.maven</groupId>
        <artifactId>maven-core</artifactId>
        <version>3.6.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.maven.plugin-tools</groupId>
        <artifactId>maven-plugin-annotations</artifactId>
        <version>3.5</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.6.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.8.2</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.6.2</version>
                <configuration>
                    <release>${maven.compiler.target}</release>
                    <encoding>UTF-8</encoding>
                    <verbose>true</verbose>
                    <fork>true</fork>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
Clymer answered 31/10, 2023 at 17:15 Comment(0)
N
0

Consider updating your Maven version. (ie install a newer version of maven). Older versions of maven break with exactly this error:

Index XXXX out of bounds for length YYYY

when Java/JDK is upgraded.

Nogging answered 21/3 at 9:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.