1

I have 4 Modules (4 POM XML files ) and one parent XML file

I have this directory structure , please refer to the screen shot

http://postimage.org/image/1gjk3mdg/

Currently this error is occuring when i ran the Parent POM.xml file (which internally runs all the Module's POM xml files)

The project com.bayer:tata-mw:1.0 (C:\tata\middleware\pom.xml) has 1 error [ERROR] Non-resolvable parent POM: Could not find artifact com.bayer:tata:pom:1.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 9, column 12 -> [Help 2]

To resolve the Parent POM error i am refering like this on to my child POM.xml file

 <parent>
      <groupId>com.bayer</groupId>
      <artifactId>tata</artifactId>
      <version>1.0-SNAPSHOT</version>
        <relativePath>c:/tata/pom.xml</relativePath>
   </parent>

Please guide me whether this is correct approach or not , becuase when i did that the error still persists .

Thank you .

Pawan
  • 31,545
  • 102
  • 256
  • 434
  • Could you add information how you created that structure? For the normal structure of a multi-module project, see http://stackoverflow.com/questions/7592857/maven-application-got-5-modules-and-6-pom-xml-files/7592923#7592923 – mliebelt Sep 29 '11 at 07:48

4 Answers4

11

In parent section, relativePath xml tag should point to a path in ... relative !

Like :

<parent>
   <groupId>com.bayer</groupId>
   <artifactId>tata</artifactId>
   <version>1.0-SNAPSHOT</version>
   <relativePath>../pom.xml</relativePath>
</parent>
jurevert
  • 246
  • 4
  • 7
1

Update maven with force update of Snapshot/Release

right click on project-->maven-->update project-->check force update of snapshot 
Nirbhay Rana
  • 4,229
  • 2
  • 18
  • 4
1

follow below steps -

1- Create a Parent Maven project

Go to your .m2 folder( C:\Users.m2 ) and delete all repository.

2- Go your Maven project

Update your Maven Project

-1

Simply add an empty <relativePath/> to so that it can resolve the parent pom -

<parent>
    <groupId>com.proj</groupId>
    <artifactId>com.proj.api</artifactId>
    <version>0.1.1</version>
    <relativePath></relativePath>
  </parent>

Another preffered way to create modular maven projects is to follow below steps -

1- Create a Parent Maven project

new-->project-->Maven Project-->Check Create a simple project checkbox-->provide all Maven Ids

2- Create Maven Module and add the module to previously created parent project

new-->other..-->Maven Module-->Check Create simple project checkbox-->name your module -->Browse Parent projst-->select previously created project

Puneet Pandey
  • 960
  • 2
  • 14
  • 28