Discussion:
[tycho-user] What packaging to use for a myapp.target project?
Steinar Bang
2014-05-20 18:27:24 UTC
Permalink
This article outlines setting up a target platform using a separate
project:
http://www.modumind.com/2012/10/23/rcp-best-practices-set-up-a-target-platform/

However it doesn't actually give a POM example for the project, the
article says:
"So the first step is to create a project called something like
com.mycompany.myapp.target. This can be just a simple project, not a
Java or Plugin project."

Unfortunately the article doesn't say what it means by "a simple
project"... does the article mean a project with pom packaging? Or does
it mean something else?

And is the approach outlined by the article (a separate myapp.target
project matching the myapp.core, myapp.test etc. projects) still the way
to do this?

I have a set of projects created by tycho-eclipse-plugin-archetype, ie.
myapp
myapp.core
myapp.feature
myapp.site
myapp.test

Should defining the target platform instead rather be in one of these?

This web page outlines many ways of defining the target platform, but
none mention creating a separate target project:
http://wiki.eclipse.org/Tycho/Target_Platform

Unfortunately the documentation above isn't clear on in _which_ POM the
target definition should reside in, except for the OSGi dependencies
http://wiki.eclipse.org/Tycho/Target_Platform#.22POM_dependencies_consider.22
which should be defined in the parent POM, ie.
myapp/pom.xml
in my example.

I guess the parent POM is the one that makes sense to put things in...?

Or should there be a separate myapp.target project, with a
yet-to-be-determined packaging, like the first article says...?

Thanks!


- Steinar
Steinar Bang
2014-05-20 19:19:33 UTC
Permalink
Post by Steinar Bang
This article outlines setting up a target platform using a separate
http://www.modumind.com/2012/10/23/rcp-best-practices-set-up-a-target-platform/
However it doesn't actually give a POM example for the project, the
"So the first step is to create a project called something like
com.mycompany.myapp.target. This can be just a simple project, not
a Java or Plugin project."
Unfortunately the article doesn't say what it means by "a simple
project"... does the article mean a project with pom packaging? Or does
it mean something else?
This packaging type, possibly...?
http://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-target-definition
Sievers, Jan
2014-05-21 07:33:42 UTC
Permalink
see demo project
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/helios

Jan

-----Original Message-----
From: tycho-user-***@eclipse.org [mailto:tycho-user-***@eclipse.org] On Behalf Of Steinar Bang
Sent: Dienstag, 20. Mai 2014 21:20
To: tycho-***@eclipse.org
Subject: Re: [tycho-user] What packaging to use for a myapp.target project?
Post by Steinar Bang
This article outlines setting up a target platform using a separate
http://www.modumind.com/2012/10/23/rcp-best-practices-set-up-a-target-platform/
However it doesn't actually give a POM example for the project, the
"So the first step is to create a project called something like
com.mycompany.myapp.target. This can be just a simple project, not
a Java or Plugin project."
Unfortunately the article doesn't say what it means by "a simple
project"... does the article mean a project with pom packaging? Or does
it mean something else?
This packaging type, possibly...?
http://wiki.eclipse.org/Tycho/Packaging_Types#eclipse-target-definition
Steinar Bang
2014-05-21 08:37:32 UTC
Permalink
Post by Sievers, Jan
see demo project
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/helios
Thanks! This is similar to what I've currently have tried to do.

I see that it is the last module, and therefore last built, in
the list of modules in the parent:
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/pom.xml

In my code I have currently put the module first in the modules list of
the parent, to make sure it would be built before any other, but so far
the dependencies to GEF added in the target project, are still
unresolved.

Is the modules order in the parent POM intentional? Or doesn't the
module order matter?
Mickael Istria
2014-05-21 08:59:32 UTC
Permalink
Post by Steinar Bang
In my code I have currently put the module first in the modules list of
the parent, to make sure it would be built before any other, but so far
the dependencies to GEF added in the target project, are still
unresolved.
Your target-definition is most likely incomplete, missing some
transitive dependencies.

You can use the target-platform-validation-plugin [1] when building your
target-definition to make sure its contents can be resolved.
You also need to be aware of the difference between planner and slicer
mode. Planner will generally work since it transitively includes
necessary installable unit, slicer will use only what's in your
target-definition so it requires you to verify your dependencies by
yourself (the positive part is that it provides more control, more
determinism, better performances).

