Maven: Non-resolvable parent POM

后端 未结 14 1523
一整个雨季
一整个雨季 2020-12-02 11:04

I have my maven project setup as 1 shell projects and 4 children modules. When I try to build the shell. I get:

[INFO] Scanning for projects...
[ERROR] The b         


        
相关标签:
14条回答
  • 2020-12-02 11:18

    verify if You have correct values in child POMs

    GroupId
    ArtefactId
    Version
    

    In Eclipse, for example, You can search for it:

    0 讨论(0)
  • 2020-12-02 11:18

    <relativePath>

    If you build under a child project, then <relativePath> can help you resolve the parent pom.

    install parent pom

    But if you build the child project out of its folder, <relativePath> doesn't work. You can install the parent pom into your local repository first, then build the child project.

    0 讨论(0)
  • 2020-12-02 11:21

    I had the issue that two reactor build pom.xml files had the same artefactId.

    0 讨论(0)
  • 2020-12-02 11:22

    Alternative reason also might be the parent artifact comes from repository which is not accessible from pom.xml, typically private repository. The solution was to provide that repository in pom.xml:

    <repositories>
        <repository>
            <id>internal-repo</id>
            <name>internal repository</name>
            <url>https://my/private/repo</url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>
    

    In my case the problem was even more complicated due to Eclipse: the repository was active only in special profile (<profiles><profile><id>activate-private-repo</id><repositories>...) and Maven GUI in Eclipse didn't allow to set this profile through Ctrl+Alt+P shortcut.

    The solution was to temporarily declare repository outside profile (unconditionally), launch Alt+F5 Maven Update Project, activate profile and put repository declaration back into profile. This is rather Eclipse bug, not Maven bug.

    0 讨论(0)
  • 2020-12-02 11:22

    I had similar problem at my work.

    Building the parent project without dependency created parent_project.pom file in the .m2 folder.

    Then add the child module in the parent POM and run Maven build.

    <modules>
        <module>module1</module>
        <module>module2</module>
        <module>module3</module>
        <module>module4</module>
    </modules>
    
    0 讨论(0)
  • 2020-12-02 11:22

    I solved that problem on me after a very long try, I created another file named "parent_pom.xml" in child module file directory at local and pasted contents of parent_pom.xml,which is located at remote, to newly created "parent_pom.xml". It worked for me and error message has gone.

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