开发者

Maven : wrong local POM and versioning issue

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 .


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>


Update maven with force update of Snapshot/Release

right click on project-->maven-->update project-->check force update of snapshot 


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