[1]
http://www.eclipse.org/tycho/sitedocs-extras/target-platform-validation-plugin/validate-target-platform-mojo.html
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
Steinar Bang
2014-05-21 19:01:15 UTC
Permalink
Post by Mickael Istria
Your target-definition is most likely incomplete, missing some
transitive dependencies.
Possibly...? I had hoped the eclipse target file editor would pull in
the transitive dependencies...?
Post by Mickael Istria
You can use the target-platform-validation-plugin [1] when building
your target-definition to make sure its contents can be resolved.
Thanks! Is there a usage example? I'm unsure of what to put in the
required targetFiles parameter:
http://www.eclipse.org/tycho/sitedocs-extras/target-platform-validation-plugin/validate-target-platform-mojo.html
Post by Mickael Istria
You also need to be aware of the difference between planner and slicer
mode. Planner will generally work since it transitively includes
necessary installable unit, slicer will use only what's in your
target-definition so it requires you to verify your dependencies by
yourself (the positive part is that it provides more control, more
determinism, better performances).
Hm... here is what I found googling for "planner slicer":
http://wiki.eclipse.org/Tycho/Release_Notes/0.13

I'm still not sure what that means...? Maybe I'll figure it out over
time...?
Steinar Bang
2014-05-21 20:11:29 UTC
Permalink
Post by Steinar Bang
Post by Mickael Istria
Your target-definition is most likely incomplete, missing some
transitive dependencies.
Possibly...? I had hoped the eclipse target file editor would pull in
the transitive dependencies...?
I clicked on "Set as Target Platform" in the eclipse target file editor,
and the unable to resolve errors went away.

I still have some other errors I need to figure out
Plugin execution not covered by lifecycle configuration: org.eclipse.tycho:tycho-packaging-plugin:0.20.0:build-qualifier-aggregator (execution: default-build-qualifier-aggregator, phase: validate) pom.xml /modeler.site line 4 Maven Project Build Lifecycle Mapping Problem
Steinar Bang
2014-05-22 08:06:28 UTC
Permalink
Post by Steinar Bang
I clicked on "Set as Target Platform" in the eclipse target file editor,
and the unable to resolve errors went away.
Not sure if this was the right thing to do, though...? I would have
liked to do everything in the POM files and have m2e pick it up and set
up eclipse for me.
Post by Steinar Bang
I still have some other errors I need to figure out
Plugin execution not covered by lifecycle configuration: org.eclipse.tycho:tycho-packaging-plugin:0.20.0:build-qualifier-aggregator (execution: default-build-qualifier-aggregator, phase: validate) pom.xml /modeler.site line 4 Maven Project Build Lifecycle Mapping Problem
I was missing the m2e "Tycho Configurator": http://stackoverflow.com/a/18767238

To install the "Tycho Configurator":
- Open the preferences dialog Window->Preferences
- Open Maven->Discovery
- Click on the "Open Catalog" button
- Type "tycho" (without the quotes) in the Find field
- Check the checkbox for the "Tycho Configurator"
- Click on "Finish" and follow the install wizard to the end, including
the eclipse restart
Steinar Bang
2014-05-22 20:18:08 UTC
Permalink
Post by Steinar Bang
Post by Steinar Bang
I clicked on "Set as Target Platform" in the eclipse target file
editor, and the unable to resolve errors went away.
Not sure if this was the right thing to do, though...? I would have
liked to do everything in the POM files and have m2e pick it up and
set up eclipse for me.
As far as I can tell from today's google searches, that won't be the
case: there can only be one target platform setting per workspace:
Window->Preferences
then
Plug-in Development->Target Platform

The choices in that property dialog window are the Running Platform, and
all of the projects containing .target files, but there can only be one
selected at any given time.

There is a still-open issue for making it possible to have more than one
target platform definition per workspace, that was almost fixed for
eclipse 3.8, but was dropped for lack of resources:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159072

So if you have more than one tycho project with different target
platform requirements living in a single eclipse workspace, the simplest
way to make things build, is to ensure that you have all of the
requirements installed in the eclipse itself.
Mikhail Kalkov
2014-05-23 05:35:17 UTC
Permalink
FYI, Tycho does support multiple targets per module, whereas Eclipse PDE
only supports one target per workspace [1]. That said, I usually create a
target platform by mirroring required artifacts from several repos into a
new place, and then point both Tycho and PDE to it. I also think it does
not matter which plugins you have installed in the eclipse itself as
everything is resolved against your target platform anyway.

