Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven:Non-resolvable parent POM and 'parent.relativePath' points at wrong local POM

I am using maven 3 to run the application but I am getting the following error:

[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.topdesk:tis-parent:pom:3.
4 in https://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 3, column 11
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:416)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR]   The project com.topdesk.test.junitcategorizer:junitcategorizer:0.0.1-SNAPSHOT (D:\Masters\thesis related papers and tools\junitcategorizer\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Failure to find com.topdesk:tis-parent:pom:3.4 in https://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 3, column 11 -> [Help 2]org.apache.maven.model.resolution.UnresolvableModelException: Failure to find com.topdesk:tis-parent:pom:3.4 in https://repo.maven.apache.org/maven2 was cachedin 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:187)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:236)
    at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultodelBuilder.java:898)
    at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:750)
    at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:309)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:463)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:432)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:396)
    at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
    at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.topdesk:tis-parent:pom:3.4 in https://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.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
    at org.apache.maven.project.ProjectModelResolver.resolveModel(ProjectModelResolver.java:183)
    ... 22 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.topdesk:tis-parent:pom:3.4 in https://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.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:232)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:599)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:518)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
    ... 26 more

I have the following parent pom file (part of it):

<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.topdesk</groupId>
<artifactId>tis-parent</artifactId>
<version>3.4</version>
</parent>

<groupId>com.topdesk.test.junitcategorizer</groupId>
<artifactId>junitcategorizer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>JUnitCategorizer</name>

<modules>
<module>junitcategorizer.instrument</module>
<module>junitcategorizer.examples</module>
<module>junitcategorizer.reporter.maven</module>
<module>junitcategorizer.reporter.maven.site</module>
<module>junitcategorizer.cutdetection</module>
</modules>
<organization>
    <name>TOP Informatie Systemen bv</name>
    <url>http://www.topdesk.com/</url>
</organization>

<properties>
    <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>utf-8</project.reporting.outputEncoding>
    <surefire.version>2.12</surefire.version>
</properties>

<prerequisites>
    <maven>3.0</maven>
</prerequisites>

I have the following child module pom file:

 <modelVersion>4.0.0</modelVersion>
 <parent>
<artifactId>junitcategorizer</artifactId>
<groupId>com.topdesk.test.junitcategorizer</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>junitcategorizer.cutdetection</artifactId>
<name>Analysis of parameters for the CUT detection algorithm</name>
<description>Analysis of parameters for the CUT detection algorithm</description>
<dependencies>
<dependency>
    <groupId>com.topdesk.test.junitcategorizer</groupId>
    <artifactId>junitcategorizer.instrument</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

I tried commenting the below part in the parent pom file( i don't know if it is correct to do it), then this error is gone and the build fails with this error.

<parent>
<groupId>com.topdesk</groupId>
<artifactId>tis-parent</artifactId>
<version>3.4</version>
</parent>

Please help me!

Thanks

like image 882
Srinu Avatar asked Apr 06 '16 12:04

Srinu


People also ask

Why am I getting error at parent tag in POM XML?

Just go to Project Tab on Eclipse and Select Clean. Then Eclipse will automatically remove the Maven Dependencies and re-build your project. By then, the error may be gone.

What is Relativepath in POM XML?

The relative path, if not given explicitly, defaults to .. , i.e. the pom in the parent directory of the current project. So Maven checks whether a) there is a pom file in that directory and b) that pom file contains the same coordinates as stated in the parent definition of the current project.

How do you create a relative path in Maven project?

Parent POM Relative Path By default, Maven looks for the parent POM first at project's root, then the local repository, and lastly in the remote repository. If parent POM file is not located in any other place, then you can use code tag. This relative path shall be relative to project root.

What is Maven POM file?

What is a POM? A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project. It contains default values for most projects.


5 Answers

The normal layout for a maven multi module project is:

parent
├── pom.xml
├── module
    ├── pom.xml

Check that you use this layout.

Additionally:

  1. the relativePath looks strange. Instead of '..'

    <relativePath>..</relativePath>
    

    try '../' instead:

    <relativePath>../</relativePath>
    

    You can also remove relativePath if you use the standard layout. This is what I always do, and on the command line I can build as well the parent (and all modules) or only a single module.

  2. The module path may be wrong. In the parent you define the module as:

    <module>junitcategorizer.cutdetection</module>
    

    You must specify the name of the folder of the child module, not an artifact identifier. If junitcategorizer.cutdetection is not the name of the folder than change it accordingly.

Hope that helps..

EDIT have a look at the other post, I answered there.

like image 175
Stefan Isele - prefabware.com Avatar answered Oct 18 '22 19:10

Stefan Isele - prefabware.com


I'm probably a bit late to the party, but I wrote the junitcategorizer for my thesis project at TOPdesk. Earlier versions indeed used a company internal Parent POM. So your problems are caused by the Parent POM not being resolvable, since it is not available to the outside world.

You can either:

  • Remove the <parent> block, but then have to configure the Surefire, Compiler and other plugins yourself
  • (Only applicable to this specific case!) Change it to point to our Open Source Parent POM by setting:
<parent>
    <groupId>com.topdesk</groupId>
    <artifactId>open-source-parent</artifactId>
    <version>1.2.0</version>
</parent>
like image 13
Joep Weijers Avatar answered Oct 18 '22 19:10

Joep Weijers


There was conflict in java version. Resolved after using 1.8 for maven.

like image 7
vbnr Avatar answered Oct 18 '22 19:10

vbnr


You can try with the following way,

 <parent>
    <groupId></groupId>
    <artifactId></artifactId>
    <version></version>
  </parent>

So that the parent jar will be fetching from the repository.

like image 6
Baskar Felix Avatar answered Oct 18 '22 20:10

Baskar Felix


So In my case, After trying all the above options, I realized it was VPN (company firewall).once connected and ran cmd: clean install spring-boot:run. Issue is resolved. Step 1: check maven is configured correctly or not. Step 2: check settings.xml is mapped correctly or not. Step 3: verify if you are behind any firewall then map your repo urls accordingly. Step 4:run clean install spring-boot:run step 5: issue is resolved.

like image 2
Venugopal Avatar answered Oct 18 '22 21:10

Venugopal