mtk
mtk

Reputation: 13717

Verify whether pom.xml is correct maven 2.x

I generated the equivalent pom.xml from the project.xml which was built for a project based on maven 1.x, using the maven 2.1.0 version, with the following command

mvn one:convert

The pom.xml file was generated, and I edited it a lot, as I don't needed many of the things. Later, importing this project into eclipse Helios using Import --> Existing Maven project, I tried to import the project, but that gave me following warning and won't let me continue, as the Finish button was disabled.

maven

So, is there any way, I can validate the pom.xml as I am not able to figure out from the above, as there is no other meaning message. Probably, the xml might have messed up, or a unknown tag might have come due to wrong editing. Not sure.

Upvotes: 4

Views: 20043

Answers (2)

mtk
mtk

Reputation: 13717

I tried to do a mvn clean, from the command line, which showed that the tag <id> in the <contributors> is not defined.

I had added this tag on similar lines to <developer> tag, but <id> is not a part of <contributors>, which was the error that lead project not being imported into eclipse.

Removing this, project was easily imported.

Upvotes: 6

aldrinleal
aldrinleal

Reputation: 3619

The pom.xml is a XML Document after all.

Its 'header' has some extra tags for Schema Validation, so any regular Validating Editor could work (actually, even browsers - including IE -, are able to validate your pom.xml for crude XML Errors)

Why don't you simply open the pom.xml from Eclipse as a regular XML file?

(Hint: Copy/Paste into an existing project, perhaps under a different name, then in Project Explorer, Right Click the pom. Select "Open With" | "XML Editor")

Chances are that it will grab 80% of the problems.

(I'd dare to say the other 20% might be hidden under the "Error Log" View in Eclipse.)

Upvotes: 1

Related Questions