[1]
https://wiki.eclipse.org/Tycho/Target_Platform#Target_platform_configuration

Kind regards,
Mikhail Kalkov

Eclipse Developer | Purple Scout AB | www.purplescout.com
Kyrkogatan 20-22, SE-41110 Gothenburg, Sweden
Post by Steinar Bang
Post by Steinar Bang
Post by Steinar Bang
I clicked on "Set as Target Platform" in the eclipse target file
editor, and the unable to resolve errors went away.
Not sure if this was the right thing to do, though...? I would have
liked to do everything in the POM files and have m2e pick it up and
set up eclipse for me.
As far as I can tell from today's google searches, that won't be the
Window->Preferences
then
Plug-in Development->Target Platform
The choices in that property dialog window are the Running Platform, and
all of the projects containing .target files, but there can only be one
selected at any given time.
There is a still-open issue for making it possible to have more than one
target platform definition per workspace, that was almost fixed for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159072
So if you have more than one tycho project with different target
platform requirements living in a single eclipse workspace, the simplest
way to make things build, is to ensure that you have all of the
requirements installed in the eclipse itself.
_______________________________________________
tycho-user mailing list
https://dev.eclipse.org/mailman/listinfo/tycho-user
Mickael Istria
2014-05-23 07:41:51 UTC
Permalink
Post by Steinar Bang
As far as I can tell from today's google searches, that won't be the
Window->Preferences
then
Plug-in Development->Target Platform
The choices in that property dialog window are the Running Platform, and
all of the projects containing .target files, but there can only be one
selected at any given time.
There is a still-open issue for making it possible to have more than one
target platform definition per workspace, that was almost fixed for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159072
True, in IDE, only one target-platform per workspace.
With Tycho, target-platform is attached to each modules, so modules can
have different targets. Even more, Tycho allows to reference multiple
target definition (.target files) simultaneously, ending up with a kind
of "merge" of their contents as the target-platform.
Post by Steinar Bang
So if you have more than one tycho project with different target
platform requirements living in a single eclipse workspace, the simplest
way to make things build, is to ensure that you have all of the
requirements installed in the eclipse itself.
You could also think of statically creating a merged target
definition/.target file, that you can then use in the IDE. We (JBoss
Tools and family) have a mojo that does that:
https://github.com/jbosstools/jbosstools-maven-plugins/blob/master/tycho-plugins/target-platform-utils/src/main/java/org/jboss/tools/tycho/targets/MergeTargetsMojo.java
. See an example of usage at
https://github.com/jbosstools/jbosstools-integration-stack/blob/master/target-platform/pom.xml#L131
.
We do use it to "stack" target definitions: JBoss Tools has a target
definitions containing mostly org.eclipse stuff, JBoss Tools integration
stack builds on top of JBoss Tools so it creates a target definition
which consists of JBoss Tools target-platform + some additions + JBoss
Tools itself. People can import this target-definition in their IDE and
they everything they need.

HTH
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
My blog <http://mickaelistria.wordpress.com> - My Tweets
<http://twitter.com/mickaelistria>
Steinar Bang
2014-05-23 20:02:22 UTC
Permalink
True, in IDE, only one target-platform per workspace. With Tycho,
target-platform is attached to each modules, so modules can have
different targets. Even more, Tycho allows to reference multiple
target definition (.target files) simultaneously, ending up with a
kind of "merge" of their contents as the target-platform.
Right, however what I have in my case are two separate tycho project
hierarchies living in the same workspace, a GEF project created with
tycho-eclipse-plugin-archetype and an xtext project created with
emt-xtext-archetype (I knew GEF from earlier, but as I was getting up to
speed I stumbled over xtext and wondered if that was simpler to use).

For now I'm moving on with the GEF project, but the xtext project was
living in the same workspace and having compilation problems.

