[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] Issue not resolving dependencies when IDE starts
|
Igor,
Thanks very much for your time and the valuable input! We'll look into
this and provide a patch if possible when time permits.
Regards,
Ben.
On 14/02/2012 1:58 AM, Igor Fedorenko wrote:
Ben,
Short answer, I think you are right, it is currently not possible to
implement what you are trying to do. I think this is an interesting
usecase, provide a quality patch and I will review and apply it.
From implementation standpoint, have a look at
AbstractMavenDependencyResolver internal experimental API, which was
meant to support similar usecase.
When IMavenProjectFacade is first read, you can use
AbstractMavenDependencyResolver to populate MavenProject instance with
additional dependencies and these additional dependencies will be
captured in IMavenProjectFacade.getMavenProjectArtifacts().
When IMavenProjectFacade.getMavenProject(IProgressMonitor) is used after
workspace restart, there is currently no way to introduce additional
dependencies to the MavenProject instance being read. I think
IMavenProjectFacade.getMavenProject(IProgressMonitor) should delegate to
AbstractMavenDependencyResolver somehow and I actually prototyped this
couple of years ago but don't remember why I did not keep this.
--
Regards,
Igor
On 12-02-13 1:54 AM, Ben Jones wrote:
Hi Igor,
I can't see how to use the IMavenProjectFacade to help me retain the
project information. If I do this in my code:
* MavenProject mavenProject = facade.getMavenProject();
* Add some dependencies to the maven project
o mavenProject.getDependencies() gets all the new dependencies
added programatically
o I iterate over mavenProject.getDependencies() and add them to
the resolveProjectDependencies method's 'requirements' argument
(a Set<RequiredCapability>)
* At this point, the new dependencies show up in the POM editor's
dependency heirarchy and resolved dependency lists
But on restart the dependencies I added are gone.
I can't see any methods on the IMavenProjectFacade interface to help
with this - I'm getting the project from the facade, but is there
something else I should do after that? - something to sync/flush the
cached info?
Thanks!
Ben.
On 20/12/2011 9:40 AM, Ben Jones wrote:
Aha thank you, I think that could be the problem!
Currently in resolveProjectDependencies I add to the 'requirements'
set, adding in the dynamic dependencies. The dependencies are ones
which the javascript-maven-plugin (the Maven plugin, not the Eclipse
one) dynamically adds to the Maven project - this works fine from the
command line but m2e doesn't see these dynamically added dependencies.
So that the moment, I instantiate an instance of our Maven
extension, read the dependencies from it (to avoid having to duplicate
the dependency configuration), and then add them to the 'requirements'
set. I think if I add them to the facade instead, they may be
retained. It should be pretty easy to try, we will post back and let
you know how it goes.
Thanks again,
Ben.
On 20/12/2011 9:34 AM, Igor Fedorenko wrote:
Let me rephrase my question.
What code requires those dependencies?
How does that code access those dependencies?
And what triggers execution of that code?
IMavenProjectFacade provides both persistent cache of frequently used
MavenProject attributes, including project dependencies. It also
provides a mechanism to lazy load and cache in-memory MavenProject
instance. This is the interface you want to use from your code.
--
Regards,
Igor
On 11-12-19 5:25 PM, Ben Jones wrote:
Thanks for the response Igor.
The dynamically added dependencies aren't retained when the workspace
restarts - these are dependencies which we add in programatically
from
resolveProjectDependencies().
Regards,
Ben.
On 19/12/2011 10:51 PM, Igor Fedorenko wrote:
Why do you need to read MavenProject instance of workspace
restart? It
is very expensive from performance point of view, especially for
large
workspaces, and m2e tries pretty hard to delay reading MavenProject
instances on startup. Resources folders and Maven dependencies
classpath
container are expected to survive workspace restart.
--
Regards,
Igor
On 11-12-15 12:45 AM, Ben Jones wrote:
Hi,
I've been working with Christopher on the javascript-maven-tools
project
and have implemented the first version of our m2e plugin which
provides
IDE support for our javascript-maven-plugin [1], following on from
the
direction Igor gave Chris in their recent discussion.
I've got most things working now using the lifecycleMappings and
lifecycleMappingsMetadataSource extension points; we get the
dynamically
configured dependencies resolved via m2e and we get dynamically
configured resource folders visible in Eclipse as source folders.
There is one major issue remaining and I'm hoping someone
may be
able to point us in the right direction - when you start the IDE
with an
open maven project which uses the javascript-maven-plugin
extension,
neither the ILifecycleMapping.configure() method or the
AbstractMavenDependencyResolver.resolveProjectDependencies()
method are
called, so none of our custom project configuration happens. The
workaround is to manually right-click on the project and select
"Maven
> Update Project Configuration".
I note that when if the project is closed when you start the
IDE,
when you open the project these methods are called and
configuration
occurs as expected. But I'm not sure of the right place to allow
us to
run our plugin code when the editor is started with an open
project.
You can see the project source online here [2] if that helps
(and
the main class is here [3]).
Any pointers as to the right way to do this would be appreciated.
Thanks,
Ben Jones.
[1]
http://mojo.codehaus.org/javascript-maven-tools/javascript-maven-plugin/index.html
[2]
https://fisheye.codehaus.org/browse/mojo/trunk/mojo/javascript-maven-tools/javascript-ide-helpers/javascript-maven-plugin-m2e/
[3]
https://fisheye.codehaus.org/browse/mojo/trunk/mojo/javascript-maven-tools/javascript-ide-helpers/javascript-maven-plugin-m2e/src/org/codehaus/mojo/javascript/m2e/JavascriptMavenToolsLifecycleMapping.java?r=15572
_______________________________________________
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
_______________________________________________
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