# File MyScript123.json
{ "name": "MyScript123", "type": "groovy", "content": "repository.createMavenHosted('private')" }
curl -v -X POST -u username:password --header "Content-Type: application/json" 'http://localhost:8081/service/siesta/rest/v1/script' -d @MyScript123.json
--
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/3dfc6e09-1ca0-4168-9bfa-2ced81c4c72f%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.
import org.sonatype.nexus.script.ScriptManager
import org.sonatype.nexus.common.script.ScriptService
def scriptManager = container.lookup(ScriptManager.name)
def scriptService = container.lookup(ScriptService.name)
def script = scriptManager.get('test')
Object result = scriptService.eval(script.type, script.content, [log:log])
--
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/2877ed35-adca-4b9f-a5f5-bb41540ea7f6%40glists.sonatype.com.
Here's how you can execute a stored Script from another Script (whether run as a Scheduled Task or not):import org.sonatype.nexus.script.ScriptManager
import org.sonatype.nexus.common.script.ScriptService
def scriptManager = container.lookup(ScriptManager.name)
def scriptService = container.lookup(ScriptService.name)
def script = scriptManager.get('test')
Object result = scriptService.eval(script.type, script.content, [log:log])
Hopefully this gets you where you want to go :)
On Thu, Jan 11, 2018 at 11:28 AM, 'Robert Heinzmann' via Nexus Users <nexus...@glists.sonatype.com> wrote:
Hello,actually the example Above is really just an Example.I want to upload a rather large groovy script and reverence it multiple times in Tasks (calling it with different options doing different things) without storing multiple copies of the script.Any Idea ?Regards,Robert
On Thursday, January 11, 2018 at 6:22:32 PM UTC+1, Michael Worthington wrote:I'm a little confused, but it looks like you want to create a new maven repository, but you need to initiate the call from the scheduled task.The "Script Task" and "Integrations API" are basically the same, so you can just put "repository.createMavenHosted('private')" in your scheduled task configuration and run the task.
--
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...@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/2877ed35-adca-4b9f-a5f5-bb41540ea7f6%40glists.sonatype.com.
--
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...@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/CANYY_wFePVE6JM9r0rUR9mYuTcsOga345%2B7XVOnHEi9f%2BnL7qA%40mail.gmail.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.