Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] resolving implicit dependency in project configurator

Thanks for the responses, Fred and Igor.

1. For now Fred's solution works for me.  I do see the problems with
it if there are some funky poms hanging around (which seems to be the
case more often than not).  So, it may be that I have to move on to
Igor's more sophisticated solution.

2. The plugin that I am doing the configuration for is doing things
that are tricky enough that the configurator should delegate to it for
part of the work.  I haven't actually tried Fred's solution for this
one, but looking at the code, it seems what I need.

On Thu, May 31, 2012 at 7:56 PM, Igor Fedorenko <igor@xxxxxxxxxxxxxx> wrote:
> I have not looked at Fred's answer, but here is an alternative take ;-)
>
> 1. This is actually tricky. "Proper" implementation has to resolve
> dependencies in the context of a project, which will take into account
> project-specific repositories, dependencyManagement and other aspects of
> maven dependency resolution logic. The easiest way to do this is to
> inject <dependency> element into MavenProject model and let standard
> m2e/maven dependency resolver do its thing. There is prototype support
> for doing this from m2e extensions, but it is not used by any extension
> I know of. If you are willing to risk it, have a look at
> ILifecycleMapping2 and DefaultMavenDependencyResolver. It should be
> possible to subclass/wrap DefaultMavenDependencyResolver and
> inject implicit dependencies before delegating to the default
> implementation. As usual, if this does not work, I am willing to
> consider quality patches.
>
> 2. As explain in [1], lifecycle mapping metadata provided by m2e
> extensions takes preference over metadata provided by maven plugins. In
> other words, m2e will use mapping metadata provided by your extension
> and ignore the plugin's.
>
> [1] http://wiki.eclipse.org/M2E_plugin_execution_not_covered
>
> --
> Regards,
> Igor
>
>
> On 12-05-31 12:31 PM, Andrew Eisenberg wrote:
>>
>> Some more, related questions.
>>
>> 1. It turns out that not only do I need to add a single dependency,
>> but I also need to add some transitive dependencies.  What is the
>> recommended way to track down transitive dependencies
>>
>> 2. The plugin that I am writing the configurator for already has a
>> lifecycle-mapping-metadata.xml included.  It has this action:
>>                         <action>
>>                                 <execute>
>>
>> <runOnIncremental>true</runOnIncremental>
>>
>> <runOnConfiguration>false</runOnConfiguration>
>>                                 </execute>
>>                         </action>
>> Now, the configurator needs to do more than just execute the plugin.
>> I first need to configure a few natures, add a few things to the
>> classpath, etc.  And then I need to execute the plugin.  What is the
>> recommended way of doing this?
>>
>> thanks for your help.
>>
>> Andrew
>>
>> On Wed, May 30, 2012 at 3:16 PM, Andrew Eisenberg<andrew@xxxxxxxxxxxx>
>>  wrote:
>>>
>>> Yep.  This works.  Very nice.
>>>
>>> On Wed, May 30, 2012 at 1:16 PM, Andrew Eisenberg<andrew@xxxxxxxxxxxx>
>>>  wrote:
>>>>
>>>> Thanks.  I'll give this a try.
>>>>
>>>> On Wed, May 30, 2012 at 12:25 PM, Igor Fedorenko<igor@xxxxxxxxxxxxxx>
>>>>  wrote:
>>>>>
>>>>> IMaven#resolve can be used to resolve an artifact from specified Maven
>>>>> repositories. This call will download the artifact if necessary. There
>>>>> is currently no proper way to force re-resolution of the artifact if
>>>>> it's available in maven local repository, but you may be able to use
>>>>> ArtifactRepository.setReleaseUpdatePolicy and/or
>>>>> .setSnapshotUpdatePolicy.
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Igor
>>>>>
>>>>>
>>>>> On 12-05-30 1:39 PM, Andrew Eisenberg wrote:
>>>>>>
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I am creating a project configurator for a maven plugin and maven
>>>>>> extension.  The extension (among other things) adds an implicit
>>>>>> dependency to the project.  I would like to replicate this
>>>>>> functionality inside of the project configurator.  I know the
>>>>>> artifact, group, and version of the dependency.  My question is: how
>>>>>> to I resolve that to get a jar file in the local repo?  Furthermore,
>>>>>> if the artifact has not been downloaded yet, how do I force it to be
>>>>>> so?
>>>>>>
>>>>>> thanks,
>>>>>> _______________________________________________
>>>>>> m2e-dev mailing list
>>>>>> m2e-dev@xxxxxxxxxxx
>>>>>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> m2e-dev mailing list
>>>>> m2e-dev@xxxxxxxxxxx
>>>>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>>
>> _______________________________________________
>> m2e-dev mailing list
>> m2e-dev@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/m2e-dev
>
> _______________________________________________
> m2e-dev mailing list
> m2e-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/m2e-dev


Back to the top