Skip to content

slothsoft/example-eclipse-application

Repository files navigation

Example Eclipse Application

Build Status

This example project shows how to develop and build an Eclipse based application using Tycho.

It shows how to:

  • build a product with Tycho
  • use a target platform file both inside Tycho and Eclipse
  • create a structure that can be used on multiple operation system (e.g. my OS is Windows, but this project is build by Travis using Linux)
  • use plain Maven dependencies

Content of this ReadMe:

Maven Modules

de.slothsoft.example.build

This project is the parent of the reactor and contains common resources and configurations.

  • platform.target - all the dependencies in one handy file; can be used by both Tycho and Eclipse
  • pom.xml - most of the Maven and Tycho configuration
  • README.md - a landing page for the repository

de.slothsoft.example

This project is the plug-in with the usable code. It just contains the Eclipse template for a new application and the template for a view.

de.slothsoft.example.it

This project tests the project de.slothsoft.example. In this example, it's tested that the view ExampleView can be opened without problems.

de.slothsoft.example.feature

This project contains a feature for a feature-based product.

de.slothsoft.example.product

This project has the product file to start build an application from Eclipse and build it from Tycho.

maven-p2

This project converts plain Maven dependencies into a P2 repository and is able to start and stop said repository. It can handle JARs with and without OSGi information in their Manifest.MF.

Check out the awesome p2-maven-plugin to learn more.

Developer Guide

To start this project in your Eclipse, do:

  1. Clone this repository
  2. Call mvn install -Pstart on maven-p2/pom.xml to start a P2 repository locally
  3. To start the application from Eclipse do the following:
    1. Open the file platform.target and click on "Set as Active Target Platform"
    2. de.slothsoft.example.product/ExampleApp.product and click on "1. Synchronize" and then "2. Launch Eclipse Application"
  4. To build the application with Tycho
    • Run mvn clean install on the repository root
    • Or in Eclipse right click on the pom.xml and use "Run as...""Maven install"
    • The resulting EXE file is in de.slothsoft.example.product/target/products/de.slothsoft.example.product-<time>-<os>.zip and / or the folder next to the ZIP file
  5. when finished, call mvn package -Pstop to stop the P2 repository

To use this example as a template for your Eclipse based application you need to do the following:

  1. check out this project (or use the button "Use this template" in GitHub)
  2. rename my IDs to yours
    • "de.slothsoft" to your company's domain (including packages)
    • "example" to your project's name (the same for capitalized "Example")
    • "Slothsoft" to your company's name

How to

How to change Eclipse version?

The Eclipse version is set inside the platform.target. Just change the repository location to your wanted Eclipse version and adjust the versions of the features (or use "0.0.0" to get the latest version).

How to change the operating system?

The file platform.target should be able to accommodate every OS you could open it with. The pom.xml file next to it however has information about the OS this application gets build for. Edit the <environments> tag of the target-platform-configuration plug-in to change this build to your liking, or add more environments to build the application for multiple OS.

How to change Java version?

The file pom.xml has a property tycho.version that can be changed easily.

How to change the Java version?

The Java version is defined inside the MANIFEST.MF for each plug-in (including the IT project).

How to use plain Maven dependencies?

I followed the tutorial for the Maven plug-in p2-maven-plugin. Basically, the following is done:

  1. call mvn install -Pstart on maven-p2/pom.xml to create a P2 repository and then start it locally
  2. now the platform.target can access "http://localhost:8080/site/"
  3. when finished, call mvn package -Pstop or mvn jetty:stop to stop the P2 repository

The entire configuration is contained in maven-p2/.

How to remove use of plain Maven dependencies?

If you don't need the feature, you can remove it like this:

  1. Delete the folder maven-p2/ from the repository
  2. Remove the location "http://localhost:8080/site/" from platform.target
  3. Remove the "before_install" and "after_script" part of the Travis configuration file .travis.yml

How to add / update Maven dependencies?

Open the file maven-p2/pom.xml and configure the artifacts of the p2-maven-plugin. I'd advise to only add one version for each artifact and use "0.0.0" in the target platform.

How to do pomless builds?

The official release notes of Tycho 0.24 will show you how it's done.

How to release?

This official tutorial shows how to release a Tycho project.

To Do List

(All open issues can be found here.)

License

This project is licensed under the MIT License - see the MIT license for details.

About

This example project shows how to develop and build an Eclipse based application using Tycho.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages