Skip to content

Plugin prefix resolution regression in 3.9.12 #11596

@KingBuzzer

Description

@KingBuzzer

Affected version

3.9.12

Bug description

Plugin prefix resolution for spotless-maven-plugin fails with 3.9.12 but works on 3.9.11 and below. It resolves spotless as the avro plugin instead of the spotless plugin. Example:

➜  mvn spotless:apply
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.100 s
[INFO] Finished at: 2025-12-22T10:28:23+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Could not find goal 'apply' in plugin org.apache.avro:avro-maven-plugin:1.11.0 among available goals help, idl-protocol, induce, protocol, schema -> [Help 1]

In 3.9.11 and below we get the correct behaviour:

➜  mvn spotless:apply
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< org.example:plugin-maven >----------------------
[INFO] Building plugin-maven 0.0.1-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- spotless:3.1.0:apply (default-cli) @ plugin-maven ---
[INFO] Spotless.Java is keeping 2 files clean - 0 were changed to be clean, 0 were already clean, 2 were skipped because caching determined they were already clean
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.295 s
[INFO] Finished at: 2025-12-22T10:30:23+01:00
[INFO] ------------------------------------------------------------------------

This happens when using the pom.xml below:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-starter-parent</artifactId>
		<version>4.0.1</version>
		<relativePath/> <!-- lookup parent from repository -->
	</parent>
	<groupId>org.example</groupId>
	<artifactId>plugin-maven</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<name>plugin-maven</name>
	<description>plugin-maven</description>
	<url/>
	<licenses>
		<license/>
	</licenses>
	<developers>
		<developer/>
	</developers>
	<scm>
		<connection/>
		<developerConnection/>
		<tag/>
		<url/>
	</scm>
	<properties>
		<java.version>21</java.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter</artifactId>
		</dependency>
		<dependency>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-test</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.avro</groupId>
				<artifactId>avro-maven-plugin</artifactId>
				<version>1.11.0</version>
				<executions>
					<execution>
						<phase>generate-sources</phase>
						<goals>
							<goal>schema</goal>
							<goal>protocol</goal>
							<goal>idl-protocol</goal>
						</goals>
						<configuration>
							<fieldVisibility>PRIVATE</fieldVisibility>
							<stringType>String</stringType>
							<enableDecimalLogicalType>true</enableDecimalLogicalType>
							<sourceDirectory>target/generated-sources/avro</sourceDirectory>
							<testSourceDirectory>target/generated-test-sources/avro</testSourceDirectory>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>com.diffplug.spotless</groupId>
				<artifactId>spotless-maven-plugin</artifactId>
				<version>3.1.0</version>
				<configuration>
					<java>
						<googleJavaFormat>
							<version>1.17.0</version>
							<style>AOSP</style>
						</googleJavaFormat>
					</java>
				</configuration>
				<executions>
					<execution>
						<goals>
							<goal>check</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>

and this settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
  <mirrors>
    <mirror>
      <id>nexus</id>
      <url>http://our.internal.nexus.host.se/content/groups/public</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
</settings>

When used without settings.xml or a settings.xml without mirror-configuration, the prefix resolution works as before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions