0

I am using apache maven 3.1.0 (after quite some time) on windows for a project put together by somebody else. I have a parent pom & multiple child pom xml files. The child pom contains the following which is causing an issue when I run mvn clean install:

<parent> <groupId>com.test.platform</groupId> <artifactId>test-parent</artifactId> <version>0.0.1-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent> 

The error I get from mvn -e points to a dependency issue due to inability to find the artifact (referring to the 0.0.1-SNAPSHOT). I am not sure if I am missing a step or need to change something with my project/pom xml files. Any useful suggestions would be welcome (I can post more detailed error messages if needed). Thanks!

Update: I have also tried adding a relative path to the child pom xml file though its still giving me an error.

Directory Structure:

 Main Directory -> pom.xml file Child Directory -> pom.xml file (with parent tag) - I added the relative section to it as well. 
3
  • 1
    Can you post a directory structure of your project with pom.xml files locations? Commented Aug 22, 2013 at 19:30
  • @Andrew - thank you for commenting - I added the structure (let me know if not clear). The pom.xml referring to the parent pom is one directory in (I tried adding the relativePath but its not working as of now). Commented Aug 22, 2013 at 19:36
  • relativePath setting is needed only when you have a custom directory structure. In your case it is not needed. Most probably, version of your parent (or group, or artifact) is not as you've defined in your child module. Commented Aug 23, 2013 at 10:59

1 Answer 1

1

Interesting that the Introduction to the POM shows the relativePath as pointing directly to the pom.xml file, whereas the POM reference shows the relativePath pointing to the parent module/project, and not to the pom. Perhaps it supports both, but I can tell you that the project I'm looking at now (which works) has <relativePath>../myParentProject</relativePath>

Perhaps you could try to set the relative path in your project to ../

Of course, this all assumes that the answer to the question of whether 0.0.1-SNAPSHOT of the parent actually exists in your repository is YES.

Sign up to request clarification or add additional context in comments.

4 Comments

thanks - I already added the relativePath but it did not resolve the issue (unless I misunderstood your response). Thank you for sharing!
My point is that you set the relativePath to ../pom.xml according to your question and I'm wondering if you tried setting it to ../ which the POM reference shows.
I tried your suggestion but it did not work - thank you once again for sharing. I probably need to spend more time debugging on my end. +1 for the effort.
Please paste the exact error maven is giving you. Do you have a 0.0.1-SNAPSHOT version of the parent artifact in your local maven repository?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.