Hi,
I have two scripts uploaded, which list as
[ {
“name” : “test”,
“content” : “println(‘Hello test’)”,
“type” : “string”
}, {
“name” : “helloarg”,
“content” : “String.valueOf(args)”,
“type” : “string”
} ]
Whichever I run from the API page or the commandline, I get a Json result : “Missing enging for language: string”:
$ curl -X POST -u admin:admin123 --header “Content-Type: text/plain” “http://localhost:8081/service/rest/v1/script/helloarg/run” -d “Hello”
< HTTP/1.1 400 Bad Request
{
“name” : “helloarg”,
“result” : “Missing engine for language: string”
}
In the logViewer I see that this is a java.lang.IllegalStateException.
In any case, it is not caused by the Json type argument “string”, because “String” results in the same.
Eventually I need to pass an argument with value of a specific GAV from Jenkins, after having released successfully, to run the Nexus script on this GAV.
Thank you, I will definitely give it a try!
Allthough it looks like a Mime-type problem, the system/API page does not seem to work consistently with application/json.
This still works with a “onelined” script, but if it works it works!
The Sonatype complex-script example shows it can also be done with a REST call.
Rich, thanks for the reply, but If I upload this script through the API page via add
{
“name”: “hello”,
“content”: “log.info(“Hello”)”,
“type”: “string”
}
and call it through the run option I get the HTTP 400 / Bad Request: “Missing engine for language: string” result.
I can not choose alternative Mime-types for either action.
Running the script by cUrl the Mime-type does not matter for the exception in the logViewer.