import org.sonatype.nexus.blobstore.api.BlobStoreManager
import org.sonatype.nexus.repository.storage.WritePolicy
import org.sonatype.nexus.repository.maven.VersionPolicy
import org.sonatype.nexus.repository.maven.LayoutPolicy
repository.createMavenHosted('private')
repository.createMavenHosted('private-again', BlobStoreManager.DEFAULT_BLOBSTORE_NAME, true, VersionPolicy.RELEASE,
WritePolicy.ALLOW_ONCE, LayoutPolicy.STRICT)
Caught: java.lang.NoClassDefFoundError: org/sonatype/goodies/lifecycle/Lifecycle
java.lang.NoClassDefFoundError: org/sonatype/goodies/lifecycle/Lifecycle
Caused by: java.lang.ClassNotFoundException: org.sonatype.goodies.lifecycle.Lifecycle
Hello,
I try to create a maven Repository by the groovy API and use at the moment this code example:import org.sonatype.nexus.blobstore.api.BlobStoreManager
import org.sonatype.nexus.repository.storage.WritePolicy
import org.sonatype.nexus.repository.maven.VersionPolicy
import org.sonatype.nexus.repository.maven.LayoutPolicy
repository.createMavenHosted('private')
repository.createMavenHosted('private-again', BlobStoreManager.DEFAULT_BLOBSTORE_NAME, true, VersionPolicy.RELEASE,
WritePolicy.ALLOW_ONCE, LayoutPolicy.STRICT)
and after the Installation of groovy on the Server I copied the following jar-File in the ~/.groovy/lib Directory:but if I run the Script I get the error:
- nexus-blobstore-api-3.0.1-01.jar
- nexus-core-3.0.1-01.jar
- nexus-repository-3.0.1-01.jar
- nexus-repository-maven-3.0.1-01.jar
Caught: java.lang.NoClassDefFoundError: org/sonatype/goodies/lifecycle/Lifecycle
java.lang.NoClassDefFoundError: org/sonatype/goodies/lifecycle/Lifecycle
Caused by: java.lang.ClassNotFoundException: org.sonatype.goodies.lifecycle.Lifecycle
and now I have no idea how can I create a repository by the groovy API and hope someone here can give me a full example how groovy basically in combination with nexus works.
I would be very thanksful because this are my first steps with groovy too.
best regards
Dan
--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/f33db0dd-8ce6-403b-80b2-3dcb9a580374%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
{
"name": "maven2",
"type": "groovy",
"content": "repository.createMavenHosted('private-again', 'default', true, VersionPolicy.SNAPSHOT, WritePolicy.ALLOW_ONCE, org.sonatype.nexus.repository.maven.LayoutPolicy.STRICT)"
}
curl -v -u admin:admin123 --header "Content-Type: application/json" 'http://localhost:8081/nexus/service/siesta/rest/v1/script/' -d @aaaa.jsoncurl -v -X POST -u admin:admin123 --header "Content-Type: text/plain" "http://localhost:8081/nexus/service/siesta/rest/v1/script/maven2/run"{
"name": "maven",
"type": "groovy",
"content": "repository.createMavenHosted('private')"
}
{
"name": "maven2",
"type": "groovy",
"content": "repository.createMavenHosted('private-again', 'default', true, org.sonatype.nexus.repository.maven.policy.VersionPolicy.SNAPSHOT, org.sonatype.nexus.repository.storage.WritePolicy.ALLOW_ONCE, org.sonatype.nexus.repository.maven.LayoutPolicy.STRICT)"
}
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
Hello Peter,
first of all I would like to thanks for your help. Now I have create a json-File with the content:{
"name": "maven2",
"type": "groovy",
"content": "repository.createMavenHosted('private-again', 'default', true, VersionPolicy.SNAPSHOT, WritePolicy.ALLOW_ONCE, org.sonatype.nexus.repository.maven.LayoutPolicy.STRICT)"
}
this file I upload with the command:curl -v -u admin:admin123 --header "Content-Type: application/json" 'http://localhost:8081/nexus/service/siesta/rest/v1/script/' -d @aaaa.json
and get a 204, but if I try to rund the script bycurl -v -X POST -u admin:admin123 --header "Content-Type: text/plain" "http://localhost:8081/nexus/service/siesta/rest/v1/script/maven2/run"
I get the error:
400 Bad Request: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: VersionPolicy for class: Script8"
This confused me a little bit because this json-Script works after I uploaded it:{
"name": "maven",
"type": "groovy",
"content": "repository.createMavenHosted('private')"
}
Maybe someone can tell me where is my mistake?
best regards
Dan
PS
I also try{
"name": "maven2",
"type": "groovy",
"content": "repository.createMavenHosted('private-again', 'default', true, org.sonatype.nexus.repository.maven.policy.VersionPolicy.SNAPSHOT, org.sonatype.nexus.repository.storage.WritePolicy.ALLOW_ONCE, org.sonatype.nexus.repository.maven.LayoutPolicy.STRICT)"
}
but then I get the error:
"javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: org for class: Script9"
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/c2c2f9ee-429a-4f1d-8df4-4444619455c0%40glists.sonatype.com.