Skip to content
Latchkey

Maven deploy:deploy-file "Repository ... not specified" in CI

deploy:deploy-file uploads an arbitrary file and takes its target from the command line, not the POM. Without -Durl (and a -DrepositoryId matching a <server> in settings.xml for auth), the goal cannot upload.

What this error means

The goal fails with "The parameters 'url' for goal ...:deploy-file are missing or invalid", or it reaches the server and gets 401 because no matching <server> supplied credentials.

mvn output
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file (default-cli) on project app:
The parameters 'url' for goal org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file
are missing or invalid -> [Help 1]

Common causes

Missing -Durl or -DrepositoryId

The goal has no POM-based target, so omitting the URL or repository id leaves it with nowhere to deploy.

No matching <server> for credentials

The -DrepositoryId does not match any <server><id> in settings.xml, so authenticated uploads fail with 401.

How to fix it

Pass url, repositoryId, and coordinates

Supply every parameter the goal needs, with a repositoryId that matches a server in settings.xml.

Terminal
mvn -B deploy:deploy-file \
  -Dfile=target/app-1.0.0.jar \
  -DgroupId=com.example -DartifactId=app -Dversion=1.0.0 -Dpackaging=jar \
  -Durl=https://nexus.example.com/repository/maven-releases/ \
  -DrepositoryId=nexus

Define the matching server with credentials

Add a <server> whose id equals the repositoryId so auth is supplied.

~/.m2/settings.xml
<server>
  <id>nexus</id>
  <username>${env.NEXUS_USER}</username>
  <password>${env.NEXUS_TOKEN}</password>
</server>

How to prevent it

  • Always pass -Durl and -DrepositoryId to deploy-file.
  • Keep the repositoryId aligned with a settings.xml <server>.
  • Inject credentials via CI secrets, not committed files.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →