How to Create New Project
For now (2012-01-22), Apache iPOJO 1.8.0 does not support JDK7. You should use JDK6. (fixed in trunk version)
Install Apache Maven first, and type following command:
mvn archetype:generate -DarchetypeRepository=http://download.krakenapps.org
-DarchetypeGroupId=org.krakenapps -DarchetypeArtifactId=kraken-template -DarchetypeVersion=1.0.1
-DgroupId=YOUR_GROUP_ID -DartifactId=YOUR_ARTIFACT_ID -Dversion=YOUR_ARTIFACT_VERSION -Dpackage=YOUR_JAVA_PACKAGE -Dpackaging=jar
This command will create new kraken project, and you can import maven project from eclipse. Recent eclipse (namely, Indigo) embeds m2eclipse by default. Refer screenshots:
Maven pom.xml project file is generated by kraken template. You should change project name, Export-Package and Private-Package metadata fields.
<?xml version="1.0"?> <project> <modelVersion>4.0.0</modelVersion> <groupId>com.xeraph</groupId> <artifactId>blog</artifactId> <version>1.0.0</version> <packaging>bundle</packaging> <name>YOUR_PROJECT_NAME</name> <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <version>2.0.1</version> <extensions>true</extensions> <configuration> <instructions> <Bundle-SymbolicName>blog</Bundle-SymbolicName> <Export-Package>YOUR_EXPORT_PACKAGES</Export-Package> <Private-Package>YOUR_PRIVATE_PACKAGES</Private-Package> <Import-Package>*</Import-Package> </instructions> </configuration> </plugin> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-ipojo-plugin</artifactId> <version>1.4.0</version> <executions> <execution> <goals> <goal>ipojo-bundle</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.krakenapps</groupId> <artifactId>kraken-api</artifactId> <version>1.9.8</version> </dependency> <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.apache.felix.ipojo.annotations</artifactId> <version>1.4.0</version> </dependency> </dependencies> </project>
Find and replace YOUR_PROJECT_NAME, YOUR_EXPORT_PACKAGES, and YOUR_PRIVATE_PACKAGES. You should change <Bundle-SymbolicName> element's value and add required additional dependencies.
All <Bundle-SymbolicName>, <Export-Package>, <Import-Package> and <Private-Package> manifests are OSGi specific configurations. See How to Get Started with OSGi and Apache Felix OSGi Tutorial
metadata.xml at src/main/resources contains empty iPOJO component configurations. iPOJO is IoC container for OSGi environment. (Imagine it as Spring in OSGi world) See iPOJO hello world tutorial. If you are korean, see translated article.
Delete sources.txt placeholder file.
When you type mvn package command, maven will generate an OSGified jar file using bnd and ipojo maven plugins.




