Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread Eric Pyle
Here again the error message is pretty clear. Groovy can't find the object
"desc". Judging by the name, this is probably a Descriptor you are looking
for. You set the variable "global" as an instance of SonarGlobalConfiguration,
a subclass of Descriptor, using getDescriptorByType():

SonarGlobalConfiguration global = Hudson.instance.getDescriptorByType(
SonarGlobalConfiguration.class)

Perhaps you should name that variable "desc", like this:

SonarGlobalConfiguration desc =  Hudson.instance.getDescriptorByType(
SonarGlobalConfiguration.class)

Then you will have a valid object "desc" for later on in your script. Refer
to http://javadoc.jenkins.io/plugin/sonar/ and http://javadoc.jenkins.io/.

-Eric



On Fri, May 18, 2018 at 4:23 PM, naveen  wrote:

> Hello, Thanks for replaying me back.  Tried with your suggestion got new
> error
>
>
>
>
>
>
>
>
> ERROR: Unexpected exception occurred while performing groovy command.
>
> groovy.lang.MissingPropertyException: No such property: desc 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:17)
>
> 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)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:62)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:498)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(R
> emoteInvocationHandler.java:927)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(Remo
> teInvocationHandler.java:901)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(Remo
> teInvocationHandler.java:850)
>
> at hudson.remoting.UserRequest.perform(UserRequest.java:210)
>
> at hudson.remoting.UserRequest.perform(UserRequest.java:53)
>
> Something wrong in code i'm missing that.
>
> On Friday, May 18, 2018 at 12:06:12 PM UTC-7, naveen 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/;,
>>
>>   "yy",
>>
>>   "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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/c8008fc7-d29e-45d1-bb1a-8761db887404%40googlegroups.
> com
> 

Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread naveen
Thanks so much! well it worked 








import jenkins.model.*

import hudson.plugins.sonar.*

import hudson.plugins.sonar.model.*

import hudson.model.*



def inst = Jenkins.getInstance()

SonarGlobalConfiguration global = Hudson.instance.getDescriptorByType(
SonarGlobalConfiguration.class)

def sinst = new SonarInstallation(

  "sonar",

  "http://localhost:9000/;,

  "yy",

  "3.2",

  "",

  new TriggersConfig(),

  ""

)

global.setInstallations(sinst)



global.save()



On Friday, May 18, 2018 at 1:42:19 PM UTC-7, Victor Martinez wrote:
>
> Well.. the stacktrace message is quite clear:
>
> groovy.lang.MissingPropertyException: No such property: desc for class: 
> RemoteClass
>
>
> Worth to look for where 'desc' is declared/instanced as it's not part of 
> the snippet you pasted it. Likely you could find some answers in this code:
> - 
> https://github.com/hayderimran7/useful-jenkins-groovy-init-scripts/blob/master/sonar-artifactory-settings.groovy
>
> Cheers
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b1877ef6-cf97-4b09-b6fe-78afd8d72af8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread Victor Martinez
Well.. the stacktrace message is quite clear:

groovy.lang.MissingPropertyException: No such property: desc for class: 
RemoteClass


Worth to look for where 'desc' is declared/instanced as it's not part of 
the snippet you pasted it. Likely you could find some answers in this code:
- 
https://github.com/hayderimran7/useful-jenkins-groovy-init-scripts/blob/master/sonar-artifactory-settings.groovy

Cheers

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7e060714-eb9a-4dd9-a3b7-cb03d07a697e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread naveen
By chance could review the code once, any suggestions.

On Friday, May 18, 2018 at 1:24:10 PM UTC-7, naveen wrote:
>
>
>
>
>
>
>
>
>
>
> ERROR: Unexpected exception occurred while performing groovy command.
>
> groovy.lang.MissingPropertyException: No such property: desc for class: 
> RemoteClass
>
> at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(
> ScriptBytecodeAdapter.java:53)
>
> at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.
> getProperty(PogoGetPropertySite.java:52)
>
> at org.codehaus.groovy.runtime.callsite.AbstractCallSite.
> callGroovyObjectGetProperty(AbstractCallSite.java:307)
>
> at RemoteClass.run(RemoteClass:17)
>
> at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(
> GroovyShell.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)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
>
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
>
> at java.lang.reflect.Method.invoke(Method.java:498)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(
> RemoteInvocationHandler.java:927)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(
> RemoteInvocationHandler.java:901)
>
> at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(
> RemoteInvocationHandler.java:850)
>
> at hudson.remoting.UserRequest.perform(UserRequest.java:210)
>
> at hudson.remoting.UserRequest.perform(UserRequest.java:53)
>
>
> On Friday, May 18, 2018 at 1:23:46 PM UTC-7, naveen wrote:
>>
>> Hello, Thanks for replaying me back.  Tried with your suggestion got new 
>> error 
>>
>>
>>
>>
>>
>>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ab7ec877-2afc-4eb2-9ff5-0104337de702%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread naveen









ERROR: Unexpected exception occurred while performing groovy command.

groovy.lang.MissingPropertyException: No such property: desc for class: 
RemoteClass

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(
ScriptBytecodeAdapter.java:53)

at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.
getProperty(PogoGetPropertySite.java:52)

at org.codehaus.groovy.runtime.callsite.AbstractCallSite.
callGroovyObjectGetProperty(AbstractCallSite.java:307)

at RemoteClass.run(RemoteClass:17)

at groovy.lang.GroovyShell.runScriptOrMainOrTestOrRunnable(
GroovyShell.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)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(
NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(
RemoteInvocationHandler.java:927)

at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(
RemoteInvocationHandler.java:901)

at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(
RemoteInvocationHandler.java:850)

at hudson.remoting.UserRequest.perform(UserRequest.java:210)

at hudson.remoting.UserRequest.perform(UserRequest.java:53)


On Friday, May 18, 2018 at 1:23:46 PM UTC-7, naveen wrote:
>
> Hello, Thanks for replaying me back.  Tried with your suggestion got new 
> error 
>
>
>
>
>
>

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/39f1f8e0-1182-45cb-a4db-caebb5cf3390%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Sonar Plugin groovy script

2018-05-18 Thread Eric Pyle
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  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/;,
>
>   "yy",
>
>   "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 jenkinsci-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/jenkinsci-users/7b3e5b1f-f8e4-4fcb-8cfd-c6822d573175%40googlegroups.
> com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Eric Pyle*
Siemens PLM Software
Lebanon, New Hampshire
+1 603-277-3060 (T)
eric.p...@siemens.com
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 jenkinsci-users+unsubscr...@googlegroups.com.
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.