Maven warns that a plugin's localRepository parameter is deprecated
Fix it fast
Most common cause, 1 of 3An older release of one plugin still asks Maven for ${localRepository}
Set an explicit, newer version for the plugin the report named, in build/plugins or build/pluginManagement.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.example.plugins</groupId>
<artifactId>example-maven-plugin</artifactId>
<version>NEWER-VERSION-FROM-THE-REPORT</version>
</plugin>
</plugins>
</pluginManagement>
</build>Short answer
Parameter 'localRepository' is deprecated core expression comes from Maven's plugin validation (3.9 and later). Some plugin you run still injects ${localRepository} as an ArtifactRepository. Your POM is fine. Run the build with -Dmaven.plugin.validation=verbose to name the plugin, upgrade it, and exclude it if no fixed release exists. Applies to Maven 3.9.x and 3.10.x.
Which cause do you have?
Run your usual goal once with the most detailed validation report. At the end of the build Maven lists every plugin by groupId:artifactId:version, where it is declared, and which goal carries the localRepository parameter.
mvn -Dmaven.plugin.validation=verbose packageThen find the line you see in this list and open its fix:
- 1An older release of one plugin still asks Maven for ${localRepository}
The verbose report names a plugin version, and versions:display-plugin-updates offers a newer release of that same plugin - 2Even the newest release of a third-party plugin still uses the old API
display-plugin-updates shows no newer version for the plugin the report names, yet the warning stays - 3Maven 3.9.1 or 3.9.2, or a raised report level, prints every external issue
mvn -v prints 3.9.1 or 3.9.2, or .mvn/maven.config, MAVEN_ARGS, MAVEN_OPTS or settings.xml sets maven.plugin.validation
What does the error look like?
[WARNING] Plugin validation issues were detected in x plugin(s)Parameter 'localRepository' is deprecated core expression; Avoid use of ArtifactRepository type. If you need access to local repository, switch to '${repositorySystemSession}' expression and get LRM from it instead.Parameter 'localRepository' is deprecated core expression; ArtifactRepository type is deprecated and its use in Mojos should be avoided.Parameter 'localRepository' uses deprecated parameter expression '${localRepository}': ArtifactRepository type is deprecated and its use in Mojos should be avoided.
Cause 1 of 3
An older release of one plugin still asks Maven for ${localRepository}
You seeThe verbose report names a plugin version, and versions:display-plugin-updates offers a newer release of that same plugin
Check
The localRepository warning means a plugin goal declares an ArtifactRepository parameter whose default value is ${localRepository} or ${session.localRepository}. Maven core files that under external issues: the plugin's own code, not your configuration. For external issues, Maven's validation guide says to try a newer release of the plugin first.
mvn org.codehaus.mojo:versions-maven-plugin:2.25.2:display-plugin-updatesFix
Set an explicit, newer version for the plugin the report named, in build/plugins or build/pluginManagement. Do it for one plugin at a time so a breaking change is easy to spot.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.example.plugins</groupId>
<artifactId>example-maven-plugin</artifactId>
<version>NEWER-VERSION-FROM-THE-REPORT</version>
</plugin>
</plugins>
</pluginManagement>
</build>Verify
Repeat the verbose build. The upgraded plugin is gone from the list at the end, and the build result is unchanged.
mvn -Dmaven.plugin.validation=verbose packageConfirmed by maven.apache.org
Cause 2 of 3
Even the newest release of a third-party plugin still uses the old API
You seedisplay-plugin-updates shows no newer version for the plugin the report names, yet the warning stays
Check
External issues can only be fixed by whoever maintains the plugin. When you already run the latest release, nothing in your POM can make the parameter go away. Report it to the plugin's issue tracker and keep the build quiet until a fixed release ships.
mvn -Dmaven.plugin.validation=verbose package 2>&1 | grep -A6 "localRepository"Fix
List that exact plugin coordinate in maven.plugin.validation.excludes. The property is ignored in pom.xml, so put it in .mvn/maven.config next to the project, where every developer and the CI job pick it up.
mkdir -p .mvn
echo "-Dmaven.plugin.validation.excludes=org.example.plugins:example-maven-plugin:1.2.3" >> .mvn/maven.configVerify
A normal build no longer reports that plugin, while issues in any other plugin still show up.
mvn -Dmaven.plugin.validation=summary packageConfirmed by maven.apache.org
Cause 3 of 3
Maven 3.9.1 or 3.9.2, or a raised report level, prints every external issue
You seemvn -v prints 3.9.1 or 3.9.2, or .mvn/maven.config, MAVEN_ARGS, MAVEN_OPTS or settings.xml sets maven.plugin.validation
Check
The wording with Avoid use of ArtifactRepository type is Maven 3.9.1's text, and 3.9.2 reported all collected plugin issues at the end of each build by default. In 3.9.16 and 3.10.1 the default level is INLINE, which prints only problems in your own configuration. External plugin issues appear there only when BRIEF, SUMMARY or VERBOSE is switched on somewhere.
mvn -v
cat .mvn/maven.config 2>/dev/null
echo "$MAVEN_ARGS $MAVEN_OPTS"Fix
Move the project to a current Maven, most simply through the Maven Wrapper so every machine uses the same release. Remove any maven.plugin.validation level you no longer need from the places listed in the signal.
mvn wrapper:wrapper -Dmaven=3.10.1
./mvnw -vVerify
./mvnw -v prints 3.10.1 and an ordinary build ends without the plugin validation block.
./mvnw packageConfirmed by raw.githubusercontent.com
How do I stop it coming back?
- Pin every build plugin version in pluginManagement, so a plugin upgrade is a reviewed one-line change and not a surprise.
- Commit the Maven Wrapper with a fixed distributionUrl, so CI and laptops run the same Maven release.
- Run display-plugin-updates in a scheduled CI job and open a ticket when a plugin you use gets a new release.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.