Magically configuring a MavenPom object

I’m tying to configure a MavenPom object from within a Java Groovy plugin.

  1. The standard (Model)pom.getModel() fails because FilteringClassLoader means I can’t talk to Model.

So, we hit 2) Use something like ConfigureUtil.configureByMap() to inject all the properties. We get this far:

But while it can turn a Map<String, Object> into a nested Scm object, it apparently cannot turn a List<Map<String, Object>> into a List<Developer>. And I can’t construct a “new Developer()” because I can’t see it through FilteringClassLoader. And I don’t want to have one Groovy class in there just to construct a closure. Halp!?!

Or is there a fundamentally better way to do this?

The effect I am trying to produce is roughly this:


but in pure Java, not groovy. And I want it as a plugin, not in a build script because I have 10,00,0000,000 projects all with ALMOST the same build files, and I’m fed up with copying and editing them. So I’m factoring the whole show out into a plugin.

Thank you!

Current approach is to use MavenPom.project(Closure) and get the underlying FactoryBuilderSupport to build the object. It’s very ugly in Java, but that seems to be the only way to do it without doing a lot more ugly reflection?