Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Resolve Maven plugin dependencies from target platform?

Personally, I consider this an antipatern. Such tight coupling between
code generator, runtime and generated code is just asking for troubles.

I don't see how to make this work. I don't believe there way to express
"this plugin depends on the same version of xtext runtime as the project
being built". If this was plain Maven project you could use
${xtext-version} property to link dependency and plugin/dependency
versions, but with Tycho this is not possible because xtext version
isn't known until well into the build.

--
Regards,
Igor

On 2014-11-06, 13:00, Andreas Sewe wrote:
Hi Igor,

thank you for your insights.

This is theoretically possible, but Tycho does not do this right now and
I am not aware of any attempts to implement this either.

I am not even sure you need/want to make this part of Tycho. What you
are looking for, basically, is Maven repository layout implementation
that is able to perform jar and pom (!) artifact lookup based on maven
artifactcoordinates. This is quite different from what Tycho does not
project dependencies.

The difficult part is, of course, figuring out how to represent OSGi
dependencies in Maven, but maybe you can get away by simply ignoring the
problem.

If you really need just couple of dependencies, however, it is probably
easier to manually publish the required artifacts to a Maven repository.
This is how we make equinox and jdt compiler available for Tycho [2].

I think the situation is different in case of the xtext-maven-plugin
(which may be a weird outlier, admittedly).

In the case of the JDT compiler you have an OSGi bundle that you want to
make available to your Maven build. A "mvn deploy:deploy-file" does just
that (of course, where the POM comes from is interesting). The JDT
compiler bundle is needed only as a dependency of the plugin, though.

In the case of the xtext-maven-plugin, however, some bundles like
org.eclipse.emf.ecore.xcore.lib are needed both by the plugin [1] (a
code generator) and by the project that the code is generated for [2].
Ideally, the project's and the plugin's org.eclipse.emf.ecore.xcore.lib
dependency would be identical. At the very least, their versions should
not diverge too much, as then the generated code would no longer work
with the org.eclipse.emf.ecore.xcore.lib used to compile/run it.

However, keeping the versions in sync is cumbersome, as the project
dependencies' versions are governed by the target platform and the
plugin dependencies' versions are governed by the pom.xml. Hope that
this explains a bit better what my perceived problem is (Disclaimer: I
am no Xtext/Xcore expert).

Best wishes,

Andreas

[1]
<https://git.eclipse.org/c/recommenders/org.eclipse.recommenders.git/tree/plugins/org.eclipse.recommenders.stacktraces.model/pom.xml?id=v2.1.10#n44>
[2]
<https://git.eclipse.org/c/recommenders/org.eclipse.recommenders.git/tree/plugins/org.eclipse.recommenders.stacktraces.model/META-INF/MANIFEST.MF?id=v2.1.10#n9>



Back to the top