Hi Naveen,

It looks like you need to import hudson.model.* to get class Hudson.

Eric

On Fri, May 18, 2018 at 2:25 PM, naveen <[email protected]> wrote:

> When I tried to configure Sonar plugin using following script throwing me
> an error.
>
>
>
>
>
>
>
>
> import jenkins.model.*
>
> import hudson.plugins.sonar.*
>
> import hudson.plugins.sonar.model.*
>
>
>
> def inst = Jenkins.getInstance()
>
> SonarGlobalConfiguration global = Hudson.instance.getDescriptorByType(
> SonarGlobalConfiguration.class)
>
> def sinst = new SonarInstallation(
>
>   "sonar",
>
>   "http://localhost:9000/";,
>
>   "yyyyyyyyyyyyyy",
>
>   "3.2",
>
>   "",
>
>   new TriggersConfig(),
>
>   ""
>
> )
>
> desc.setInstallations(sinst)
>
>
>
> desc.save()
>  ERROR
>
>
>
>
>
>
>
>
> ERROR: Unexpected exception occurred while performing groovy command.
>
> groovy.lang.MissingPropertyException: No such property: Hudson for class:
> RemoteClass
>
>         at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(Scr
> iptBytecodeAdapter.java:53)
>
>         at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.get
> Property(PogoGetPropertySite.java:52)
>
>         at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGr
> oovyObjectGetProperty(AbstractCallSite.java:307)
>
>         at RemoteClass.run(RemoteClass:6)
>
>         at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(Groo
> vyShell.java:263)
>
>         at groovy.lang.GroovyShell.run(GroovyShell.java:518)
>
>         at groovy.lang.GroovyShell.run(GroovyShell.java:497)
>
>         at hudson.cli.GroovyCommand.run(GroovyCommand.java:89)
>
>         at hudson.cli.CLICommand.main(CLICommand.java:278)
>
>         at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:95)
> Could someone help me in solving this script. It might be an constructor
> issue.
>
> Thanks!
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/7b3e5b1f-f8e4-4fcb-8cfd-c6822d573175%40googlegroups.
> com
> <https://groups.google.com/d/msgid/jenkinsci-users/7b3e5b1f-f8e4-4fcb-8cfd-c6822d573175%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Eric Pyle*
Siemens PLM Software
Lebanon, New Hampshire
+1 603-277-3060 (T)
[email protected]
http://www.siemens.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPrXuH3R1ZxOEW1TTVvFvFhtVGnxB5v9q_60mDL0j6DSnH7uoQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to