Hi,

MNG-8650 (#10442) asks for a way to validate a POM. It's been open since
March with nobody saying what shape the answer should take, so I wrote one
to have something concrete to argue about. It's up as a draft:

  https://github.com/apache/maven/pull/13276

Backwards order, I know. There are two things in there I'd rather not decide
on my own.

First, packaging. I made it a separate binary, mvnval, next to mvnenc and
mvnup. My reasoning was that mvn and mvnsh run builds while mvnenc and mvnup
don't, and both of those got their own binary. A validator sits with the
second group. It's also the only POM-reading tool that never touches the
network, and that's an awkward thing to promise from behind a flag on mvn,
whose whole job is the opposite.

I saw the /lib bloat argument on #10316, so: it adds no dependency that
isn't already shipped for mvn.

If you'd rather have a flag on mvn, or nothing at all, say so. It's about
four lines of shell and one class that differ between the two, everything
else is the same either way.

Second, a method on ModelBuilder.ModelBuilderSession. buildRawModel(request)
hands back the Model and drops the problem collector, and build() throws the
moment validation reports an error. So right now there's no way to read a POM
and get the errors and the warnings both. I added buildRaw, a default method
that returns the result with its problems instead of throwing on them. That's
the part I'm least happy deciding alone, and it's a separate commit with its
own tests so it can land or get rejected on its own.

One thing that fell out of testing it against real POMs: the published
io.netty:netty-all:4.1.115.Final declares netty-transport-native-epoll:linux-x86_64
three times. So it does find things outside the synthetic cases.

Ivan


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to