You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Elliotte Rusty Harold <el...@ibiblio.org> on 2018/07/19 18:13:22 UTC

Programmatic access to enforcer plugin

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
elharo@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Programmatic access to enforcer plugin

Posted by Laird Nelson <lj...@gmail.com>.
On Sat, Jul 21, 2018 at 9:27 AM Elliotte Rusty Harold <el...@ibiblio.org>
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

Re: Programmatic access to enforcer plugin

Posted by Elliotte Rusty Harold <el...@ibiblio.org>.
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 <kh...@gmx.de> 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
elharo@ibiblio.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Programmatic access to enforcer plugin

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org