maven-par-plugin

OSGI, technology May 29th, 2008

Introduction
The maven-par-plugin was designed to allow developers create s2ap compliant par packages and deploy them to the platform. This plugin might not work for any other purpose.

Usage

A long howto is not required as the purpose of this plugin should be clear. Thus I will concentrate on the configuration and a simple usage pattern.

The infrastructure pom.xml acts as an example of how this plugin is used on our platform.
The initial directory structure looks like:

infrastructure
  | --> hsqldb
  | --> par

par/pom.xml

      

              4.0.0
              infrastructure-par
              ${service.version}
              S2AP Par bundle
par
              So long and thanks for all the fish
              
         
           steademy
           Staademy repository
           http://repo.steademy.com/beta/maven2
         
       

                com.steademy.service.infrastructure
                parent
                SNAPSHOT
              

              
                      
                              com.steademy.service.infrastructure
                              hsqldb
                              ${service.version}
                      
              

              


                    org.apache.maven.plugins
                    maven-par-plugin
                    0.2.0
                    
                       true
                       com.steademy.service.infrastructure
                       1.0.0
                       The db infrastructure
                       Application DB infrastructure
                   
                 
              
             
      

The repository

In order to properly use the maven-par-plugin, you have to pick it up from our repository.
The following repository entry must be added to your pom’s repository entries:

     
          
            steademy
            Steademy repository
            http://repo.steademy.com/beta/maven2
          
       

The packaging must be changed to par.

par

Dependencies
The par/pom.xml simply aggregates all direct dependencies it finds. It does neither care about scopes nor indirect dependencies.

Plugin configuration


        org.apache.maven.plugins
        maven-par-plugin
        0.2.0
        
             true
             com.steademy.service.infrastructure
             1.0.0
             The db infrastructure
             Application DB infrastructure
        
     

Explaining the tags in right order:

1. groupId -> We use the default maven groupId
2. artifactId -> Do I need to tell you about it ???
3. version -> latest “stable” version is 0.2.0

You will use the configuration in order to describe the final .par related META-INF/MANIFEST.MF file.
The tags applicationSymbolicName, applicationVersion, applicationDescription & applicationName have been defined and set mandatory by the springsource guys. Our plugin will pickup your personal settings and create the MANIFEST.MF file accordingly.

The fqn (fully qualified naming) allows to create artifact files using the pattern

${groupId}.${artifactId}

Example:
Our infrastructure par with fqn=true looks echos the following log entries:

[INFO] infrastructure-par
[INFO] artifact hsqldb is copied with fully qualified name com.steademy.service.infrastructure.hsqldb-SNAPSHOT
[INFO] added com.steademy.service.infrastructure.hsqldb-SNAPSHOT.jar
[INFO] [install:install]
[INFO] Installing /home/tmaus/workspaces/beta-01/infrastructure/par/target/infrastructure-par-SNAPSHOT.par to /home/tmaus/.m2/repository/com/steademy/service/infrastructure/infrastructure-par/SNAPSHOT/infrastructure-par-SNAPSHOT.par

The same maven build using fqn=false would produce the following log:

[INFO] infrastructure-par
[INFO] added hsqldb.jar
[INFO] [install:install]
[INFO] Installing /home/tmaus/workspaces/beta-01/infrastructure/par/target/infrastructure-par-SNAPSHOT.par to /home/tmaus/.m2/repository/com/steademy/service/infrastructure/infrastructure-par/SNAPSHOT/infrastructure-par-SNAPSHOT.par

Switching this tag to true increases the readability of the deployed bundles within your s2ap/admin extremely.

So long and thanks for all the fish

t.maus

Tags:



Reader's Comments

  1. Moo Jix | May 29th, 2008 at 12:22 pm

    thank you.
    if found the plugin at http://repo.steademy.com/beta/maven2.

    Moo

  2. Dave Syer | May 29th, 2008 at 1:07 pm

    Can you elaborate on “All referenced jar dependencies will be picked up and aggregated.”? Does that mean all directly referenced dependencies (of any scope) in the POM? Presumably the transitive dependencies are not included?

    P.S. I think there is a problem with your HTML formatting (the second POM example is not rendered in pre tags, the first one extends the pre too far and some HTML appears in it).

  3. Dave Syer | May 29th, 2008 at 6:28 pm

    Thorsten, Thanks for the updates. I’d like to compare notes on how you are using Maven with S2AP. If you want to stay in touch on that fire me an e-mail.

  4. tmaus | May 30th, 2008 at 10:00 am

    Ill setup a s2ap goes maven within next 10 days. If you would like to have any further information simply send me a mail and ill keep you up-to-date

  5. tmaus | May 30th, 2008 at 11:53 am

    still not fully used to work with wordpress so pls excuse bad formatting

  6. westenb | August 11th, 2008 at 5:37 pm

    Hello,

    I would be interested in using the maven-par-plugin for pakckaging also war archives together jar bundles.
    According to SpringSource, the par format support this.

    (cf. also
    http://www.springsource.com/beta/applicationplatform/comments.php?DiscussionID=253&page=1#Item_3).

    The idea behind this is to package a web application together with those services developed exclusively for that web application.

    Best regards, Eric

    PS: if the development of this maven plugin is not further pursued, is the source code available somewhere?

  7. tmaus | August 12th, 2008 at 10:17 am

    Hi westenb,
    I will extend the plugin in the requested way.
    However it will take a couple of days before I can have my hands on the code.
    Ill consequently upload it and add a comment in the s2ap forum.

    regards

    thorsten

  8. bill | November 19th, 2008 at 10:30 am

    hi,
    is there now the possibility to packaging also war archives together with jar’s? and how i ll include it? also over the dependency?

    thx & regards
    bill

  9. mdeeks | December 18th, 2008 at 7:29 pm

    Any chance the source could be made available?

  10. steademy | December 27th, 2008 at 12:45 am

    we’ll find a way publishing sources soon …

  11. Gridshore » Building Spring DM server compliant OSGi bundles with Maven | January 3rd, 2009 at 1:06 pm

    [...] You probably need to configure a repository to find this plugin: http://repo.steademy.com/beta/maven2. You can find documentation of the maven-par-plugin here. [...]

  12. sandro | March 31st, 2009 at 9:50 am

    Hi,
    The configuration requires a tag but does not accept values 1.0-SNAPSHOT… why?

    sorry .. cannot help on it anymore … maven-par-plugin is deprecated.
    I reckon that the springsource guys provide a maven plugin on their own

  13. Maven PAR Plugin 1.0.0.M1 | SpringSource Team Blog | June 24th, 2009 at 1:00 pm

    [...] introduction of SpringSource dm Server (Application Platform at the time), Thorsten Maus created a Maven plugin for creating PAR files. This was a great community contribution and we even used it in the Getting Started Guide for dm [...]

Leave a Comment