Apache UIMA PEAR Packaging Maven Plugin Documentation Overview This plugin supports creating PEAR packages using Maven. The PEAR (Processing Engine ARchive) file format is designed to make UIMA analysis components easily consumable for other users, and is the preferred packaging format for UIMA analysis components. This format allows applications and tools to manage UIMA analysis components automatically for verification, deployment, invocation and testing. Using the PEAR Packaging Plugin
Specifying the PEAR Packaging Pluging To use the PEAR Packaging Plugin within a Maven build, the plugin must be added to the plugins section of the POM as shown below: ... org.apache.uima PearPackagingMavenPlugin true package $main_root/lib-alternative/sample.jar desc/${project.artifactId}.xml ${project.artifactId} $main_root/resources package ... ]]> To configure the plugin with the specific settings of a PEAR package, the <configuration> element section is used. This sections contains all parameters that are used by the PEAR Packaging Plugin to package the right content and set the specific PEAR package settings. The details about each parameter and how it is used is shown below: <classpath> - This element specifies the classpath settings for the PEAR component. The Jar artifact that is built during the current Maven build is automatically added to the PEAR classpath settings and does not have to be added manually. The classpath element can be omitted if the component Jar artifact is the only classpath entry. Use $main_root variables to refer to libraries inside the PEAR package. For more details about PEAR packaging please refer to the Apache UIMA PEAR documentation. <mainComponentDesc> - This element specifies the relative path to the main component descriptor that should be used to run the PEAR content. The path must be relative to the project root. A good default to use is desc/${project.artifactId}.xml. <componentID> - This element specifies the PEAR package component ID. A good default to use is ${project.artifactId}. <datapath> - This element specifies the PEAR package UIMA datapath settings. If no datapath settings are necessary, this element can be omitted. Use $main_root variables to refer libraries inside the PEAR package. For more details about PEAR packaging please refer to the Apache UIMA PEAR documentation. For most Maven projects it is sufficient to specify the parameters described above. In some cases, for more complex projects, it may be necessary to specify some additional configuration parameters. These parameters are listed below with the default values that are used if they are not added to the configuration section shown above. <mainComponentDir> - This element specifies the main component directory where the UIMA nature is applied. By default this parameter points to the project root directory - ${basedir}. <targetDir> - This element specifies the target directory where the result of the plugin are written to. By default this parameters points to the default Maven output directory - ${basedir}/target
Automatically including dependencies The PEAR Packaging Plugin does not take care of automatically adding its dependencies to the PEAR archive. However, this behavior can be manually added. The following two build plugins hook into the build cycle in order to make sure all runtime dependencies end up being packaged into the final PEAR file. While the dependencies will be automatically included in the PEAR file using this procedure, you still need to add them manually to the PEAR classpath, using the <classpath> element described above. The first uses the maven-dependency-plugin to resolve the runtime dependencies of the PEAR into the lib folder, which is where the PEAR packaging plugin expects them. The version is stripped from the file names of the dependencies so it is not necessary to adapt the PEAR classpath when changing the version of a dependency. ... org.apache.maven.plugins maven-dependency-plugin copy-dependencies package copy-dependencies true ${basedir}/lib false true runtime ... ]]> The second hooks into the clean phase of the build phase. It deletes the lib folder again. The lib folder is automatically filled and removed during the build process. Therefore, it should not go into the source control system and neither should you manually place any jars in there. ... maven-antrun-plugin CleanLib clean run ... ]]>
Installing The PEAR Packaging Plugin If you specify the Apache Incubating Repository as one of the repositories for your maven configuration, then the uima-pear-maven-plugin.jar should be automatically fetched when needed. This is typically specified in the .settings file or in a parent POM, using this format: apache-incubating-repository http://people.apache.org/repo/m2-incubating-repository never ]]> Otherwise, the uima-pear-maven-plugin.jar file must be manually installed into your local repository. See . The information you need to do this is: -DgroupId=org.apache.uima -DartifactId=PearPackagingMavenPlugin -Dversion=2.3.1 (change this to the version you want) -Dpackaging=jar -DgeneratePom=true Building the PEAR Packaging Plugin From Source The plugin code is available in the Apache subversion repository at: . Use the following command line to build it (you will need the Maven build tool, available from Apache): mvn install]]> This maven command will build the tool and install it in your local maven repository, making it available for use by other maven POMs. The plugin version number is displayed at the end of the Maven build as shown in the example below. For this example, the plugin version number is: 2.3.1