Search code examples
jenkinsjenkins-pipelinejenkins-pluginsnexussonatype

Nexus Jenkins Plugin: how to inject Server URL dynamically


I'm using the Nexus Jenkins Plugin for the uploading artifacts to the Nexus IQ server. It looks like this inside the pipeline code:

sh "curl http://nexus-artifact-server/***/artifact.war --output artifact.war"
nexusPolicyEvaluation failBuildOnNetworkError: false, iqApplication: 'artifact.war', iqScanPatterns:  [[scanPattern: '**/*.war']], iqStage: 'build', jobCredentialsId: ''

nexusPolicyEvaluation is a built-in function of the Nexus Jenkins Plugin which is doing some POST-requests to the IQ Server I think. The actual Server URL is configured inside Jenkins's system configuration i.e. it is hardcoded.

enter image description here

Is there any way to resolve and inject the URL dynamically? In some cases I may need a two different Nexus IQ servers but the Plugin constraints me with the single one.

Unfortunately can't find any related info at the official page


Solution

  • Unfortunately there is no way to configure a several Nexus IQ instances via the Jenkins Nexus Plugin. Which is a little bit strange because some teams may decide to use one IQ instance for dev, one for testing etc.

    The soultion is the official Nexus IQ CLI. Works and configures perfectly.