m9 build fails because LOCAL_MAVEN_REPO is not set


(David Resnick) #1

Trying to build without environment variable LOCAL_MAVEN_REPO fails with this output:

FAILURE: Build aborted because of an internal error.
* What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.
* Try:
Run with --debug option to get additional debug info.
* Exception is:
org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException: Cannot resolve placeholder 'env.LOCAL_MAVEN_REPO' in value 'null'

(Peter Niederwieser) #2

It means that you reference an environment variable LOCAL_MAVEN_REPO from your Maven settings.xml. Gradle’s Maven plugin reads that file to learn about the location of the local Maven repository. Either remove the reference to the environment variable, or set the environment variable.


(David Resnick) #3

You know, that environment variable did look familiar. :slight_smile:

I do think though that this is a bug. It doesn’t make sense to me that gradle fails because maven is not configured correctly.


#4

I agree - this is now GRADLE-2203. The issue is that we’re trying to find the local maven repository in order to avoid downloading things that already exist on the filesystem. If we can’t do this, we should just print a warning and continue.

This is assuming you’re not using ‘mavenLocal()’ in your build script. If that’s the case, the build needs to fail since the repo can’t be located.


(Peter Niederwieser) #5

If the Maven plugin is applied (which means that you are actively asking for Maven integration), and the part of settings.xml that defines the location of the local Maven repo is invalid, then failing seems like a natural option to me.


#6

But we look in maven local for candidate cache artifacts even if the maven plugin isn’t applied. This is how we avoid downloading artifacts that have been previously downloaded by maven. I think we should tolerate a broken maven settings file in this case.


(Peter Niederwieser) #7

Right. If there is no mavenLocal(), tolerating a broken settings.xml sounds like the right thing to do.


(Gradle Jira) #8

Do you have the full stack trace for the failure?


(David Resnick) #9
FAILURE: Build aborted because of an internal error.
  * What went wrong:
Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org.
  * Try:
Run with --debug option to get additional debug info.
  * Exception is:
org.gradle.api.internal.artifacts.mvnsettings.CannotLocateLocalMavenRepositoryException: Cannot resolve placeholder 'env.LOCAL_MAVEN_REPO' in value 'null'
 at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.resolvePlaceholders(DefaultLocalMavenRepositoryLocator.java:62)
 at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.getLocalMavenRepository(DefaultLocalMavenRepositoryLocator.java:51)
 at org.gradle.api.internal.artifacts.ivyservice.filestore.ExternalArtifactCacheBuilder.addMavenLocal(ExternalArtifactCacheBuilder.java:51)
 at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices.createRepositoryTransportFactory(DefaultDependencyManagementServices.java:221)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.gradle.internal.service.DefaultServiceRegistry.invoke(DefaultServiceRegistry.java:179)
 at org.gradle.internal.service.DefaultServiceRegistry.access$200(DefaultServiceRegistry.java:47)
 at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.create(DefaultServiceRegistry.java:351)
 at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:244)
 at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getService(DefaultServiceRegistry.java:290)
 at org.gradle.internal.service.DefaultServiceRegistry$OwnServices.getService(DefaultServiceRegistry.java:219)
 at org.gradle.internal.service.DefaultServiceRegistry.get(DefaultServiceRegistry.java:145)
 at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices$DefaultDependencyResolutionServices.createRepositoryHandler(DefaultDependencyManagementServices.java:253)
 at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices$DefaultDependencyResolutionServices.getResolveRepositoryHandler(DefaultDependencyManagementServices.java:246)
 at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices$DefaultDependencyResolutionServices.getResolveRepositoryHandler(DefaultDependencyManagementServices.java:225)
 at org.gradle.api.internal.initialization.DefaultScriptHandlerFactory.create(DefaultScriptHandlerFactory.java:63)
 at org.gradle.api.internal.initialization.DefaultScriptHandlerFactory.create(DefaultScriptHandlerFactory.java:58)
 at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:101)
 at org.gradle.configuration.DefaultInitScriptProcessor.process(DefaultInitScriptProcessor.java:37)
 at org.gradle.initialization.InitScriptHandler.executeScripts(InitScriptHandler.java:41)
 at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:128)
 at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:110)
 at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:78)
 at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:42)
 at org.gradle.launcher.cli.RunBuildAction.execute(RunBuildAction.java:28)
 at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:32)
 at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:21)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:302)
 at org.gradle.launcher.cli.CommandLineActionFactory$WithLoggingAction.execute(CommandLineActionFactory.java:286)
 at org.gradle.launcher.Main.doAction(Main.java:48)
 at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:53)
 at org.gradle.launcher.exec.EntryPoint$1.execute(EntryPoint.java:51)
 at org.gradle.launcher.exec.Execution.execute(Execution.java:28)
 at org.gradle.launcher.exec.EntryPoint.run(EntryPoint.java:39)
 at org.gradle.launcher.Main.main(Main.java:39)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.gradle.launcher.ProcessBootstrap.runNoExit(ProcessBootstrap.java:51)
 at org.gradle.launcher.ProcessBootstrap.run(ProcessBootstrap.java:33)
 at org.gradle.launcher.GradleMain.main(GradleMain.java:24)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:33)
 at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:124)
 at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:53)
    BUILD FAILED
  Total time: 23.377 secs
  FAILURE: Build failed with an exception.
  * What went wrong:
Failed to notify build listener.