Maven + Tycho adds all workspace enabled plugins to build - eclipse

how to declare which Eclipse workspace plugins are added to the build?
All Target Platforms are clean and correct and i can't find a way to declare which plugins should be packed and which shouldn't.
It makes no difference if i deselect some plugins in the content-pane of the Targetplatform.
thank you!

i found the following after longer research:
[WARNING] De-selecting bundles in a target definition file is not supported
The Eclipse Target Editor has the possibiltiy to remove individual bundles from the resolved target definition content. (This is done via the selection on the Content tab of the editor, and results in a tag in the target definition file.) This configuration is currently ignored Tycho (cf. bug 373776).
As an alternative, you can use target platform filters to remove bundles from the target platform.
source:
http://wiki.eclipse.org/Tycho_Messages_Explained#Target_File_Include_Bundles

Related

How to force a target platform update in eclipse when adding an osgi bundle

We have an osgi project in eclipse. Whenever I add a bundle to a directory used in the target definition (using gradle to retrieve the jar from a maven repository), I have to manually update the target definition/platform. Is there a possibility to force eclipse to update/refresh the target platform during a build?
I don't think that it is possible to have the Eclipse incremental build automatically react on changes to the target definition file. This may be possible though, and could be requested as enhancement from the Eclipse PDE project.
Refreshing the target definition in every incremental build would not be a good idea, given that the resolution takes several seconds.

How to build RCP application based on Product Configuration and Target Platform Definition?

I'm about the setup an automatic (command-line) build for my Eclipse RCP Application.
I have found out the following ways to do it:
Buckminster
Using Maven with the pde-maven-plugin
Headless PDE Build
The problem with all these options is that they require me to create essentially a new representation of the information already contained in my target platform definition. For example in Buckminster, this would be the .rmap file.
In my thinking all the information to build the product should be already there when I have the following:
Plugin project with product configuration file (foo.product)
Target platform definition file (foo.target)
Therefore I would expect there to be a command like the following:
build-rcp-product foo.product foo.target win32
Is there anything like that which I may have missed?
With Buckminster you don't need to replicate the information in your target definition file. You can simply import the target file using the importtargetdefinition command. If all your dependencies defined in the target definition file, then in the rmap you define only from where to materialize your plugins (svn, git, maven, file system etc).
With PDE build, there is a filed request (Bug 266311) and it seems it is still not possible to utilize the target file directly but there are some workarounds suggested in there (which I didn't try, I am using Buckminster).
I use the PDE build and it's pretty simple. It essentially gets what it needs from the MANIFEST.MF file and the build.properties file.
The command to run it is more complicated, as you have to start Eclipse and point it to a few things, but it's very well integrated with the IDE. It does everything by making Ant scripts.
you can try tycho
here's a good start:
Tycho tutorial
Reference card
with tycho, all you need is a POM and you usually will not change this information, which is generated via maven

Can I Configure m2eclipse through pom.xml?

With the maven-eclipse-plugin, using mvn eclipse:eclipse, you can specifiy eclipse project natures and builders that will automatically be added to the eclipse project.
Earlier versions of m2eclipse used the configuration block of the maven-eclipse-plugin and also let you activate natures and builders using the same mechanisms. This seems to no longer be the case because a) I can't find any reference to maven-eclipse-plugin in the m2eclipse sources and b) it just doesn't work :-)
So this is my question: is there any way to configure the eclipse project generated by m2eclipse from the pom.xml? Specifically: project builders and natures, but I'd be interested in other options as well.
The following thread summarizes almost everything. First, it explains that m2eclipse doesn't and won't support anything from the Maven Eclipse Plugin anymore because:
Sonatype doesn't maintain it.
It causes them too much troubles.
Second, it states that the m2eclipse way to handle additional project natures and builders is to write project configurators:
(...) we encourage writing configurators to add the natures and builders you want based on what it available in the POM.
See this link for a guide and this project for some existing configurators for checkstyle, findbugs, pmd.
I have now implemented this as a maven plugin I call maven-eclipseconf-plugin.
Unfortunately it's proprietary work for a client, so I can't share it. But let me describe what I do:
Tied to the lifecycle verify, I check for the existence of an eclipse .project file. If it's there, I check it for the presence of the builders and natures I want to automatically add (and you can deactivate this behavior by using a maven property or a stop file with a configurable name). You can also define configuration files that will be written (like .pmd, which is related to this other question of mine). The contents of the Configuration files can be specified inline, it can come from an external file, or from a URL. I also tried to introduce variable substitution in the config files where a special placeholder would be replaced with a multi-moduke-project's root folder, but I had to give up on that approach.
Anyway, the plugin gives me pretty much all the functionality of the maven-eclipse-plugin I ever used (of course there is a lot more though) and I'm happy with that. Perhaps I will build something similar once more in open source when this contract is finished.
Project configurators are the proposed approach. But the latest version of m2e-extensions is from early 2010 and developed against m2eclipse 0.10.x. There is a successor project called m2e-code-quality which is more recent and active and developed against m2eclipse 0.12.x.
But neither m2e-extensions nor m2e-code-quality do support FindBugs at the moment. And there are some other limitations with header files, exclusions and modified JARs.
I have successfully used a universal approach with AntRun, Ant and XMLTask to automatically add project natures, builders and configuration files for Eclipse plugins from pom.xml.

Target Platform for PDE Headless build does not work

I am currently trying to get my headless pde-build working but I am stuck on a point where I do not know how to continue.
The problem is how to define the related target platform to compile the plugins against.
I have a build.bat with the following call (all in one line!):
java -jar D:\target\eclipse\plugins\org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar
-application org.eclipse.ant.core.antRunner
-f D:\target\eclipse\plugins\org.eclipse.pde.build_3.5.2.R35x_20100114\scripts\productBuild\productBuild.xml
-Dbuilder=c:\pde-build\scripts %*
I tried to create the target eclipse platform from different parts: The eclipse SDK, RCP SDK, Delta Pack, PDE-SDK in all combinations but none of them worked well.
I got the following error:
BUILD FAILED
D:\target\eclipse\plugins\org.eclipse.pde.build_3.5.2.R35x_20100114\scripts\productBuild\productBuild.xml:18: Cannot fin
d ${eclipse.pdebuild.scripts}/build.xml imported from D:\target\eclipse\plugins\org.eclipse.pde.build_3.5.2.R35x_2010011
4\scripts\productBuild\productBuild.xml
where the variable ${eclipse.pdebuild.scripts} does not got resolved. I also tried to give this parameter via the command line but then I got another error regarding missing svn task which is absolutely confusing as this is working with my local eclipse installation referenced.
When I replace the path from d:/target/eclipse to my local eclipse installation the pde build works as expected!
This leads my to the point that the configuration of the target eclipse is not correct but in the moment I have no idea how to configure this!
My goal is the automate the pde build first on my local site without referencing my local eclipse and later on integrate this building process into our running cruisecontrol instance.
As I saw already another question about defining the target eclipse I would be happy if anyone can contribute hints or facts regarding the problem.
Regards,
Andreas
When performing a headless build, the target can be separate from the eclipse that is actually running the build itself. The problem you had here is that the eclipse that you were using to run the build did not have PDE/Build properly installed.
This is why the ${eclipse.pdebuild.scripts} was not set, because PDE/Build was not installed into that eclipse instance, the org.eclipse.pde.build bundle was not resolved and the code that sets this property never got called. Similarly, the necessary ant classpath entries for PDE/Build tasks would not have been set up properly either.
You need the Eclipse with PDE installed inside to run the build, but the target for the build can be separate from this.
In the build.properties file found under -Dbuilder=c:\pde-build\scripts you can set several properties:
baseLocation This is a path to an eclipse that is your target.
buildDirectory This is where the build will actually take place, source is fetched to plugins/ and features/ subfolders, but if there are already binary plugins located here then those become part of the target as well.
pluginPath This is a list of paths (separated with ';' on windows or ':' on linux) containing other locations that should be considered as part of your target. These locations can be several things:
The root of an eclipse-like install with plugins/ and features/ subfolders. This is a good way to provide the delta-pack instead of just unzipping it on top of an eclipse install.
The root of a workspace-like folder, where all subfolders are treated as plugins or features depending on the presence of a manifest or feature.xml.
The root of a bundle or feature, or the jar for a bundle.
If you are doing a p2 build (p2.gathering = true) you can also provide p2 repositories under a ${repoBaseLocation} which will be transformed and placed under ${transformedRepoLocation} and will become part of your target, and the p2 metadata there will get reused during the build.
after some more time of investigation I found out, what I did wrong so far. As I mentioned above defining the target platform is not that easy as copying the SDK and plugins in into one location (as it was in early times of eclipse dev).
The working solution by now is the following: Copying the eclipse SDK into the target location and run this version. Install inside this the neccessary PDE-Tools to enable plugin development. After that, close the IDE and copy the delta pack + the respective svn plugin (I used org.eclipse.pde.build.svn-1.0.1RC2 from sourceforge) into the target platform and you're done.
Now my automated PDE build is running as expected.
Only minor issue now is the following: The result product contains eclipse-specific menu entries which are not there when I ran this from inside my dev-eclipse.
Any hints on that?
I just posted an answer to my question on this kind of topics, may be this can help you:
Plugin product VS Feature product

Modifying Existing Eclipse Plugin and Correctly Installing it

I downloaded the source code for the EMF based UML2 Plugin and changed a class in the org.eclipse.uml2.uml.edit project to remove special characters when returning string representations. Now when I export the projects and place the jar files either in the dropins directory or replace my current uml2 plugin jar files in plugins directory, The UML files are no longer recognized, in short my modified plugin does not install correctly (no error is thrown and I can see the files being picked up under Plugins->Target Platform) .
However, When I run the plugin as an eclipse application (from the workspace) I can see the changes I made being reflected in the new instance of eclipse.
What can I do to ensure that the plugin installs correctly?
Is there a documented procedure of how to build the uml2 plugin (or any comparable plugin) after modification?
Select the project and open the context menu. There is an entry PDE near the bottom of the menu. In there, you can find an entry to build the plugin for deployment. This gives you the features and plugins directory with the fixed files. Copy both into your Eclipse install.
Unless the UML2 plugins require some kind of magic build script, exporting the one plugin you changed and overwriting the original in your Eclipse installation should be the easiest solution. One potential problem which comes to mind is conflicting plugin version numbers: make sure you don't have two identical versions of your modified plugin in your Eclipse installation.
When debugging plugins which apparently don't work properly at runtime, I always look at Help > About Eclipse Platform > Configuration Details. This lists all the plugins found by Equinox during startup, along with their status (see the Javadoc of the org.osgi.framework.Bundle interface for explanation).
I faced the exact same problem as you describe here . I dont have any answer to your problem but i am sharing what worked for me .
I created a local update site of the plugin on my system. Create update site for your plug-in article explains very very nicely the steps needed to accomplish this .