Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Finding artifacts for plugin dependencies.

I had to do something similar to this a while back, and it ended up being a little tricky. Since you have access to a list of Dependency objects from the plugin, you should be able to convert them to Artifacts.

Take a look at IMaven.resolve(). If you have a Dependency object and a Maven project, you have enough information to call resolve and get back an artifact (the project itself should have a list of artifact/plugin artifact repositories). You can get an instance of IMaven by calling MavenPlugin.getMaven().

I'm not sure if it is the best way to do what you want, but it is the only way I know of.

- Spencer

On Jul 13, 2011, at 1:39 PM, Ian Robertson wrote:

This may be a stupid question, but how can I do that? I don't see any method on Artifact that would allow me to do that. (If there is some place that documents this, I'd be happy to dig this up on my own, but so far I haven't found anything).

  - Ian

On 07/13/2011 12:05 PM, Jeff MAURY wrote:
Ian,

you should probably find the dependencies of your plugin from the Artifact object.

Regards
Jeff MAURY

On Wed, Jul 13, 2011 at 7:45 PM, Ian Robertson <irobertson@xxxxxxxxxxxxx> wrote:
Thanks Jeff. Unfortunately, it appears that getPluginArtifacts will get me the artifacts for each of the plugins; what I need are the artifacts for the dependencies of a given plugin.

For example, if I were writing a configurator for findbugs, I might want to find artifact for the version of the findbugs jar which the findbugs-maven-plugin depends on.

  - Ian


On 07/13/2011 11:01 AM, Jeff MAURY wrote:
Ian,

call the getPluginArtifacts method: it returns a Set<Artifact> for the plugins.

Regards
Jeff MAURY

On Wed, Jul 13, 2011 at 6:51 PM, Ian Robertson <irobertson@xxxxxxxxxxxxx> wrote:
I'm writing a ProjectConfigurator (extending
AbstractProjectConfigurator), and one of the things I need to be able to
do is to locate an artifact which is a dependency of a maven plugin. If
request is the ProjectConfigurationRequest parameter passed to
configure, then I can locate the plugin via
request.getMavenProject().getBuildPlugins(), and I can further get
dependencies from the plugin by calling getDependencies on the plugin.
However, what I need is the actual resolved
org.apache.maven.artifact.Artifact. If these were dependencies of the
project, I could call get getArtifacts; what's the solution for plugin
dependencies?

 - Ian


CONFIDENTIALITY NOTICE:  This message is intended only for the use and review of the individual or entity to which it is addressed and may contain information that is privileged and confidential.  If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message solely to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.  If you have received this communication in error, please notify sender immediately by telephone or return email.  Thank you.
_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev



--
"Legacy code" often differs from its suggested alternative by actually working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury


CONFIDENTIALITY NOTICE: This message is intended only for the use and review of the individual or entity to which it is addressed and may contain information that is privileged and confidential. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message solely to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify sender immediately by telephone or return email. Thank you.



--
"Legacy code" often differs from its suggested alternative by actually working and scaling.
 - Bjarne Stroustrup

http://www.jeffmaury.com
http://riadiscuss.jeffmaury.com
http://www.twitter.com/jeffmaury


CONFIDENTIALITY NOTICE: This message is intended only for the use and review of the individual or entity to which it is addressed and may contain information that is privileged and confidential. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering the message solely to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify sender immediately by telephone or return email. Thank you.
_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev


Back to the top