Why do I get a CannotLocateLocalMavenRepositoryException?


(guillot nicolas) #1

I’m a new gradle user, so it may be a configuration issue.

I install gradle and can see the following:

$ gradle -v

------------------------------------------------------------ Gradle 1.0-rc-1 ------------------------------------------------------------

Gradle build time: mercredi 11 avril 2012 11 h 13 UTC Groovy: 1.8.6 Ant: Apache Ant™ version 1.8.2 compiled on December 20 2010 Ivy: 2.2.0 JVM: 1.6.0_31 (Apple Inc. 20.6-b01-415) OS: Mac OS X 10.7.3 x86_64

My project structure looks like: $ ls -R build.gradle

So I only have the gradle configuration file:

$ cat build.gradle

apply plugin: ‘idea’ apply plugin: ‘groovy’

repositories {

mavenCentral() }

dependencies {

groovy group: ‘org.codehaus.groovy’, name: ‘groovy’, version: ‘1.8.6’ }

But when I execute gradle compile I obtains some exceptions:

$ gradle compile

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: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: ‘repositories’ (position: START_TAG seen …

http://maven.apache.org/xsd/settings-1.0.0.xsd">\n… @5:15)

at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.buildSettings(DefaultLocalMavenRepositoryLocator.java:75)

at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.getLocalMavenRepository(DefaultLocalMavenRepositoryLocator.java:49)

at org.gradle.api.internal.externalresource.local.ivy.LocallyAvailableResourceFinderFactory.create(LocallyAvailableResourceFinderFactory.java:65)

at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices.createArtifactRevisionIdLocallyAvailableResourceFinder(DefaultDependencyManagementServices.java:235)

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$300(DefaultServiceRegistry.java:47)

at org.gradle.internal.service.DefaultServiceRegistry$FactoryMethodService.create(DefaultServiceRegistry.java:340)

at org.gradle.internal.service.DefaultServiceRegistry$ManagedObjectProvider.getInstance(DefaultServiceRegistry.java:244)

at org.gradle.internal.service.DefaultServiceRegistry$SingletonService.getService(DefaultServiceRegistry.java:279)

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:271)

at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices$DefaultDependencyResolutionServices.getResolveRepositoryHandler(DefaultDependencyManagementServices.java:264)

at org.gradle.api.internal.artifacts.DefaultDependencyManagementServices$DefaultDependencyResolutionServices.getResolveRepositoryHandler(DefaultDependencyManagementServices.java:243)

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.initialization.ScriptEvaluatingSettingsProcessor.applySettingsScript(ScriptEvaluatingSettingsProcessor.java:68)

at org.gradle.initialization.ScriptEvaluatingSettingsProcessor.process(ScriptEvaluatingSettingsProcessor.java:59)

at org.gradle.initialization.PropertiesLoadingSettingsProcessor.process(PropertiesLoadingSettingsProcessor.java:38)

at org.gradle.initialization.SettingsHandler.loadSettings(SettingsHandler.java:101)

at org.gradle.initialization.SettingsHandler.findSettingsAndLoadIfAppropriate(SettingsHandler.java:92)

at org.gradle.initialization.SettingsHandler.findAndLoadSettings(SettingsHandler.java:45)

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

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.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.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:31)

at org.gradle.launcher.exec.ExceptionReportingAction.execute(ExceptionReportingAction.java:20)

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

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

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:50)

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

