maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. Lewis Muir" <jlm...@imca-cat.org>
Subject Re: Extension does not work from .mvn/extensions.xml
Date Tue, 20 Nov 2018 21:24:06 GMT
On Tue, Nov 20, 2018 at 1:01 PM Romain Manni-Bucau
<rmannibucau@gmail.com> wrote:
> Le mar. 20 nov. 2018 19:23, J. Lewis Muir <jlmuir@imca-cat.org> a écrit :
> > There's no way I can get the developers of the
> > software I'm planning to use this in to install the extension in
> > Maven's lib/ext; it has to be able to work from the project's
> > .mvn/extensions.xml.
>
> Even with mvnsh, maven opts or the -D?

Well, it's for a project where I'm not a core developer, so I don't
think there will be much support for anything that requires doing
something extra.

I doubt mvnsh would fly.

MAVEN_OPTS would work, but it's external and not with the project
source code, so it requires each developer to do some special setting
up.  I doubt it would fly.

The closest I can get would be -D in the project's .mvn/maven.config.
This would require adding the two JARs
(profile-activation-advanced-0.2.0.jar and mvel2-2.4.2.Final.jar) to
the project's source code repo, though.  That right there is already
undesirable.  And then, say the JARs were added under the project's
root at lib-ext, the following would need to be added to the project's
.mvn/maven.config:

  -Dmaven.ext.class.path=lib-ext/profile-activation-advanced-0.2.0.jar:lib-ext/mvel2-2.4.2.Final.jar

That's the closest I could get, and it requires the paths in the
maven.ext.class.path system property to be resolved relative to the
project root (so that the relative paths to the JAR files will be
correct), and I don't even know if that's guaranteed.

So, it's a pretty tough sell at this point.

> > I tried adding the Priority annotation, and it works from Maven's
> > lib/ext, but it also works *without* it, so I'm hesitant to add it
> > unless I know it's really necessary.  The readme file in Maven's
> > lib/ext says
>
> Without it you dont deactivate default one - you can check it debugging it.

Hmm, how can I check it by debugging?  I tried without the Priority
annotation with a breakpoint in AdvancedProfileActivator.isActive, and
I looked at the caller DefaultProfileSelector.isActive frame, which is
one frame down in the stack, and I see the AdvancedProfileActivator in
the DefaultProfileSelector's activators list, and I don't see the
default PropertyProfileActivator.  Attached is a screenshot.  Maybe
I'm looking in the wrong place?

Thanks!

Lewis


Mime
View raw message