Skip to content

Instantly share code, notes, and snippets.

@nblair
Created July 18, 2017 11:02
Show Gist options
  • Save nblair/7ff67e67e7ba2114881af7105259e1a3 to your computer and use it in GitHub Desktop.
Save nblair/7ff67e67e7ba2114881af7105259e1a3 to your computer and use it in GitHub Desktop.
Nexus Repository Manager 3 script for creating a proxy repository of an upstream that requires HTTP authentication.
def configuration = new org.sonatype.nexus.repository.config.Configuration()
configuration.setAttributes(
'maven': [
'versionPolicy': 'RELEASE',
'layoutPolicy': 'STRICT'
],
'proxy': [
'remoteUrl': 'http://localhost:8000',
'contentMaxAge': -1,
'metadataMaxAge': 1440
],
'httpclient': [
'blocked': false,
'autoBlock': true,
'authentication': [
'type': 'username',
'username': 'username',
'password': 'password',
'ntlmHost': '',
'ntlmDomain': ''
]
],
'storage': [
'blobStoreName': 'default',
'strictContentTypeValidation': true
]
)
configuration.setRepositoryName('my-repository2')
configuration.setRecipeName('maven2-proxy')
configuration.setOnline(true)
def repositoryManager = container.lookup(org.sonatype.nexus.repository.manager.RepositoryManager.class.name)
repositoryManager.create(configuration)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment