Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{include

...

:apache-felix-ipojo-header

...

}
{html

...

}
<div class="content">

...

Building and Running iPOJO bundles from Eclipse

This page explains how to build and run iPOJO bundles without exiting Eclipse and breaking the compile-run cycle.

Table of Contents
maxLevel4
minLevel2
classtoc

1) Import the iPOJO Bundle project

Download the project archive, and import it as an Existing Project into the Workspace
Image RemovedImage RemovedImage Removed
Then click on finish

2) Configure the target platform

Image Removed
Image Removed
The resulting project, you looks like the left picture.
Before using the project, you need to configure the OSGi platform. It will be run inside Equinox. To achieve this, open the .target file and then click on set as Target Platform (on the top-right corner). You don't have to change the configuration. It just configure Equinox to start iPOJO (contained in the lib folder).

3) Develop you bundle

The imported project contains a very simple component using annotations. But, obviously you can delete/change it. For XML-metadata, use metadata.xml file is in the project root.

Code Block
javajava
titleThe simple given component
{html}

h1. Building and Running iPOJO bundles from Eclipse
_This page explains how to build and run iPOJO bundles without exiting Eclipse and breaking the compile-run cycle._

{div:class=toc}
{toc:maxLevel=4|minLevel=2|class=toc}
{div}

h2. 1) Import the iPOJO Bundle project
Download the [project archive|^MyiPOJOBundle.zip], and import it as an *{{Existing Project into the Workspace}}*
!Picture 1.png!!Picture 2.png!!Picture 3.png! 
Then click on *{{finish}}*

h2. 2) Configure the target platform

!Picture 4.png|align=left!
!Picture 5.png|align=right!
The resulting project, you looks like the left picture.
Before using the project, you need to configure the OSGi platform. It will be run inside Equinox. To achieve this, open the *{{.target}}* file and then click on *{{set as Target Platform}}* (on the top-right corner). You don't have to change the configuration. It just configure Equinox to start iPOJO (contained in the {{lib}} folder). \\


h2. 3) Develop you bundle
The imported project contains a very simple component using annotations. But, obviously you can delete/change it. For XML-metadata, use {{metadata.xml}} file is in the project root.
{code:java|title=The simple given component}
@Component
public class MyComponentImpl {
    
    @Validate
    public void start() {
        System.out.println("I'm started !!!");
    }
    
    @Invalidate
    public void stop() {
        System.out.println("I'm leaving :-(...");
    }
    

}
{code}
Once you're done, you are able to run your bundle !

...



h2. 4) Run your

...

 bundle
!Picture 6.png|align=left!
Right-click on the *{{.launch}}* file and then go on *{{Run-As -> MyiPOJOBundle}}*. Equinox will be started and your iPOJO bundle deployed and started:

...


Once run for the first time, you can re-run it from the {{run}} icon. In the console view, you get your Equinox shell, and you see your application result. If you don't edit the given development, the output is

...

Iterate (smile)

Then, go back to the step 3, change your components, and see the new result...
That's it !

...

 as:
!Picture 8.png|align=center!
\\

h2. Iterate :-)
Then, go back to the step 3, change your components, and see the new result...
That's it !

h2. For 1.3.0-SNAPSHOT early adopter

...



The 1.3.0-SNAPSHOT iPOJO manipulator allows manipulating classes from a directory ([FELIX-943|http://cwiki.apache.org/jira/browse/FELIX-943]). This feature is very convenient for the Eclipse integration because it avoids creating the Jar and unzipping it inside the Eclipse build directory. Moreover, it allows reusing the Java Eclipse builder (compiling classes).

...



For early adopter you can use a project using this ability and allowing an easier integration with Eclipse. You can download this project [here|^iPOJOBundle-1.3.0.zip] and import it inside your Eclipse workspace.

...


\\
\\
{include:apache-felix-ipojo-footer

...

}