at org.gradle.launcher.GradleMain.main(GradleMain.java:24) Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: ‘repositories’ (position: START_TAG seen …

http://maven.apache.org/xsd/settings-1.0.0.xsd">\n… @5:15)

at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.parseSettings(SettingsXpp3Reader.java:1257)

at org.apache.maven.settings.io.xpp3.SettingsXpp3Reader.read(SettingsXpp3Reader.java:1579)

at org.apache.maven.settings.DefaultMavenSettingsBuilder.readSettings(DefaultMavenSettingsBuilder.java:122)

at org.apache.maven.settings.DefaultMavenSettingsBuilder.buildSettings(DefaultMavenSettingsBuilder.java:163)

at org.apache.maven.settings.DefaultMavenSettingsBuilder.buildSettings(DefaultMavenSettingsBuilder.java:154)

at org.apache.maven.settings.DefaultMavenSettingsBuilder.buildSettings(DefaultMavenSettingsBuilder.java:142)

at org.gradle.api.internal.artifacts.mvnsettings.DefaultLocalMavenRepositoryLocator.buildSettings(DefaultLocalMavenRepositoryLocator.java:73)

… 47 more

BUILD FAILED

Total time: 1.365 secs

With the debug option:

$ gradle compile -debug 19:56:04.548 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@ee0cc23, org.gradle.logging.internal.slf4j.Slf4jLoggingConfigurer@487a1576, org.gradle.logging.internal.JavaUtilLoggingConfigurer@47171b26] 19:56:05.303 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@ee0cc23, org.gradle.logging.internal.slf4j.Slf4jLoggingConfigurer@487a1576, org.gradle.logging.internal.JavaUtilLoggingConfigurer@47171b26] 19:56:05.304 [INFO] [org.gradle.BuildLogger] Starting Build 19:56:05.306 [DEBUG] [org.gradle.BuildLogger] Gradle user home: /Users/nicolasguillot/.gradle 19:56:05.306 [DEBUG] [org.gradle.BuildLogger] Current dir: /Users/nicolasguillot/Documents/ideaWorkspace/CheminsBisonFute 19:56:05.307 [DEBUG] [org.gradle.BuildLogger] Settings file: null 19:56:05.308 [DEBUG] [org.gradle.BuildLogger] Build file: null 19:56:05.320 [DEBUG] [org.gradle.initialization.BuildSourceBuilder] Starting to build the build sources. 19:56:05.322 [DEBUG] [org.gradle.initialization.BuildSourceBuilder] Gradle source dir does not exist. We leave. 19:56:05.324 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found env project properties: [] 19:56:05.325 [DEBUG] [org.gradle.initialization.DefaultGradlePropertiesLoader] Found system project properties: [] 19:56:05.436 [ERROR] [org.gradle.BuildExceptionReporter]

19:56:05.439 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build aborted because of an internal error. 19:56:05.441 [ERROR] [org.gradle.BuildExceptionReporter]

19:56:05.442 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: 19:56:05.443 [ERROR] [org.gradle.BuildExceptionReporter] Build aborted because of an unexpected internal error. Please file an issue at: http://forums.gradle.org. 19:56:05.445 [LIFECYCLE] [org.gradle.BuildResultLogger]

19:56:05.446 [LIFECYCLE] [org.gradle.BuildResultLogger] BUILD FAILED 19:56:05.447 [LIFECYCLE] [org.gradle.BuildResultLogger]

19:56:05.449 [LIFECYCLE] [org.gradle.BuildResultLogger] Total time: 1.345 secs 19:56:05.460 [DEBUG] [org.gradle.logging.internal.DefaultLoggingConfigurer] Finished configuring with level: DEBUG, configurers: [org.gradle.logging.internal.OutputEventRenderer@ee0cc23, org.gradle.logging.internal.slf4j.Slf4jLoggingConfigurer@487a1576, org.gradle.logging.internal.JavaUtilLoggingConfigurer@47171b26]

In cas it’s help, I also put my maven settings file: $ cat ~/.m2/settings.xml

<settings xmlns=“http://maven.apache.org/SETTINGS/1.0.0

xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0

http://maven.apache.org/xsd/settings-1.0.0.xsd">

codehausSnapshots

Codehaus Snapshots

false

always

warn

true

never

fail

http://snapshots.maven.codehaus.org/maven2

default

What’s wrong?


(Peter Niederwieser) #2

There’s likely a syntax error in your settings.xml, but something went wrong when you posted it, so I can’t tell.


(guillot nicolas) #3

Yes you are right, I’ve forgotten markdown balises:

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      http://maven.apache.org/xsd/settings-1.0.0.xsd">
<repositories>
        <repository>
          <id>codehausSnapshots</id>
          <name>Codehaus Snapshots</name>
          <releases>
            <enabled>false</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
          </releases>
          <snapshots>
            <enabled>true</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
          </snapshots>
          <url>http://snapshots.maven.codehaus.org/maven2</url>
          <layout>default</layout>
        </repository>
      </repositories>
</settings>

(Peter Niederwieser) #4

A Maven settings.xml can’t have a top-level ‘repositories’ element. See http://maven.apache.org/settings.html.


(guillot nicolas) #5

Thanks a lot, you have right. I previously modify my settings for some tests and I read my file but not seeing this error… It’s time to take a break!