Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Eclipse plugin that provides integration of Java projects into a bndtools workspace, by providing these Java projects via a local bndtools repository.

License

NotificationsYou must be signed in to change notification settings

DaHoC/Java2Bndtools

Repository files navigation

Table of Contents

  1. What is it and what does it do
  2. Prerequisites
  3. How to install?
    1. Using the Eclipse update site
    2. Alternative way
  4. How to use?
    1. Plugin way (recommended)
    2. Alternative way 1: Using Eclipse project properties
    3. Alternative way 2: Manual way (not recommended)
  5. Example usage
  6. How does it work?
  7. To-do

What is it and what does it do?

It is an Eclipse plugin that provides integration of Java projects into a bndtools workspace, by making these Java projects available in a local bndtools repository.

Depicting Eclipse flow

Prerequisites

  1. Eclipse workspace with bndtools workspace with the mandatory bnd cnf project folder and a bnd repository named "Local"
  2. A Java project (having the org.eclipse.jdt.core.javanature nature) being contained within the same Eclipse workspace
  3. TheMETA-INF/MANIFEST.MF of the Java project must be present, readable and must have the following attributes (Bundle-Version defaults to0.0.0 if not specified), mind the mandatory newline at the end of the file:
Manifest-Version: 1.0Bundle-Name: Dummy projectBundle-SymbolicName: com.foo.barBundle-ManifestVersion: 2Bundle-Version: 1.0.0

If your bnd workspace is missing theLocal repository, you can add the entry to the maincnf/build.bnd file:

-plugin.7.Local: \    aQute.bnd.deployer.repository.LocalIndexedRepo; \    name = Local; \    pretty = true; \    local = ${build}/local

How to install?

Using the Eclipse update site (recommended)

The Eclipse update site is generated by the enclosed de.janhendriks.java2bnd.updatesite project (which uses the enclosed de.janhendriks.java2bnd.feature project which in turn uses this de.janhendriks.java2bnd project) and can be found at following URL:

https://github.com/DaHoC/Java2Bndtools/raw/master/de.janhendriks.java2bnd.updatesite/

Don't mind the potential HTTP 404 response as the index.html is missing, but Eclipseshould rely on the existingsite.xml file

Alternative way:

Clone this repo, and use the updatesite project as source folder as local Eclipse update site.

How to use?

Make sure that the prerequisites are met.

To associate the plugin with a Java project, you need to add a nature (which adds the corresponding builder) to the project you want to provide to the local bndtools workspace.

Each time afull build on the Java project is triggered, e.g. by doing aProject → Clean… → Build (automatically), the updated project should appear as bundle in the "Local" bndtools workspace repository.

The name of the bundle corresponds to theBundle-SymbolicNameMANIFEST.MF entry, the version toBundle-Version.

This bundle can then be referenced by a bnd project.

To associate the plugin with a Java project, there are several approaches:

Plugin way (recommended)

Select the Java projects which should be considered and included as bnd dependencies in the "Package Explorer" or "Project Explorer" view, right-click to open the context menu →Add Java2bnd nature

Add project nature via plugin

Alternative way 1: Using Eclipse project properties

Select the Java project, go into its properties (e.g. by right-clicking the project →Properties), selectProject NaturesAdd...Add Java2bnd nature as depicted below:

Add project nature

After hittingApply and Close, the project nature is added, the corresponding builder is added and registered and the project is build and should immediately appear in the bnd workspace "Local" repository.

Alternative way 2: Manual way (not recommended)

For the Java project add thede.janhendriks.java2bnd.nature andbuildCommandde.janhendriks.java2bnd.builder as last build entry as shown in the following.project entries / builder:

<?xml version="1.0" encoding="UTF-8"?><projectDescription>...<buildSpec><buildCommand><name>org.eclipse.jdt.core.javabuilder</name><arguments></arguments></buildCommand><buildCommand><name>de.janhendriks.java2bnd.builder</name><arguments></arguments></buildCommand></buildSpec><natures><nature>org.eclipse.jdt.core.javanature</nature><nature>de.janhendriks.java2bnd.nature</nature></natures></projectDescription>

Example usage

Sample Java project integration flow

Consider aJava project in your bndtools workspace that has aBundle-SymbolicName ofcom.foo.java and aBundle-Version of2.1.0 defined in itsMETA-INF/MANIFEST.MF.

Besides this project, thecom.bar.bndbndtools project is present in the same Eclipse workspace, which is to be configured to require thecom.foo.java bundle as dependency.

First a full build of the Java projectcom.foo.java is to be done (e.g. byProject → Clean… → Build (automatically)).Afterwards, the corresponding bundle should now be present in the "Local" bndtools workspace repository (seeBndtools perspective → Repositories → Local).

com.foo.java can now be referenced from thecom.bar.bnd/bnd.bnd file, e.g.

-buildpath = com.foo.java;version=2.1.0

Thecom.bar.bnd bndtools project now references thecom.foo.java bundle as dependency and the exposed API (including JavaDoc) and further bndtools/OSGi instructions can be used (likeRequire-Capability,Import-Package,-runbundles and so on).

After each successful full build of thecom.foo.java project, the corresponding bundle in the "Local" bndtools repository is updated.

How does it work?

If the Java project is given the additional nature (and builder) as mentioned before, the builder registers itself as the last builder to execute in the chain, to make sure it's called after all other builders doing e.g. source generation or resource handling, especially after the Java builder.

During eachfull build of this Java project, the Java2bndtools builder packs generated Java artifacts of the project into a temporary jar file using the Eclipse-internal jar package exporter with custom settings.

This temporary JAR file is passed via stream to the bnd workspace "Local" repository where it should appear.It is automatically overwritten for each new full build and the bnd workspace repository is refreshed automatically.

To-do

  1. Support incremental builds to some extent (if possible and feasible at all)
  2. Provide minimal sample workspace (from the example)
  3. If MANIFEST.MF is missing, use a best-effort-approach, e.g. by setting
Manifest-Version: 1.0Bundle-Name: <Eclipse project name>Bundle-SymbolicName: <Eclipse project name>Bundle-ManifestVersion: 2Bundle-Version: 0.0.0

About

Eclipse plugin that provides integration of Java projects into a bndtools workspace, by providing these Java projects via a local bndtools repository.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp