Context URL cannot be empty - Artifactory Gradle Plugin

Go To StackoverFlow.com

8

I'm trying to get to the Artifactory Gradle plugin working to publish to my local Artifactory instance.

I have the latest version (default install) running at localhost:8081/artifactory. I can verify this with access via a webbrowser.

However, with my bare minimum example .. I am getting a "Context URL cannot be found error

Note that I have specified all the mandatory required Artifactory configurations settings - (as indicated on the Artifactory Gradle WebPage) .. including the Context URL.

buildscript {
  repositories{ maven { url 'http://repo.jfrog.org/artifactory/gradle-plugins' } }
  dependencies{ classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.0.12'}
}

apply plugin: 'artifactory'

artifactory {
  contextUrl = 'http://localhost:8081/artifactory'   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    repository {
      repoKey = 'integration-libs'   //The Artifactory repository key to publish to
      username = 'admin'          //The publisher user name
      password = 'password'
    } 
  }
  resolve {
    repository {
      repoKey = 'libs-releases'  //The Artifactory (preferably virtual) repository key to resolve from
    }
  }
}
2012-04-04 18:41
by vicsz
Which version of Gradle do you use - noamt 2012-04-05 06:30
Also, in case this might be a bug, can you try to specify the context URL in both the publish and resolve section - noamt 2012-04-05 07:38
Latest version of Gradle (milestone 9) .. along with the corresponding artifactory plugin - vicsz 2012-04-05 15:46
This works fine for me with milestone 9 and 1.0 final. The error message I get is "Context URL cannot be empty" if I don't define contextUrl. This message seems to be different from yours. Do you have your full source code on GitHub or some other repository? Is is a single or multi-module project - Benjamin Muschko 2012-06-27 00:30


5

This looks like a weird bug and I'm not sure what causes it. I get it in some of my gradle build files but others seem to work fine. I fixed it by defining the contextUrl again inside the publish element, so your script will now look like:

artifactory {
  contextUrl = 'http://localhost:8081/artifactory'   //The base Artifactory URL if not overridden by the publisher/resolver
  publish {
    contextUrl = 'http://localhost:8081/artifactory' // <- this is the fix
    repository {
      repoKey = 'integration-libs'   //The Artifactory repository key to publish to
      username = 'admin'          //The publisher user name
      password = 'password'
    } 
  }
  resolve {
    repository {
      repoKey = 'libs-releases'  //The Artifactory (preferably virtual) repository key to resolve from
    }
  }
}

You might also have to define it again inside the resolve element.

2012-11-19 23:55
by Umi
Ok I've realised this happens if the parent project contains an artifactory coniguration and you try to define a new artifactory configuration in the child projects - Umi 2012-11-20 00:40
Also seems to happen when you paste the artifactory build into a child build and there is no artifactory configuration in the parent. Seems that one can only use artifactory for all builds or none - Gus 2015-03-09 16:05
Ads