bsky
bsky

Reputation: 20242

Failure to find project in Maven repository

I have a Maven module with a submodule.

The relevant part of the parent is this:

  <groupId>my.package.name</groupId>
  <artifactId>parent-module</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>my.package.name</name>

  <modules>
      <module>child-module</module>
  </modules>

The relevant part of the child is:

      <groupId>my.package.name</groupId>
      <artifactId>child-module</artifactId>
      <version>1.0-SNAPSHOT</version>
    
      <name>my.package.name</name>
    
      <parent>
          <groupId>my.package.name</groupId>
          <artifactId>parent-module</artifactId>
          <version>1.0</version>
          <relativePath>../pom.xml</relativePath> <!-- not necessary -->
      </parent>

For this, I'm getting:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for my.package.name:child-module:1.0-SNAPSHOT: Failure to find my.package.name:parent-module:pom:1.0 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 11, column 13
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project my.package.name:child-module:1.0-SNAPSHOT (/path/to/parent-module/child-module/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for my.package.name:child-module:1.0-SNAPSHOT: Failure to find my.package.name:parent-module:pom:1.0 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 11, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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

The XML files are located at:

/parent-module/child-module/pom.xml

/parent-module/pom.xml

So why is it trying to find the parne module in the online Maven repository? Why doesn't see it locally?

Upvotes: 2

Views: 3874

Answers (2)

ravthiru
ravthiru

Reputation: 9633

Failure to find my.package.name:parent-module:pom:1.0

Your parent version is <version>1.0-SNAPSHOT</version>, but in the child pom.xml parent version is <version>1.0</version> make it same

Upvotes: 3

Anton Dozortsev
Anton Dozortsev

Reputation: 4902

Try to execute:

mvn -U clean install

Using Maven's -U Command Line Option

Upvotes: 1

Related Questions