Maven’s Non-resolvable parent POM Problem

I recently got an email from Nosheen Javed asking about an exception he was getting on his Maven build. The exception was:

ApacheMaven3.0.4(r1232337;2012-01-1713:44:56+0500)
Mavenhome:C:\Users\Nosheen\workspace\simple-fingers-sample\EMBEDDED
Javaversion:1.7.0_07,vendor:OracleCorporation
Javahome:C:\ProgramFiles(x86)\Java\jre7
Defaultlocale:en_GB,platformencoding:Cp1252
OSname:"windows7",version:"6.1",arch:"x86",family:"windows"

SLF4J:Failedtoloadclass"org.slf4j.impl.StaticLoggerBinder".
SLF4J:Defaultingtono-operation(NOP)loggerimplementation
SLF4J:Seehttp://www.slf4j.org/codes.html#StaticLoggerBinderforfurtherdetails.
[INFO]Errorstacktracesareturnedon.
[DEBUG]ReadingglobalsettingsfromEMBEDDED\conf\settings.xml
[DEBUG]ReadingusersettingsfromC:\Users\Nosheen\.m2\settings.xml
[DEBUG]UsinglocalrepositoryatC:\Users\Nosheen\.m2\repository
[DEBUG]UsingmanagerEnhancedLocalRepositoryManagerwithpriority10forC:\Users\Nosheen\.m2\repository[INFO]Scanningforprojects...
[ERROR]Thebuildcouldnotread1project->[Help1]
org.apache.maven.project.ProjectBuildingException:SomeproblemswereencounteredwhileprocessingthePOMs:
[FATAL]Non-resolvableparentPOM:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedand'parent.relativePath'pointsatwronglocalPOM@line4,column10

atorg.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)atorg.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)atorg.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)atorg.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)atorg.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)atorg.apache.maven.cli.MavenCli.execute(MavenCli.java:537)atorg.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)atorg.apache.maven.cli.MavenCli.main(MavenCli.java:141)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)atorg.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)atorg.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)atorg.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR]
[ERROR]Theprojectcom.mycompany.samples:simple-fingers-sample:4.2.0.0(C:\Users\Nosheen\workspace\simple-fingers-sample\pom.xml)has1error
[ERROR]Non-resolvableparentPOM:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedand'parent.relativePath'pointsatwronglocalPOM@line4,column10->[Help2]
org.apache.maven.model.resolution.UnresolvableModelException:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedatorg.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:159)atorg.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)atorg.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)atorg.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)atorg.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)atorg.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:410)atorg.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:379)atorg.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:343)atorg.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)atorg.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)atorg.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)atorg.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)atorg.apache.maven.cli.MavenCli.execute(MavenCli.java:537)atorg.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)atorg.apache.maven.cli.MavenCli.main(MavenCli.java:141)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)atorg.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)atorg.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)atorg.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Causedby:org.sonatype.aether.resolution.ArtifactResolutionException:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedatorg.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)atorg.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)atorg.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)atorg.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)atorg.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:155)
...22more
Causedby:org.sonatype.aether.transfer.ArtifactNotFoundException:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedatorg.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:230)atorg.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:204)atorg.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:427)
...26more
[ERROR]
[ERROR]
[ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles:
[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR][Help2]http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

…and I thought it worth noting as its something I’ve seen several times. It generally crops up when you’re setting up a project giving you a bewildering amount of information. This is telling me that slf4j has not been setup, that the build is using Java version 1.7.0_07 from Oracle and that the Maven home is C:\Users\Nosheen\workspace\simple-fingers-sample\EMBEDDED; however, if you dissect the whole lot you can refine the problem down to the following:

[FATAL]Non-resolvableparentPOM:Failuretofindcom.mycompany.samples:biometrics-samples:pom:4.2.0.0inhttp://repo.maven.apache.org/maven2wascachedinthelocalrepository,resolutionwillnotbereattempteduntiltheupdateintervalofcentralhaselapsedorupdatesareforcedand'parent.relativePath'pointsatwronglocalPOM

This means that the project the Nosheen is trying to get to compile has a parent project called “com.mycompany.samples:biometrics-samples:pom” and Maven can’t find it.

In this case I’m assuming that the parent project “com.mycompany.samples:biometrics-samples:pom” is a MyCompany internal project that will not be stored in an external Maven repository like Maven Central.

The irritating thing about this exception is that there are a few reasons for it to be thrown which means that there are a number of things that you have to check in order to fix it.

Firstly, is the parent project in your local repository?If not there are a couple of options, like do you need to check it out and build it yourself?If you have checked it out can your project see it or do you need to add a relative path element to your project’s POM file?Something like this:

<parent>
<groupId>com.mycompany.samples</groupId>
<artifactId>biometrics-samples</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>{pathto}/mycompany-samples/pom.xml</relativePath>
</parent>

If your company has an internal repository on some company server somewhere then do you need to add a reference to it in either of your local or global settings.xml or pom.xml files?Something like this JBoss public repository definition:

<repositories>
<repository>
<id>jboss-public-repository-group</id>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

If your Maven build is being accessed via Eclipse, then are your Eclipse preferences setup correctly?You may have installed a separate copy/version of Maven to the internal one supplied by Eclipse; are you using that by mistake?Check this here in your preferences:

Using the wrong one may mean that you’re using the wrong version of the global settings.xml .

The fortunate thing is that you can confirm that your Eclipse settings are okay by taking a look at the exception message above. At the top of the message you’ll see:

DEBUG]ReadingglobalsettingsfromEMBEDDED\conf\settings.xml
[DEBUG]ReadingusersettingsfromC:\Users\Nosheen\.m2\settings.xml
[DEBUG]UsinglocalrepositoryatC:\Users\Nosheen\.m2\repository

From this you can see that Nosheen is using the embedded Eclipse instance, taking the global settings.xml from EMBEDDED\conf\settings.xml and the user settings.xml from C:\Users\Nosheen\.m2\settings.xml . The local repository is at C:\Users\Nosheen\.m2\repository .

If you still have problems, then check out the advice given in the links at the bottom of the exception:

[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException[ERROR][Help2]http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Finally, there are the obvious things to check like have you spelt the name of the parent project correctly?

Similar Posts: