'How to upload groovy script to Nexus3 and run that script properly?
I want to upload a groovy script to my nexus instance and then I want to run that script.
I have this json.
{
"name": "groovy",
"type": "groovy",
"content": "groovy.groovy"
}
Then I use the upload, list and run API-s.
# upload
curl -v -X POST -u admin:admin --header "Content-Type: application/json" 'http://localhost:8081/service/rest/v1/script' -d @groovy.json
# list
curl -v -X GET -u admin:admin 'http://localhost:8081/service/rest/v1/script'
# run
curl -v -X POST -u admin:admin --header "Content-Type: text/plain" 'http://localhost:8081/service/rest/v1/script/groovy/run'
I suspect this there is a problem with the json's content type.
My other json which is working is look like this:
{
"name": "maven",
"type": "groovy",
"content": "repository.createMavenHosted('myMavenRepo')"
}
There is a reference guide for this json somewhere?
UPDATE:
I checked the public Nexus repository here.
Then here I found the scripts interface.
name: 'security', type: 'org.sonatype.nexus.security.internal.SecurityApiImpl' link
name: 'core', type: 'org.sonatype.nexus.internal.provisioning.CoreApiImpl' link
name: 'repository', type: 'org.sonatype.nexus.script.plugin.internal.provisioning.RepositoryApiImpl' link
name: 'blobStore', type: 'org.sonatype.nexus.internal.provisioning.BlobStoreApiImpl' link
But I still not found the way to upload and use a groovy script properly.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
