Gurjar Manahar
Gurjar Manahar

Reputation: 181

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

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>

Upvotes: 17

Views: 11918

Answers (5)

hawkeye
hawkeye

Reputation: 35752

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.

Upvotes: 0

nichole
nichole

Reputation: 131

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>

Upvotes: 0

Grim
Grim

Reputation: 2030

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>

Upvotes: 11

Silleto
Silleto

Reputation: 161

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>

Upvotes: 16

Itchy
Itchy

Reputation: 2434

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>

Upvotes: 1

Related Questions