Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Context URL cannot be empty - Artifactory Gradle Plugin

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
    }
  }
}
like image 904
vicsz Avatar asked Apr 04 '12 18:04

vicsz


People also ask

What is Artifactory build info?

The build-info includes the list of project modules, artifacts, dependencies, environment variables and more. When using one of the JFrog clients to build the code, the client can collect the build-info and publish it to Artifactory.


1 Answers

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.

like image 192
Umi Avatar answered Oct 12 '22 06:10

Umi