So what I've done for the time being, is to add GEF to the xtext project
target platform, and set that target platform as the target platform for
this workspace (if I decide to go on with the xtext project I will
remove GEF).
You could also think of statically creating a merged target
definition/.target file, that you can then use in the IDE. We (JBoss
https://github.com/jbosstools/jbosstools-maven-plugins/blob/master/tycho-plugins/target-platform-utils/src/main/java/org/jboss/tools/tycho/targets/MergeTargetsMojo.java
. See an example of usage at
https://github.com/jbosstools/jbosstools-integration-stack/blob/master/target-platform/pom.xml#L131
Thanks! In the example the target projects are both children of the
above POM, is that correct...?

(If so, not applicable to my particular situation, but I can live with
my current workaround)
We do use it to "stack" target definitions: JBoss Tools has a target
definitions containing mostly org.eclipse stuff, JBoss Tools
integration stack builds on top of JBoss Tools so it creates a target
definition which consists of JBoss Tools target-platform + some
additions + JBoss Tools itself. People can import this
target-definition in their IDE and they everything they need.
Right! Thanks! A layout to consider for future plugin projects,
definitely.
Oberlies, Tobias
2014-05-23 11:55:24 UTC
Permalink
Post by Steinar Bang
Post by Steinar Bang
Not sure if this was the right thing to do, though...? I would have
liked to do everything in the POM files and have m2e pick it up and
set up eclipse for me.
As far as I can tell from today's google searches, that won't be the
Window->Preferences
then
Plug-in Development->Target Platform
The choices in that property dialog window are the Running Platform, and
all of the projects containing .target files, but there can only be one
selected at any given time.
There is a still-open issue for making it possible to have more than one
target platform definition per workspace, that was almost fixed for
https://bugs.eclipse.org/bugs/show_bug.cgi?id=159072
So if you have more than one tycho project with different target
platform requirements living in a single eclipse workspace, the simplest
way to make things build, is to ensure that you have all of the
requirements installed in the eclipse itself.
This comes down to personal taste.

I usually organize my projects in working sets, so that each project requiring a target file is in a separate working set. Then, when I switch the target platform, I just close the working sets which no longer compile.

Regards
Tobias
Steinar Bang
2014-05-26 19:02:52 UTC
Permalink
To conclude this thread: I finally got my project to build with mvn from
the command line.

Here is my project for those that are interested:
https://github.com/steinarb/modeler

The final blocker was that I had used Import-Package in the MANIFEST.MF
of the .core project, beause that was the first fix that eclipse offered
for my compilation problem.

This caused the build to break with being unable to resolve
"org.eclipse.ui" (which was the package I had imported):

[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle modeler.core cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle modeler.core - Missing Constraint: Import-Package: org.eclipse.ui; version="0.0.0"
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle modeler.core cannot be resolved
Resolution errors:
Bundle modeler.core - Missing Constraint: Import-Package: org.eclipse.ui; version="0.0.0"


When I removed the Import-Package statements and let eclipse Ctrl-1
insert the Require-Bundle for the missing bundles, then the project
built both in the IDE and with mvn on the command line.

The thing I spent a lot of time on, before fixing the MANIFEST.MF, was
the .target file. I first tried to use features from the IDE runtime
which built fine in the IDE, but not at all when using "mvn install".

The documentation actually says that features don't work, by problem is
that I'd never read that far...
https://wiki.eclipse.org/Tycho/Target_Platform#Target_files

It makes sense I stop to think about it: the mvn build should be able to
work on a continous integration server, where there is no IDE runtime
present, so nothing referring to the IDE runtime will work.

A good guide for how to set up the target file, is this:
http://codeandme.blogspot.no/2012/12/tycho-build-8-using-target-platform.html

In short:
- Start with an empty target definition
- In the target file editor, "Add..." and select "Software Site"
- Select the update site (in my case http://downloads.eclipse.org/releases/kepler )
- Uncheck "Group by Category"
- Add the following 4 features (needed by tycho archetype projects):
- Eclipse e4 Rich Client Platform
- Eclipse Platform
- Eclipse Platform Launcher Executables
- Eclipse Java Development Tools

(In addition to the above 4 features, I added GEF)
Steinar Bang
2014-05-26 19:09:03 UTC
Permalink
Post by Steinar Bang
Post by Sievers, Jan
see demo project
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/helios
Thanks! This is similar to what I've currently have tried to do.
I see that it is the last module, and therefore last built, in
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/pom.xml
[snip!]
Post by Steinar Bang
Is the modules order in the parent POM intentional? Or doesn't the
module order matter?
(Answering my own question:)n
The module order doesn't matter because the target platform build
artifact is referenced in the parent POM
http://git.eclipse.org/c/tycho/org.eclipse.tycho-demo.git/tree/itp04-rcp/pom.xml
like so:
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<target>
<artifact>
<groupId>example.group</groupId>
<artifactId>helios</artifactId>
<version>1.0.0-SNAPSHOT</version>
</artifact>
</target>
</configuration>
</plugin>
</plugins>
</build>

The reactor will therefore cause the platform project to be built before
the projects using it.

Loading...