[GRADLE-1284] Better error message for invalid Maven repo URL Created: 04/Jan/11  Updated: 10/Feb/17  Resolved: 10/Feb/17

Status: Resolved
Project: Gradle
Affects Version/s: 0.9.1
Fix Version/s: None

Type: Improvement
Reporter: Peter Niederwieser Assignee: Unassigned
Resolution: Won't Fix Votes: 0


 Description   

When one forgets to include the protocol in a Maven repo URL...

repositories {
  mavenRepo(urls: "snapshots.repository.codehaus.org") // should be: "http://snapshots.repository.codehaus.org"
}

...the result is a NPE without further information:

A problem occurred evaluating root project 'spock-parent'.
	at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:51)
	at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:127)
	at org.gradle.configuration.BuildScriptProcessor.evaluate(BuildScriptProcessor.java:38)
	at org.gradle.configuration.DefaultProjectEvaluator.evaluate(DefaultProjectEvaluator.java:38)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:506)
	at org.gradle.api.internal.project.AbstractProject.evaluate(AbstractProject.java:71)
	at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:23)
	at org.gradle.configuration.ProjectEvaluationConfigurer.execute(ProjectEvaluationConfigurer.java:21)
	at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:38)
	at org.gradle.configuration.DefaultBuildConfigurer$1.execute(DefaultBuildConfigurer.java:36)
	at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:482)
	at org.gradle.api.internal.project.AbstractProject.allprojects(AbstractProject.java:477)
	at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:35)
	at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:136)
	at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:107)
	at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:75)
	at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:41)
	at org.gradle.launcher.RunBuildAction.execute(RunBuildAction.java:27)
	at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:209)
	at org.gradle.launcher.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:193)
	at org.gradle.launcher.Main.execute(Main.java:55)
	at org.gradle.launcher.Main.main(Main.java:40)
	at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:46)
	at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:28)
	at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
Caused by: java.lang.NullPointerException
	at org.gradle.api.internal.artifacts.ivyservice.GradleIBiblioResolver.setRoot(GradleIBiblioResolver.java:102)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultResolverFactory.createIBiblioResolver(DefaultResolverFactory.java:138)
	at org.gradle.api.internal.artifacts.ivyservice.DefaultResolverFactory.createMavenRepoResolver(DefaultResolverFactory.java:124)
	at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.mavenRepo(DefaultRepositoryHandler.java:117)
	at org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.mavenRepo(DefaultRepositoryHandler.java:108)
	at build_hlhr29l8gmdl3mamsarc9skt9$_run_closure2_closure6.doCall(/swd/prj/spock/build.gradle:38)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:61)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:31)
	at org.gradle.api.internal.project.AbstractProject.repositories(AbstractProject.java:908)
	at build_hlhr29l8gmdl3mamsarc9skt9$_run_closure2.doCall(/swd/prj/spock/build.gradle:36)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:61)
	at org.gradle.util.ConfigureUtil.configure(ConfigureUtil.java:31)
	at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:893)
	at org.gradle.api.internal.project.AbstractProject.configure(AbstractProject.java:898)
	at org.gradle.api.internal.project.AbstractProject.subprojects(AbstractProject.java:881)
	at org.gradle.api.internal.BeanDynamicObject.invokeMethod(BeanDynamicObject.java:158)
	at org.gradle.api.internal.CompositeDynamicObject.invokeMethod(CompositeDynamicObject.java:93)
	at org.gradle.api.internal.project.DefaultProject_Decorated.invokeMethod(Unknown Source)
	at org.gradle.groovy.scripts.BasicScript.methodMissing(BasicScript.groovy:68)
	at build_hlhr29l8gmdl3mamsarc9skt9.run(/swd/prj/spock/build.gradle:23)
	at org.gradle.groovy.scripts.DefaultScriptRunnerFactory$ScriptRunnerImpl.run(DefaultScriptRunnerFactory.java:49)
	... 24 more



 Comments   
Comment by Kurt Harriger [ 08/Jan/12 ]

I was also getting this error on the following url:
mavenRepo name: 'clojars', urls: "http://clojars.org/repo"
adding a slash at the end fixed it:
mavenRepo name: 'clojars', urls: "http://clojars.org/repo/"

Comment by Benjamin Muschko [ 15/Nov/16 ]

As announced on the Gradle blog we are planning to completely migrate issues from JIRA to GitHub.

We intend to prioritize issues that are actionable and impactful while working more closely with the community. Many of our JIRA issues are inactionable or irrelevant. We would like to request your help to ensure we can appropriately prioritize JIRA issues you’ve contributed to.

Please confirm that you still advocate for your JIRA issue before December 10th, 2016 by:

  • Checking that your issues contain requisite context, impact, behaviors, and examples as described in our published guidelines.
  • Leave a comment on the JIRA issue or open a new GitHub issue confirming that the above is complete.

We look forward to collaborating with you more closely on GitHub. Thank you for your contribution to Gradle!

Comment by Benjamin Muschko [ 10/Feb/17 ]

Thanks again for reporting this issue. We haven't heard back from you after our inquiry from November 15th. We are closing this issue now. Please create an issue on GitHub if you still feel passionate about getting it resolved.

Generated at Wed Jun 30 11:51:37 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.