CHiRAG
CHiRAG

Reputation: 232

Maven parent POM issue

I have a parent POM that, I have used in my other project for dependency management. When I build my child project at that time, it will check in my repository to get parent pom. But at the same time is going to check for the maven central as well. But for obvious from there it is not found and with the exception, my build process is going to stop.

Can anyone tell me the reason why it is happening? Any help is appreciated.

For better understanding, I have attached a log.

[INFO] Downloading from bom-ci-maven: http://xxx:8800/api/v4/projects/xxx/packages/maven/com/xxx/project-bom/0.0.2-DEV/project-bom-0.0.2-DEV.pom
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/com/xxx/project-bom/0.0.2-DEV/project-bom-0.0.2-DEV.pom
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for com.xxx:xxx:0.0.2-SNAPSHOT: Could not find artifact com.xxx:project-bom:pom:0.0.2-DEV in bom-ci-maven (http://xxx:8880/api/v4/projects/xxx/packages/maven) and 'parent.relativePath' points at wrong local POM @ line 4, column 11
 @ 

Upvotes: 0

Views: 413

Answers (1)

Stanislav Bashkyrtsev
Stanislav Bashkyrtsev

Reputation: 15308

There are 2 ways to build a module separately from the rest of the modules, including parent.

  1. The best way is to run this from the root directory of your project (note -am):
mvn package -pl child -am
  1. Another option is more cumbersome, but may work faster if your module depends on multiple neighboring modules. First install all the dependencies into local repository. In case of snapshot dependencies it will cache it for some time and then will start checking remote Maven repositories again. This allows you to step into the child module and invoke commands relying on parent or other modules.

Additionally in case of <parent> you can specify a tag <relativePath>, but this one isn't recommended.

Upvotes: 0

Related Questions