How to setup a CICD pipeline for Eclipse plugin development - eclipse

I am working on developing a set of plugins to implement a new DSL with ECore, Xtext and Xtend.
So long, I can manually export the plugins (File → Export → Plug-in Development → Deployable plug-ins and fragments) then users copy them in the plugin folder of their target Eclipse (that should embed the necessary dependencies of the plugins!!)
What I would like to do is to :
1- "install" the plugins in a more smart way where, the necessary dependencies are automatically installed if missing in the target Eclipse.
2- set up a CICD pipeline in Gitlab to automatically build the plugins at each commit.
3- Set up in the CICD pipeline a build of a new Eclipse that users can simply download with the plugins and the corresponding dependencies (could be from a pre configured Eclipse)
Do you know of any documentation to do so?
Tks in advance.

Related

Build eclipse deployable feature in cli or update site in cli

I have below 3 packages
eclipse plugin,
eclipse feature and
update site
Now I have to build eclipse feature in cli as same as right click over feature -> Deployable feature -> archive.zip . Tried with maven tycho but it is building jar not the archive file.
Otherwise I have to build update site in cli as same as open site.xml -> Build all. Tried with p2 publisher but it is not creating contents.jar, artifact,jar, plugin and feature folders.
Please help me to automate the build in cli.
Regards,
Sunil

How to deploy an Eclipse Plugin?

Environment: Eclipse Oxygen.3a Release (4.7.3a), Build id: 20180405-1200
I have completely developed my new Eclipse Plugin. I have debugged it successfully and It´s ready to be deployed for beta testing by other developers in my organization.
The Overview tab in plugin.xml Eclipse editor offers an Export Wizard that works and produces a .jar file (theoretically) containing the plugin to be installed in other Eclipse installations.
After exporting the plugin to a local folder in my computer I tried to install it in Eclipse by using Help > Install new software... > [Add...] > [Archive...], selecting the .jar file generated and clicking [Ok].
However, I get the error message "Could not find jar:file:*<the selected plugin file>*!" and the [Finnish] button remains disabled.
What is missing to make my new plugin fully installable?
The most robust way to publish a plug-in (or Feature) for others to consume is to produce an Update Site. Then you can direct users to that site so they can install your plug-is/features via the Install New Software UI. It also provides an easy way to publish updates to your plug-ins.
Here is documentation about creating an Update Site.

How can I set the java.library.path used by eclipse from a POM?

I'm using maven to define my projects. One of my dependencies requires a native DLL at runtime, and consequently it's needed in tests and for debugging. The native DLL is available at a known location. I want a solution that I can check in once and will work for all developers without manual setup by each dev.
I know I can set the java.libary.path manually in "run configurations", which will allow it to find the native DLL, but this requires manual setup for each developer.
I know I can also set the java.library.path for a given project dependency, but again this is local to a particular developer.
Finally I know I can set the surefire plugin to specify the java.library.path, but this is only useful for tests triggered via maven - so it's great for our build server, but doesn't help devs using the JUnit runner in eclipse, or wanting to debug or run code directly from eclipse.
Is there a way out?
I've found that the eclipse m2e connector that goes with the maven-nativedependencies-plugin seems to fix this.
According to the mavennatives docs:
Since version 0.0.7 of the maven-nativedependencies-plugin if you have
m2eclipse installed and the nativedependencies plugin configured the
unpacking of natives will run automatically, you don't need the
eclipse plugin to unpack them. However in order to setup the
java.library.path environment variable in eclipse you will have to do
it either manually or automatically using the eclipse plugin.
This Eclipse plugin is an extension to m2eclipse, it detects if you
have the maven plugin configured, and if you do it executes the
unpacking of natives, and configures the Native Library Location.
If you import a maven project that has the mavennatives plugin
configured, and you have the m2eclipse integration plugin, on import
the natives will be extracted, also when performing a clean from
eclipse the natives will be extracted.
So, if you use both these tools, using native dependencies requires no
manual configuration, other than whats in the pom, just run your app
and it works.
If I have the connector installed, and add mavennatives to my POM, then reload the pom (right-click on project in package explorer > maven > update project), the "Native library location" of the project is populated automatically (to see this, right click on project > properties > java build path > libraries > native library location)
This seems to work for debugging, JUnit runner, etc.
It does require that every developer install the plugin, which is manual (as manual as installing eclipse); however, at least once installed once it will work for any/all native depdendencies configured for mavennatives via a POM.
The Properties Maven Plugin may help you passing the system properties by using properties:set-system-properties to set system properties.
The example should be look like the following: -
<properties>
<java.library.path>some/path</java.library.path>
</properties>
I hope this may help.

