Getting error "Context URL cannot be empty"


(shama khadpekar) #1

I have a hierarchical gradle project with following structure

service

-service-core

-build.gradle

-gradle.properties

-service-test-automation

-build.gradle

-gradle.properties

-settings.gradle

service-core/build.gradle looks like following

sourceCompatibility = 1.7 targetCompatibility = 1.7

repositories {

maven {

url ‘abc.com/artifactory/remote-repos

credentials {

username = “${artifactory_user}”

password = “${artifactory_password}”

}

}

mavenLocal() }

war {

manifest {

attributes(“Implementation-Title”: rootProject.name, “Implementation-Version”: version, ‘Build-Time-ISO-8601’: new Date().format(“yyyy-MM-dd’T’HH:mm:ssZ”))

}

}

dependencies {

compile ‘org.glassfish.jersey.ext:jersey-spring3:2.3.1’

compile ‘org.glassfish.jersey.media:jersey-media-json-jackson:2.2’

compile ‘org.glassfish.jersey.ext:jersey-bean-validation:2.2’

compile ‘ch.qos.logback:logback-classic:1.0.13’

compile ‘ch.qos.logback:logback-access:1.0.13’

compile ‘commons-configuration:commons-configuration:1.9’

compile ‘commons-lang:commons-lang:2.6’

compile ‘abc.lib:abc-lib-monitoring:0.1-2013-10-14_21-32-35’

compile ‘abc.lib:abc-lib-couchbase:1.0-2013-11-08_20-27-32’

testCompile “junit:junit-dep:4.11”

testCompile “org.mockito:mockito-core:1.9.5”

providedCompile ‘javax.servlet:javax.servlet-api:3.1.0’ }

task wrapper(type: Wrapper) {

gradleVersion = ‘1.7’ }

apply plugin: ‘checkstyle’ checkstyle {

ignoreFailures = false

configFile = rootProject.file(‘codequality/checkstyle.xml’) }

buildscript {

repositories {

mavenCentral()

}

dependencies {

classpath “net.saliman:gradle-cobertura-plugin:2.0.0”

} } apply plugin: ‘cobertura’ cobertura {

coverageFormats = [‘xml’,‘html’] }

// Publish to artifactory buildscript {

repositories {

maven {

url ‘http://abc.com/artifactory/plugins-release

credentials {

username = “${artifactory_user}”

password = “${artifactory_password}”

}

}

}

dependencies {

classpath(group: ‘org.jfrog.buildinfo’, name: ‘build-info-extractor-gradle’, version: ‘2.0.9’)

} }

allprojects {

apply plugin: ‘artifactory’ }

artifactory {

contextUrl = “${artifactory_contextUrl}”

//The base Artifactory URL if not overridden by the publisher/resolver

publish {

contextUrl = “${artifactory_contextUrl}”

repository {

repoKey = ‘libs-release-local’

username = “${artifactory_user}”

password = “${artifactory_password}”

maven = true

}

}

resolve {

repository {

repoKey = ‘libs-release’

username = “${artifactory_user}”

password = “${artifactory_password}”

maven = true

}

} }

task copyConfigs(type:Copy) {

from (‘src/main/conf’) {

include ‘**/service-registry*.properties’

}

into ‘/opt/abc/config’ }

build.dependsOn copyConfigs

also specified artifactory_contextUrl in both gradle.properties

but gets following error

org.gradle.listener.ListenerNotificationException: Failed to notify build listener.

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

at com.sun.proxy.$Proxy15.projectsEvaluated(Unknown Source)

at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:145)

at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:113)

at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:81)

at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:64)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)

at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:35)

at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)

at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)

at org.gradle.api.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:201)

at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:174)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:170)

at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:139)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)

at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)

at org.gradle.launcher.Main.doAction(Main.java:46)

at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)

at org.gradle.launcher.Main.main(Main.java:37)

at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:50)

at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:32)

at org.gradle.launcher.GradleMain.main(GradleMain.java:23) Caused by: org.gradle.listener.ListenerNotificationException: Failed to notify build listener.

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)

at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)

at com.sun.proxy.$Proxy15.projectsEvaluated(Unknown Source)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)

… 25 more Caused by: org.gradle.listener.ListenerNotificationException: Failed to notify build listener.

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:90)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:30)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)

… 31 more Caused by: java.lang.IllegalStateException: Context URL cannot be empty

at org.jfrog.build.client.ArtifactoryClientConfiguration.getContextUrl(ArtifactoryClientConfiguration.java:111)

at org.jfrog.build.client.ArtifactoryClientConfiguration$ResolverHandler.getContextUrl(ArtifactoryClientConfiguration.java:184)

at org.jfrog.build.client.ArtifactoryClientConfiguration$RepositoryConfiguration.getUrl(ArtifactoryClientConfiguration.java:395)

at org.jfrog.build.client.ArtifactoryClientConfiguration$RepositoryConfiguration$getUrl.call(Unknown Source)

at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin$ProjectsEvaluatedBuildListener.defineResolvers(ArtifactoryPlugin.groovy:84)

at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin$ProjectsEvaluatedBuildListener.this$3$defineResolvers(ArtifactoryPlugin.groovy)

at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin$_ProjectsEvaluatedBuildListener_projectsEvaluated_closure1.doCall(ArtifactoryPlugin.groovy:75)

at org.jfrog.gradle.plugin.artifactory.ArtifactoryPlugin$ProjectsEvaluatedBuildListener.projectsEvaluated(ArtifactoryPlugin.groovy:73)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)

at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)

at org.gradle.listener.BroadcastDispatch.dispatch(BroadcastDispatch.java:81)

… 33 more


(ruediger.schobbert) #2

I guess your statement that: “also specified artifactory_contextUrl in both gradle.properties” was just a mispronounciation. I assume you correctly used the variable artifactorycontextUrl.

Besides that, I also encountered the same problems. I solved it by setting the artifactory contextUrl in the allprojects part, so you might want to try:

allprojects {
 apply plugin: 'artifactory'
 artifactory {
  contextUrl = artifactorycontextUrl
 }
}

(shama khadpekar) #3

Hey Ruediger Schobbert,

Thanks for the reply. But didn’t mispronounced “artifactory_contextUrl” so mu gradle.properties is following

version=0.1 group=abc.esr artifactory_user=deployer artifactory_password= artifactory_contextUrl=http://abc.com/artifactory

so in my build.gradle is same as above.

artifactory_contextUrl is a variable specified, which I am using in build.gradle.


I tried to build it by adding

artifactory {

contextUrl = artifactorycontextUrl

}

into allprojects as following. But still get same error

allprojects {

apply plugin: ‘artifactory’

artifactory {

contextUrl = artifactorycontextUrl

} }