Developer

Sample Maven POM File

A Maven project object model (POM) file contains all the required information for Maven to create and build OSGi bundles that you can deploy to SMS Builder.

This POM file (pom.xml) illustrates the basic configuration for a custom-state bundle. The state implementation does not need libraries other than those provided by the SDK. The SDK libraries are shown as dependencies. The contents of the original POM are shown in bold:
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
  http://maven.apache.org/xsd/maven-4.0.0.xsd">
      
<modelVersion>4.0.0</modelVersion>
        
<groupId>com.sap.example</groupId>
<artifactId>customState</artifactId>    
<version>1.0-SNAPSHOT</version>    
<packaging>bundle</packaging>        
<name>Custom State</name>    
<url>http://www.sap.com</url>        

<properties>
  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>     
  <bundle.namespace>${project.groupId}</bundle.namespace>    
  <bundle.symbolicName>${bundle.namespace}.${project.artifactId}</bundle.symbolicName>
  <brand.version>1.3.1</brand.version>    
</properties>        
     
<build>      
 <defaultGoal>install</defaultGoal>
 <plugins>
  <plugin>
   <artifactId>maven-compiler-plugin</artifactId>
   <version>2.3.2</version>
   <configuration>          
     <source>1.6</source>            
     <target>1.6</target>          
   </configuration>        
  </plugin>       

  <!-- Create an OSGi Bundle Manifest -->        
  <plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-bundle-plugin</artifactId>           
    <version>2.3.7</version>          
    <extensions>true</extensions>          
    <configuration>            
     <instructions>              
     <manifestLocation>META-INF</manifestLocation>
     <Bundle-Category>object</Bundle-Category>              
     <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>              
     <Bundle-Version>${project.version}</Bundle-Version>              
     <Embed-Dependency></Embed-Dependency>                  
  
     <!-- 
     Note: When you develop additional classes within this object 
     bundle, include the package names of the classes in either the 
     Export-Package, or the Private-Package, otherwise it will not 
     be included in the bundle.              
     -->
              
     <Export-Package>
     </Export-Package>              
     
     <Private-Package>                   
       com.sap.example              
     </Private-Package>              
     
     <DynamicImport-Package>              
     </DynamicImport-Package>                  
    
     <!-- 
     Note: If you use other only referenced from spring context then 
     include them in the Import-Package instruction here. The * 
     instruction ensures that any directly imported packages in 
     supporting classes are included automatically, but the Spring 
     context referenced ones need explicit reference.              
     -->              
     <Import-Package>                    
       *              
     </Import-Package>                  
        
     <!-- 
     Each module can override these defaults in an 
     optional osgi.bnd file              
     -->              
     <_include>-osgi.bnd</_include>                
    
    <!-- 
    Enable viewing of the properties file content from telnet console
    -->            
    <ARF-Bundle-Template>/META-INF/config</ARF-Bundle-Template>                
    
    </instructions>            
    <obrRepository>NONE</obrRepository>          
   </configuration>        
  </plugin>      
 </plugins>     
</build>        
        
<dependencies>      
 <dependency>        
  <groupId>com.sybase365.mobiliser.brand.plugins</groupId>        
  <artifactId>mobiliser-brand-plugin-api</artifactId>        
  <version>${brand.version}</version>
 </dependency>
 <dependency>        
  <groupId>com.sybase365.mobiliser.brand.plugins</groupId>
  <artifactId>mobiliser-brand-state-sdk</artifactId>        
  <version>${brand.version}</version>      
 </dependency>       
 <dependency>        
  <groupId>com.sybase365.mobiliser.brand.security</groupId>
  <artifactId>mobiliser-brand-security</artifactId>        
  <version>1.3.1</version>
 </dependency>      
 <dependency>        
  <groupId>com.sybase365.mobiliser.brand.core</groupId>        
  <artifactId>mobiliser-brand-core</artifactId>       
  <version>${brand.version}</version>
 </dependency>      
 <dependency>        
  <groupId>com.sybase365.mobiliser.brand.database</groupId>
  <artifactId>mobiliser-brand-jpa</artifactId>        
  <version>${brand.version}</version>      
 </dependency>           

 <!-- Logging -->       
 <dependency>        
  <groupId>org.slf4j</groupId>        
  <artifactId>slf4j-api</artifactId>        
  <version>1.6.6</version>       
 </dependency>              

 <!-- Optional for Unit Test -->     
 <dependency>        
  <groupId>junit</groupId>        
  <artifactId>junit</artifactId>        
  <version>3.8.1</version>        
  <scope>test</scope>      
 </dependency>    
</dependencies>         

 <!-- 
 Required Javax Persistence dependencies not available 
 from Maven central repository 
 -->
 <profiles>      
  <profile>       
   <activation>         
    <jdk>[1.5, 1.7)</jdk>       
   </activation>       
   <dependencies>         
    <dependency>          
     <groupId>org.eclipse.persistence</groupId>          
     <artifactId>javax.persistence</artifactId>          
     <version>2.0.4.v201112161009</version>          
     <scope>provided</scope>         
    </dependency>       
   </dependencies>       
   <repositories>         
    <repository>          
     <id>EclipseLink</id>          
     <url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
    </repository>       
   </repositories>      
  </profile>    
 </profiles>       
</project>