pom.xml 6.1 KB
<?xml version="1.0" encoding="UTF-8"?>
<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>
  <parent>
    <groupId>no.knowit.seam</groupId>
    <artifactId>seam-refimpl</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>seam-refimpl-ejb</artifactId> <!-- m2eclipse does not like: ${app.context}-ear -->
  <name>${project.artifactId} : ${project.version}</name>
  <description>The Seam Maven reference implementation EJB module</description>
  <packaging>ejb</packaging>

  <profiles>
    <!--
      More than one profile can be active at once. Since profiles can contain the same types of 
      configuration there can be clashes. If two profiles clash the last to be activated will 
      override configurations in those activated earlier. 
      Note: Any activeByDefault profile will be deactivated if you activate another profile. 
      E.g. running "mvn install -Penv-dev" deactivates the "prod" profile.
     -->
    <profile>
      <id>env-dev</id>
      <properties>
        <env>dev</env>
      </properties>
    </profile>

    <profile>
      <id>env-prod</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <env>prod</env>
      </properties>
    </profile>

    <profile>
      <id>explode</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>ejb-process-classes</id>
                <phase>process-classes</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <property
                      name="deploy-path"
                      value="${as.deploy}/${app.context}-ear.ear" />
                    <copy
                      todir="${deploy-path}/${project.build.finalName}.jar"
                      verbose="true">
                      <fileset dir="${project.build.outputDirectory}">
                        <include name="**/*.class" />
                      </fileset>
                    </copy>
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <dependencies>
    <dependency>
      <groupId>no.knowit.seam</groupId>
      <artifactId>seam-utils-ejb</artifactId>
      <type>ejb</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>no.knowit.seam</groupId>
      <artifactId>seam-utils-openejb</artifactId>
      <type>ejb</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <!--
      Maven filter properties are ony visible to
      resources and can not be accessed from the POM.
    
    <filters>
      <filter>../src/main/filters/filter-${env}.properties</filter>
    </filters>
    -->
    
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering> <!-- filtering persistence.xml -->
      </resource>
    </resources>
    
    <testResources>                                                                                                     
      <testResource>                                                                                                    
        <directory>src/test/resources</directory>                                                                 
        <filtering>true</filtering>                                                                               
      </testResource>
      <testResource>                                                                                                    
        <directory>src/test/resources-openejb</directory>                                                                 
        <filtering>true</filtering>                                                                               
      </testResource>
    </testResources>
    
    <plugins>
      <!--
        Maven filter properties are ony visible to resources and can not be 
        accessed from the POM. This is where the Properties Maven Plugin makes
        our life a little easier when dealing with properties that we need to 
        access inside our POM. It provides goals to read and write properties 
        from and to files, and also to set system properties. It's main use-case 
        is loading properties from files instead of declaring them in pom.xml, 
        something that comes in handy when dealing with different environments. 
        The plugin is configured to read properties during the "validate" phase 
        and the properties are then accessible from the pom.
      -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>properties-maven-plugin</artifactId>
        <executions>
          <execution>
            <configuration>
              <files>
                <file>${basedir}/../src/main/filters/filter-${env}.properties</file>
              </files>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <suiteXmlFiles>
            <suiteXmlFile>
              testng.xml
            </suiteXmlFile>
          </suiteXmlFiles>
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-ejb-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Build-Date>${timestamp}</Build-Date>
              <Build-Revision>${buildNumber}</Build-Revision>
              <Mode>${env}</Mode>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>