You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Paul Benedict <pb...@apache.org> on 2016/08/11 18:06:42 UTC
Mojo support for dynamic requiresDependencyResolution?
The @Mojo annotation requires the Resolution Scope to be a static value.
Thus far, I haven't found any way to actually dictate this dynamically --
like through a configuration parameter, for example.
I understand the use of attribute "requiresDependencyResolution" is meant
to resolve dependencies before the plugin executes, but I don't see this as
insisting on a static value. That's an implementation choice, for sure. An
alternate solution -- "blue skying" here for a moment -- would be for a
mojo to implement an interface for pre-processing. For example:
@Mojo(name="hello", requiresDependencyResolution=DYNAMIC)
public HelloMojo
extends AbstractMojo
implements MojoDependencyResolutionProvider {
@Override
public void execute() ... { }
@Override
public String getMojoResolutionScope() { ... }
}
I am not proposing this as *the* solution but as an illustration of the
general concept I have in mind. This is illustrating after the parameters
inject but before the plugin executes (in its proper phase or otherwise).
WDYT?
Cheers,
Paul
Re: Mojo support for dynamic requiresDependencyResolution?
Posted by Robert Scholte <rf...@apache.org>.
Hi Paul,
my proposal[1] and yours have the same problem base, but a different
solution. In the wish to fully hide any resolution related logic, I might
need to add the option to specify DependencyFilters[2].
Have a look at it and see if we can work towards a solid solution.
thanks,
Robert
[1] https://issues.apache.org/jira/browse/MPLUGIN-302
[2]
https://maven.apache.org/shared/maven-common-artifact-filters/apidocs/org/apache/maven/shared/artifact/filter/resolve/package-frame.html
On Thu, 11 Aug 2016 20:06:42 +0200, Paul Benedict <pb...@apache.org>
wrote:
> The @Mojo annotation requires the Resolution Scope to be a static value.
> Thus far, I haven't found any way to actually dictate this dynamically --
> like through a configuration parameter, for example.
>
> I understand the use of attribute "requiresDependencyResolution" is meant
> to resolve dependencies before the plugin executes, but I don't see this
> as
> insisting on a static value. That's an implementation choice, for sure.
> An
> alternate solution -- "blue skying" here for a moment -- would be for a
> mojo to implement an interface for pre-processing. For example:
>
> @Mojo(name="hello", requiresDependencyResolution=DYNAMIC)
> public HelloMojo
> extends AbstractMojo
> implements MojoDependencyResolutionProvider {
>
> @Override
> public void execute() ... { }
>
> @Override
> public String getMojoResolutionScope() { ... }
>
> }
>
> I am not proposing this as *the* solution but as an illustration of the
> general concept I have in mind. This is illustrating after the parameters
> inject but before the plugin executes (in its proper phase or otherwise).
>
> WDYT?
>
> Cheers,
> Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org