“Non-resolvable parent POM: Could not transfer artifact” when trying to refer to a parent pom from a child pom with ${parent.groupid}

后端 未结 4 1371
南方客
南方客 2021-02-12 20:40

I\'m following a tutorial for maven. I have a very simple project with a couple of modules inside. On the module pom I want to reference the main proyect pom version and group t

相关标签:
4条回答
  • 2021-02-12 20:53

    I assume the question is already answered. If above solution doesn't help in solving the issue then can use below to solve the issue.

    The issue occurs if sometimes your maven user settings is not reflecting correct settings.xml file.

    To update the settings file go to Windows > Preferences > Maven > User Settings and update the settings.xml to it correct location.

    Once this is doen re-build the project, these should solve the issue. Thanks.

    0 讨论(0)
  • 2021-02-12 20:55

    I had the same issue. Fixed by adding a pom.xml in parent folder with <modules> listed.

    0 讨论(0)
  • 2021-02-12 20:58

    Looks like you're trying to both inherit the groupId from the parent, and simultaneously specify the parent using an inherited groupId!

    In the child pom, use something like this:

    <modelVersion>4.0.0</modelVersion>
    
    <parent>
      <groupId>org.felipe</groupId>
      <artifactId>tutorial_maven</artifactId>
      <version>1.0-SNAPSHOT</version>
      <relativePath>../pom.xml</relativePath>
    </parent>
    
    <artifactId>tutorial_maven_jar</artifactId>
    

    Using properties like ${project.groupId} won't work there. If you specify the parent in this way, then you can inherit the groupId and version in the child pom. Hence, you only need to specify the artifactId in the child pom.

    0 讨论(0)
  • 2021-02-12 21:13

    As Nayan said the Path has to updated properly in my case the apache-maven was installed in C:\apache-maven and settings.xml was found inside C:\apache-maven\conf\settings.xml

    if this doesn't work go to your local repos
    in my case C:\Users\<<"name">>.m2\
    and search for .lastUpdated and delete them
    then build the maven

    0 讨论(0)
提交回复
热议问题