Maven's Non-Resolvable Parent POM Problem
Need help dealing with Maven's non-resolvable parent problem? Check out this post to learn how.
Join the DZone community and get the full member experience.
Join For Free
I recently got an email from Nosheen Javed asking about an exception he was getting on his Maven build. The exception was:
...which, when listed in full, comes out as:
I thought it worth noting as it's 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 set up, 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:
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:
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:
If your Maven build is being accessed via Eclipse, then are your Eclipse preferences set up 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:
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:
Finally, there are the obvious things to check, like, have you spelled the name of the parent project correctly?
[FATAL] Non-resolvable parent POM: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0
...which, when listed in full, comes out as:
Apache Maven 3.0.4 (r1232337; 2012-01-17 13:44:56+0500)
Maven home: C:\Users\Nosheen\workspace\simple-fingers-sample\EMBEDDED
Java version: 1.7.0_07, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jre7
Default locale: en_GB, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from EMBEDDED\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\Nosheen\.m2\settings.xml
[DEBUG] Using local repository at C:\Users\Nosheen\.m2\repository
[DEBUG] Using manager EnhancedLocalRepositoryManager with priority 10 for C:\Users\Nosheen\.m2\repository
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 inhttp://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 10
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:363)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
[ERROR]
[ERROR] The project com.mycompany.samples:simple-fingers-sample:4.2.0.0 (C:\Users\Nosheen\workspace\simple-fingers-sample\pom.xml) has 1 error
[ERROR] Non-resolvable parent POM: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 inhttp://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 10 -> [Help 2]
org.apache.maven.model.resolution.UnresolvableModelException: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:159)
at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:813)
at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:664)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:310)
at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:410)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:379)
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:343)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:636)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:585)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:234)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:193)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:286)
at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:155)
... 22 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:230)
at org.sonatype.aether.impl.internal.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:204)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:427)
... 26 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
I thought it worth noting as it's 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 set up, 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-resolvable parent POM: Failure to find com.mycompany.samples:biometrics-samples:pom:4.2.0.0 inhttp://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM
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>{path to}/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 set up 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] Reading global settings from EMBEDDED\conf\settings.xml
[DEBUG] Reading user settings from C:\Users\Nosheen\.m2\settings.xml
[DEBUG] Using local repository at C:\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] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Finally, there are the obvious things to check, like, have you spelled the name of the parent project correctly?
Apache Maven
Eclipse
Repository (version control)
Build (game engine)
JBoss
Advice (programming)
IT
Java (programming language)
Published at DZone with permission of Roger Hughes, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments