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

后端 未结 6 1529
独厮守ぢ
独厮守ぢ 2021-02-02 07:35

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.projec         


        
相关标签:
6条回答
  • 2021-02-02 08:06

    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>
    
    0 讨论(0)
  • 2021-02-02 08:09

    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.

    0 讨论(0)
  • 2021-02-02 08:11

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

    0 讨论(0)
  • 2021-02-02 08:19

    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.

    0 讨论(0)
  • 2021-02-02 08:26

    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.

    0 讨论(0)
  • 2021-02-02 08:26
             ` Adding the following to pom.xml will resolve the issue.      <pluginRepositories>
            <pluginRepository>
                <id>central</id>
                <name>Central Repository</name>
                <url>https://repo.maven.apache.org/maven2</url>
                <layout>default</layout>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <releases>
                    <updatePolicy>never</updatePolicy>
                </releases>
            </pluginRepository>
       </pluginRepositories>
        
       <repositories>
            <repository>
                <id>central</id>
                <name>Central Repository</name>
                <url>https://repo.maven.apache.org/maven2</url>
                <layout>default</layout>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
       </repositories>   `
    
    0 讨论(0)
提交回复
热议问题