Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-46767

failed to set up artifactory using groovy script

XMLWordPrintable

      I was trying to configure artifactory using groovy init scripts, this is my script which I'm trying to execute 

      import jenkins.model.*
      import org.jfrog.*
        import org.jfrog.hudson.*
        import org.jfrog.hudson.util.Credentials;
      
        def inst = Jenkins.getInstance()
      
        def desc = inst.getDescriptor("org.jfrog.hudson.ArtifactoryBuilder")
      
        def deployerCredentials = new Credentials("admin", "password")
        def resolverCredentials = new Credentials("", "")
      
        def sinst = [new ArtifactoryServer(
        "server-id",
        "http://localhost:8081/artifactory",
        deployerCredentials,
        resolverCredentials,
        300,
        false,
        false,
        false,
        1)
        ]
        desc.setArtifactoryServers(sinst)
        desc.save()

        
      But I was getting the following error

       

      groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.jfrog.hudson.CredentialsConfig(java.lang.String, java.lang.String)
      at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1732)
      at groovy.lang.MetaClassImpl.invokeConstructor(MetaClassImpl.java:1532)
      at org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite.callConstructor(MetaClassConstructorSite.java:49)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:60)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:235)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:255)
      at Script1.run(Script1.groovy:17)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
      at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
      at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
      at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
      at hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
      at jenkins.model.Jenkins._doScript(Jenkins.java:4350)
      at jenkins.model.Jenkins.doScriptText(Jenkins.java:4328)
      at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
      at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      

       
      It would be great if anyone could look into this issue.

            eyalbe Eyal Ben Moshe
            aj_06 ajitesh rao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: