You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Mike Bowler <mb...@GargoyleSoftware.com> on 2003/02/08 21:12:55 UTC

Validating the pom

Using a build of maven pulled from cvs yesterday.

I'm trying to figure out how to validate my project.xml file.  There is 
a maven-project.xsd schema file in the maven sources so I'm assuming 
it's just a matter of figuring out how to get maven to use this schema.

Looking at the goals in maven, I see the following possibilities

[codeswitcher] ( NO DEFAULT GOAL )
   init ....................... Validate the Maven XML project descriptor

[pom] : Validate the Maven XML project descriptor
   validate ................... Validate the Maven XML project descriptor

[validate-pom-for-release] : null

I deliberately put a mistake in my project.xml file to see if schema 
validation is actually being done.  The codeswitcher and 
valide-pom-for-release goals just return without doing anything.  The 
pom:validate target dumps this one line to the console:

java.lang.reflect.InvocationTargetException

I couldn't find a stack trace for this in either maven.log or 
velocity.log (the two logs created during the maven run)

So my questions are:

1) How are you supposed to trigger schema validation of project.xml?

2) Where would you expect to find the stack trace when the console says 
there was an exception?

-- 
Mike Bowler
Principal, Gargoyle Software Inc.
Voice: (416) 822-0973 | Email  : mbowler@GargoyleSoftware.com
Fax  : (416) 822-0975 | Website: http://www.GargoyleSoftware.com


Re: Validating the pom

Posted by Mike Bowler <mb...@GargoyleSoftware.com>.
Colin Sampaleanu wrote:
 > You can use -e to to have maven print stack traces...

-e seems to have solved both problems.  In addition to giving me a full 
stack trace, "maven -e pom" is now dumping out information that appears 
to be the results of schema validation.


-- 
Mike Bowler
Principal, Gargoyle Software Inc.
Voice: (416) 822-0973 | Email  : mbowler@GargoyleSoftware.com
Fax  : (416) 822-0975 | Website: http://www.GargoyleSoftware.com


Re: Validating the pom

Posted by Colin Sampaleanu <co...@exis.com>.
Mike Bowler wrote:

> Using a build of maven pulled from cvs yesterday.
>
> I'm trying to figure out how to validate my project.xml file.  There 
> is a maven-project.xsd schema file in the maven sources so I'm 
> assuming it's just a matter of figuring out how to get maven to use 
> this schema.
>
> Looking at the goals in maven, I see the following possibilities
>
> [codeswitcher] ( NO DEFAULT GOAL )
>   init ....................... Validate the Maven XML project descriptor
>
> [pom] : Validate the Maven XML project descriptor
>   validate ................... Validate the Maven XML project descriptor
>
> [validate-pom-for-release] : null
>
> I deliberately put a mistake in my project.xml file to see if schema 
> validation is actually being done.  The codeswitcher and 
> valide-pom-for-release goals just return without doing anything.  The 
> pom:validate target dumps this one line to the console:
>
> java.lang.reflect.InvocationTargetException
>
> I couldn't find a stack trace for this in either maven.log or 
> velocity.log (the two logs created during the maven run)
>
> So my questions are:
>
> 1) How are you supposed to trigger schema validation of project.xml? 

This may not be as simple as it may appear, since in fact project.xml 
(and maven.xml) are jelly scripts, and essentially anything goes as long 
as the final output structure is ok (I guess you could validate that). 
While I don't think general scripting is encouraged in project.xml, it's 
certainly possible... On this basis, validating maven.xml would probably 
be completely out of the question.

> 2) Where would you expect to find the stack trace when the console 
> says there was an exception? 

You can use -e to to have maven print stack traces...



>
>