OSGi bundles dependency management in Eclipse

I have an OSGi bundle which is in Eclipse IDE represented as Eclipse Plug-in Project. The only way I found to satisfy the dependencies of this plug-in/bundle is to
1) import all dependencies (.jar files) through File > Import... > Plug-ins and Fragments wizard
2) and then declare the imported dependencies in MANIFEST.MF
Yes, this solution works, but on the other hand after I commit the changes to our repository all my team mates also have to manually import dependencies to Eclipse to fix the compilation errors.
QUESTION:
Is there a solution which does not require such irritating steps? I just want to pull the changes from repository and continue my work without need to fix the dependecies in MANIFEST.MF again and again...
P.S.: To retrieve dependencies we use Apache Ivy.
You need to set up a target platform in Eclipse. I find the easiest way is to put all the dependencies in a folder, and save the target platform as a .target file which I check into source control. Then the only steps my colleagues need to do is retrieve the dependencies and configure Eclipse to use the shared target definition. If we add new dependencies to the definition Eclipse will automatically pick up the changes with a restart or target platform refresh.
The Eclipse documentation should get you started: http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.pde.doc.user/concepts/target.htm
If you develop server based applications then it is much better to let maven or Ivy manage the dependencies and use the maven bundle plugin to generate the Manifest. So you can avoid the Eclipse OSGi mode and the target platform. See http://www.liquid-reality.de/x/DIBZ for a tutorial how to develop OSGi bundles using maven and deploy on Apache Karaf. For Ivy you may have to use a slightly different build but the basics should be the same.

Installing custom plugin on a clean Eclipse

I'm trying to install my custom Eclipse plugin, which works perfectly when launched from the manifest file, onto a clean installation of Eclipse. I've installed the necessary dependencies (GEF and Zest) manually using their update sites. However, the plugin still doesn't show up. I googled around a lot and found a site suggesting I open eclipse with -debug -consoleLog and revealed the following:
Edit: here's a screenshot of my entire log:
"PowerPlugin" is my custom plugin.
I've checked, and my plugin specifies these dependencies with a minimum version number, and I have installed Zest 1.3.0, Draw2D 3.7.2, and the GEF "All-In-One" SDK 3.7.2, which should satisfy these dependencies, I believe.
Any clue what's wrong?
I would suggest using just indigo update site http://download.eclipse.org/releases/indigo and installing all required dependencies like gef and zest from there (assuming that you use indigo as a baseline?). This update site (actually it is now called a "software site" or repository) contains all required dependencies and they will be installed if needed.
When you using Help>Install new software... p2 provisioning system is used and it will make sure that all required dependencies are satisfied before it starts installing anything.
[Updated bellow]
The problem then is with a dropin mechanism. I found it very unreliable. Would be much better if you could install your plug-in using the standard p2 mechanism (by using software site aka p2 repository) that is:
Please create a feature project.
Add your plug-in (plug-ins) to the newly created feature.
Export the feature ("Export Wizard" link on feature.xml editor). Choose directory destination and on Options tab make sure that "Generate Metadata Repository" is selected (this will spare you the time to create UpdateSite project although you could do that if you want more flexibility later).
In your exported forlder your should have: feature, plugins folders and also artifacts.jar and conten.jar with p2 metadata.
In your destination eclipse go to Help>Install New Software... then Add... and Local... and browse to the folder from point 4.
You should see the feature to install in the list (if not please deselect "Group items by category") and then follow the wizard to install your featrue.
If you want to install on the same host you are running then you can use "Install Into host Repository" in point 3.
See also:
http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fguide%2Ftools%2Fexport_wizards%2Fexport_features.htm