`nexus-staging-maven-plugin` gives `Nexus connection problem to URL {...}: 404 - Not Found`

I’m trying to reproduce the behaviour of nexus-staging-maven-plugin with a local Nexus instance, but I’m getting a weird error I can’t understand when trying a deploy:

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy (injected-nexus-deploy) on project deploytest: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.13:deploy failed: Nexus connection problem to URL [http://localhost:8081 ]: 404 - Not Found → [Help 1]

I’ve tried running Nexus both locally and via Docker, and on both Windows and MacOS, and I can access the Nexus instance via a browser.

I’m guessing I’ve got the URL wrong but I don’t see how.

Reproducible example:

  • pom.xml:
    <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-.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.me</groupId>
     <artifactId>deploytest</artifactId>
     <version>0.0.1</version>
     <build>
     	<plugins>
     		<plugin>
     			<groupId>org.sonatype.plugins</groupId>
     			<artifactId>nexus-staging-maven-plugin</artifactId>
     			<version>1.6.13</version>
     			<extensions>true</extensions>
     			<configuration>
     				<serverId>my-repo</serverId>
     				<nexusUrl>http://localhost:8081</nexusUrl>
     			</configuration>
     		</plugin>
     	</plugins>
     </build>
    </project>
    
  • settings.xml:
    <settings>
     <servers>
     	<server>
     		<id>my-repo</id>
     		<username>admin</username>
     		<password>password</password>
     	</server>
     </servers>
    </settings>
    
  • Nexus run via docker run -d -p 8081:8081 --name nexus sonatype/nexus3
  • Deploy via mvn clean deploy

Are you a Nexus Pro customer using Nexus 2.x?