software-mariodiana
5/6/2016 - 2:37 PM

An adaptation and update of a tutorial describing how to use the Maven plugin for Apache UIMA PEAR packaging. This is a complete version of

An adaptation and update of a tutorial describing how to use the Maven plugin for Apache UIMA PEAR packaging. This is a complete version of the parent pom.xml file described by the tutorial, updated as of 2016-05-06. The original tutorial is here: http://www.annolab.org/pearpackaging.html

<!-- Adapted from: http://www.annolab.org/pearpackaging.html -->
<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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.mariodiana.uima.pear</groupId>
    <artifactId>uima-pears</artifactId>
    <packaging>pom</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>PEAR template POM</name>
    <url>http://www.mariodiana.com</url>
    <dependencies>
        <dependency>
            <groupId>org.apache.uima</groupId>
            <artifactId>uimaj-core</artifactId>
            <version>2.8.1</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <!-- Copy the dependencies to the lib folder for the PEAR to copy. -->
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <stripVersion>true</stripVersion>
                            <outputDirectory>${basedir}/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <includeScope>runtime</includeScope>
                            <!-- An exception happens when using a PEAR if the archive includes this jar. -->
                            <excludeArtifactIds>uimaj-core</excludeArtifactIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <!-- Copy descriptor files to the desc folder for the PEAR to copy. -->
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/desc</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources/desc</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <!-- Clean the libraries after packaging -->
                    <execution>
                        <id>CleanLib</id>
                        <phase>clean</phase>
                        <configuration>
                            <tasks>
                                <delete dir="lib" deleteOnExit="true" quiet="true" failOnError="false">
                                    <fileset dir="lib" includes="*.jar"/>
                                </delete>
                                <delete dir="desc" deleteOnExit="true" quiet="true" failOnError="false">
                                    <fileset dir="desc" includes="*" />
                                </delete>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>