Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] MavenProject.get[Test|Compile]ClasspathElements() for mojos launched via M2E

You are looking for something we call "workspace dependency resolution".
It is enabled by default during workspace build but not in Run As Maven
Build launch configurations. To enable, check "Resolve Workspace
Artifacts" checkbos on the main tab of the launch configuration.

Beware that not all maven plugins are compatible with workspace
dependency resolution. Dependency plugin, for example, fails for
dependencies resolved from workspace projects. This is the reason the
checkbox is unchecked by default.

--
Regards,
Igor

On 2014-08-21, 19:12, John Fallows wrote:
When launching a Maven mojo goal from M2E via Run as... Maven build...,
the mojo goal implementation receives an injected MavenProject instance
representing the main project, and gets the test (or compile) classpath
elements.

This list of classpath elements contains all the resolved dependency
JARs from the local ~/.m2/repository directory.

However, when one of those dependencies is also imported into the same
Eclipse workspace, we were anticipating that the classpath element for
this dependency would no longer point at the dependency JAR in the local
~/.m2/repository directory, but instead point to the target/classes
directory of the dependent project present in the workspace.  This
approach seems to make sense, as it follows the same model as compile
classpath managed via the Maven classpath container in the Eclipse build
path.

Without this behavior, we need to perform the manual step of mvn install
on the dependent project before launching the Maven mojo goal on the
main project so that the mojo goal implementation can see the latest for
the dependency from the dependency project's installed JAR.

Q1. Is it possible to cause "mvn install" to be part of Eclipse's "Build
automatically" for the dependent project?
Q2. Does it make sense to M2E folks for the injected MavenProject to
point directly to target/classes for dependency projects imported to the
same Eclipse workspace?  If so, we are interested to help get this working.

Kind Regards,
John Fallows


--
*
John Fallows*
CTO/  | /Phone: +1.650.960.8148  |  Mobile: +1.415.215.6597
/----------------------------------------------------------------------/
KAAZING >|<
Event-Driven Communication. Fast. Secure. Mobile. Guaranteed.
Kaazing.com <http://www.kaazing.com/>  | Download
<http://kaazing.com/download.html>  | Blog <http://blog.kaazing.com/> |
Twitter <https://twitter.com/kaazing>




_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/m2e-users



Back to the top