APAM/APAM Getting Started Tutorial/APAM Project Creation
From Wiki Adele Team
This APAM Wiki is no longer maintained. Please switch to the following github Wiki for newest APAM information:
http://github.com/AdeleResearchGroup/ApAM/wiki
http://github.com/AdeleResearchGroup/ApAM/wiki
For building APAM projects we use the Apache Maven project management software. Maven compiles the Java code, adds the appropriated metadata to the components and creates OSGi standard bundles (jar files). To have an idea about Maven you can follow the Maven in 5 minutes tutorial.
Project Structure
An APAM project should follow this structure :
src/main/java : java sources files of the project. src/main/resources/metadata.xml : APAM descriptor file. pom.xml : maven script file.
A sample project structures is shown in next image:
Sample Maven Script File
This file is used to describe the project, information to be used is:
- identification : project name, version, type of packaging, etc.
- repository : repository of artifacts to be used in compilation task.
- dependencies : project dependencies (if needed)
- build: the target platform of APAM is OSGi, then the build process includes the maven-bundle-plugin and the ApamMavenPlugin like they are used in this sample pom file.
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<!-- Project Identification -->
<groupId>fr.imag.adele.apam</groupId>
<artifactId>hello-world</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>Hello World Specification</name>
<!-- Repositories List -->
<pluginRepositories>
<pluginRepository>
<id>apam-plugin-repository</id>
<url>https://repository-apam.forge.cloudbees.com/snapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<!-- Dependencies Description-->
<dependencies>
</dependencies>
<!-- Build Description-->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Export-Package>fr.imag.adele.apam.hello.world.spec</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>fr.imag.adele.apam</groupId>
<artifactId>ApamMavenPlugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>ipojo-bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Project Build
To build an APAM project with maven use this command in a OS console:
mvn clean install
You can also use a pluging for your IDE as M2Eclipse.