Nexus "Content is not allowed in prolog" (HTML instead of artifact) in CI
Maven expected XML (a pom or metadata) but received HTML, so its parser fails at the first character with "Content is not allowed in prolog". Nexus (or a proxy in front of it) served a login/redirect/error page instead of the artifact.
What this error means
A resolve or deploy step fails parsing metadata with "org.xml.sax.SAXParseException ... Content is not allowed in prolog" for a Nexus URL that returns an HTML page.
[ERROR] Could not parse ... maven-metadata.xml:
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1;
Content is not allowed in prolog.Common causes
The URL is wrong and returns an HTML page
A missing /repository/ segment or wrong context path hits a Nexus UI/error page (HTML), which is not valid XML.
A reverse proxy redirect or auth wall
An SSO/login redirect or proxy error page is returned as HTML for the artifact URL, breaking XML parsing.
How to fix it
Verify the URL returns XML, not HTML
- curl the metadata URL and confirm the body starts with
<?xml, not<!DOCTYPE html>. - Fix the repository URL / context path so it resolves to the artifact.
- Ensure any proxy passes through without injecting a login page.
curl -sI -u "$NEXUS_USERNAME:$NEXUS_PASSWORD" \
https://nexus.example.com/repository/maven-public/com/example/lib/maven-metadata.xml
# expect Content-Type: application/xml, not text/htmlCorrect the reverse-proxy routing
Make sure the proxy forwards the /repository/ path to Nexus without redirecting to an SSO/login page for machine clients.
How to prevent it
- Copy repository URLs from Nexus and keep the /repository/ path.
- Exclude the Nexus content paths from SSO/login redirects.
- Probe URLs return XML content type before wiring builds.