Programmatic access to enforcer plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Programmatic access to enforcer plugin

Elliotte Rusty Harold
Short of forking the project, is any sort of programmatic API for the
Maven enforcer plugin available? E.g. I'd like to point a rule at a
dependency coordinates and get a report back in a somewhat more
structured form than System.out.println.

Has anyone done something like this? Are there any docs better than
reading the source code? Thanks.

--
Elliotte Rusty Harold
[hidden email]

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

Reply | Threaded
Open this post in threaded view
|

Re: Programmatic access to enforcer plugin

Karl Heinz Marbaise-3
Hi,

can explain more in detail what you like to achieve? Best would be based
on an example...

Apart from that maven-enforcer is intended to check for rules which if
someone violates the defined rules...not really intended to make a
report ?...


Kind regards
Karl Heinz Marbaise

On 19/07/18 20:13, Elliotte Rusty Harold wrote:
> Short of forking the project, is any sort of programmatic API for the
> Maven enforcer plugin available? E.g. I'd like to point a rule at a
> dependency coordinates and get a report back in a somewhat more
> structured form than System.out.println.
>
> Has anyone done something like this? Are there any docs better than
> reading the source code? Thanks.
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Programmatic access to enforcer plugin

Elliotte Rusty Harold
There exists a very large group of open source libraries, some my
organization owns and a few we don't. It is not currently possible to
find a convergent set of versions for these libraries, and it's hard
to collect a set of versions that doesn't hit no such method errors
and other serious incompatibilities.

I want to generate a list of the version conflicts across all these
libraries, and then create an ordered list of the dependency upgrades
that need to be patched in and shipped so we can publish a BOM of
versions that at least work together, even if they're not necessarily
all the latest version. Then I want to keep publish newer versions of
the BOM as new versions of the dependencies ship.

We can't afford to simply fail the build of all the components on the
first convergence error. We tried that and it became quickly obvious
that none of them would or could build if we did. This is going to be
a multistep fix.

I'm considering whether it may be necessary to drop deeper down the
stack and write my own code to check for dependency convergence. I
actually have some existing Aether code that queries the repos for a
complete dependency graph. Unfortunately parts of it depend on M2E
which I don't want to use for this project. So I would need to rewrite
those lines to use org.apache.maven instead. If anyone has sample code
that queries repos for dependencies without M2E, that would also be
helpful.


On Thu, Jul 19, 2018 at 4:08 PM, Karl Heinz Marbaise <[hidden email]> wrote:

> Hi,
>
> can explain more in detail what you like to achieve? Best would be based on
> an example...
>
> Apart from that maven-enforcer is intended to check for rules which if
> someone violates the defined rules...not really intended to make a report
> ?...
>
>
> Kind regards
> Karl Heinz Marbaise
>
>
> On 19/07/18 20:13, Elliotte Rusty Harold wrote:
>>
>> Short of forking the project, is any sort of programmatic API for the
>> Maven enforcer plugin available? E.g. I'd like to point a rule at a
>> dependency coordinates and get a report back in a somewhat more
>> structured form than System.out.println.
>>
>> Has anyone done something like this? Are there any docs better than
>> reading the source code? Thanks.
>>
>



--
Elliotte Rusty Harold
[hidden email]

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

Reply | Threaded
Open this post in threaded view
|

Re: Programmatic access to enforcer plugin

ljnelson
On Sat, Jul 21, 2018 at 9:27 AM Elliotte Rusty Harold <[hidden email]>
wrote:

> If anyone has sample code
> that queries repos for dependencies without M2E, that would also be
> helpful.


I've put together a project that runs Maven/Aether dependency resolution
internals in a CDI 2.0 SE container:
https://microbean.github.io/microbean-maven-cdi/.  Put this jar and its
dependencies on your classpath, start a CDI 2.0 SE container, and off you
go (
https://github.com/microbean/microbean-maven-cdi/blob/c5abd2e3c321020c419442c44ef726e48952d983/src/test/java/org/microbean/maven/cdi/TestMavenExtension.java#L91-L111
).

For those who are curious, Aether has a long history and is now known as
maven-resolver:
https://lairdnelson.wordpress.com/2017/03/06/maven-and-the-project-formerly-known-as-aether/

You can find examples of various kinds here:
https://github.com/apache/maven-resolver/tree/master/maven-resolver-demos/maven-resolver-demo-snippets/src/main/java/org/apache/maven/resolver/examples

Hope that helps,
Best,
Laird