I found a way to get my plugin dependencies from outside:
@SuppressWarnings("unchecked")
List<Artifact> pluginArtifacts =
pluginManager.getPluginDescriptorForPrefix("myPrefix").getArtifacts();
Artifact plugin = null;
for(Artifact artifact: pluginArtifacts){
if(artifact.getArtifactId().equals("theArtifactImLookingFor")){
plugin = artifact;
break;
}
}
Cheers,
Kai
2010/2/23 Stephen Connolly <[email protected]>
> ahh you want the dependencies of your plugin... as distinct from the
> dependencies of the project your plugin is running in... I can't remember
> exactly what you need to inject... somebody (Benjamin maybe) might have it
> on the tip of their tongue... otherwise you'll have to wait while I look it
> up
>
> Sent from my [rhymes with tryPod] ;-)
>
>
> On 23 Feb 2010, at 00:50, Kai Hackemesser <[email protected]>
> wrote:
>
> Ok, I can try that. How can I get the dependencies of the current plugin?
>> I
>> tried to get them with
>> pluginManager.getPluginDefinitionForPrefix("myprefix", session,
>> project).getDependencies() but that returned only an empty list.
>>
>> Cheers,
>> Kai
>>
>> 2010/2/23 Stephen Connolly <[email protected]>
>>
>> depending on another maven plugin is a bad plan. Due to issues with how
>>> Maven 2 loads plugins, the first version of a plugin loaded in a
>>> multi-module build is the only version that is loaded.
>>>
>>> Maven 3 will fix this somewhat, but in essence your build will be
>>> completely
>>> unpredictable if you try to depend on another plugin.
>>>
>>> IIRC getting the resolved dependencies is actually quite easy from within
>>> maven (just annotate the mojo with @requiresDependencyResolution scope
>>> where
>>> scope is the scope you require and then I think annotate a field with
>>> @parameter expression="${project.artifacts}" or something similar...
>>> you're
>>> making your life more complex by trying to depend on a separate plugin
>>>
>>> -Stephen
>>>
>>> On 22 February 2010 21:59, Kai Hackemesser <[email protected]
>>>
>>>> wrote:
>>>>
>>>
>>> Hi, James,
>>>>
>>>> that tip is almost good! But this one executes the mojo, and I want to
>>>>
>>> have
>>>
>>>> the mojo object accessible, as I want to access a field. In more
>>>> details,
>>>>
>>> I
>>>
>>>> want to call the getResults() method on ResolveDependenciesMojo to get
>>>>
>>> hold
>>>
>>>> of the dependencies.
>>>> The actual scenario: I want to build a classpath string containing some
>>>> dependencies of the plugin and the dependencies of the current project.
>>>>
>>> Or
>>>
>>>> I
>>>> need a list of resolved jar files for the same set of dependencies.
>>>>
>>>> Cheers,
>>>> Kai
>>>>
>>>
>>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>