Hi everyone,
I’m trying to delete components in Nexus using the httpRequest
plugin in a Jenkins pipeline. The deletion works — the component gets deleted from Nexus — but I never receive the expected 204 No Content
response. Instead, I encounter an error: groovy.json.internal.LazyMap
.
Below is my code snippet:
def deleteResponse = httpRequest(
url: “${env.NEXUS_URL}/service/rest/v1/components/${componentId}”,
httpMode: ‘DELETE’,
authentication: ‘nexus_credentials’,
customHeaders: [
[name: ‘accept’, value: ‘application/json’],
[name: ‘Content-Type’, value: ‘application/json’]
],
validResponseCodes: ‘100:599’,
responseHandle: ‘NONE’
)
echo “HTTP Response Status: ${deleteResponse.status}”
The pipeline never reaches the echo
line after the httpRequest
call. To test, I wrapped the code in a try-catch
block, which allowed it to proceed, but that’s not how I’d prefer to handle this.
Details:
- Nexus OSS Version: 3.68.1-02
- Repository Format: maven2
Question:
Has anyone experienced a similar issue? If so:
- How did you handle the
httpRequest
response to avoid the error? - Is there a configuration or workaround that ensures proper handling of the
204
response (or no response body)?
Thanks in advance for your help!