<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>com.hazelcast</groupId>
        <artifactId>hazelcast-root</artifactId>
        <version>1.9.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <name>hazelcast</name>
    <artifactId>hazelcast</artifactId>
    <packaging>jar</packaging>

    <build>
        <filters>
            <filter>${basedir}/target/filter.properties</filter>
        </filters>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <index>true</index>
                        <compress>true</compress>
                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                    </archive>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>set-timestamp</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <mkdir dir="${project.build.directory}"/>
                                <tstamp>
                                    <format property="timestamp"
                                            pattern="yyyyMMdd"/>
                                </tstamp>
                                <echo file="${basedir}/target/filter.properties"
                                      message="timestamp=${timestamp}"/>
                                <copy file="${basedir}/src/main/resources/hazelcast-default.xml"
                                      tofile="${basedir}/target/hazelcast.xml"/>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <argLine>-Xms512m -Xmx512m -XX:MaxPermSize=128M</argLine>
                    <excludes>
                        <exclude>**/ClusterTest.java</exclude>
                        <exclude>**/QueryTest.java</exclude>
                        <exclude>**/MapStoreTest.java</exclude>
                        <exclude>**/PerformanceTest.java</exclude>
                        <exclude>**/Redo*</exclude>
                        <exclude>**/CMapTest.java</exclude>
                    </excludes>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <profiles>

        <profile>
            <id>aspect</id>
            <dependencies>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>1.6.7</version>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>aspectj-maven-plugin</artifactId>
                        <configuration>
                            <source>${jdk.version}</source>
                            <target>${jdk.version}</target>
                            <encoding>${project.build.sourceEncoding}</encoding>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>compile</goal>
                                    <!-- use this goal to weave all your main classes -->
                                    <goal>test-compile</goal>
                                    <!-- use this goal to weave all your test classes -->
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>all</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>-Xms512m -Xmx512m -XX:MaxPermSize=128M</argLine>
                            <excludes>
                                <exclude>**/PerformanceTest.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>client</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <argLine>-Xms512m -Xmx512m -XX:MaxPermSize=128M</argLine>
                            <includes>
                                <include>**/client/**.java</include>
                            </includes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.12</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.6.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
