<?xml version="1.0" encoding="UTF-8"?>
<!--
  #%L
  Wildfly Camel Patch
  %%
  Copyright (C) 2013 - 2014 RedHat
  %%
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
  #L%
  -->


<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>org.wildfly.camel</groupId>
        <artifactId>wildfly-camel</artifactId>
        <version>2.0.0.CR1</version>
    </parent>

    <name>Wildfly Camel :: Example</name>

    <artifactId>wildfly-camel-example</artifactId>
	<packaging>pom</packaging>

	<!-- Modules -->
	<modules>
		<module>common</module>
		<module>camel-cdi</module>
		<module>camel-jpa</module>
        <module>camel-cxf-soap</module>
        <module>camel-activemq</module>
        <module>camel-rest</module>
	</modules>

    <!-- Properties -->
    <properties>
        <jboss.home>${project.build.directory}/wildfly-${version.wildfly}</jboss.home>
        <server.config>standalone-camel.xml</server.config>
    </properties>

	<!-- Build -->
	<build>
		<plugins>
	        <plugin>
	            <groupId>org.apache.maven.plugins</groupId>
	            <artifactId>maven-surefire-plugin</artifactId>
	            <configuration>
	                <skip>true</skip>
	            </configuration>
	        </plugin>
		</plugins>
	</build>
	
	<!-- Profiles -->
	<profiles>
		<profile>
			<id>ts.all</id>
			<activation>
				<property>
					<name>ts.all</name>
				</property>
			</activation>
			<build>
				<plugins>
		            <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-dependency-plugin</artifactId>
		                <executions>
		                    <execution>
		                        <id>unpack-wildfly</id>
		                        <phase>generate-sources</phase>
		                        <goals>
		                            <goal>unpack</goal>
		                        </goals>
			              		<inherited>false</inherited>
		                        <configuration>
		                            <artifactItems>
		                                <artifactItem>
		                                    <groupId>org.wildfly</groupId>
		                                    <artifactId>wildfly-dist</artifactId>
		                                    <version>${version.wildfly}</version>
		                                    <type>zip</type>
		                                    <overWrite>false</overWrite>
		                                    <outputDirectory>${project.build.directory}</outputDirectory>
		                                </artifactItem>
		                            </artifactItems>
		                        </configuration>
		                    </execution>
		                    <execution>
		                        <id>unpack-wildfly-patch</id>
		                        <phase>generate-test-sources</phase>
		                        <goals>
		                            <goal>unpack</goal>
		                        </goals>
			              		<inherited>false</inherited>
		                        <configuration>
		                            <artifactItems>
		                                <artifactItem>
		                                    <groupId>org.wildfly.camel</groupId>
		                                    <artifactId>wildfly-camel-patch</artifactId>
		                                    <version>${project.version}</version>
		                                    <type>tar.gz</type>
		                                    <overWrite>false</overWrite>
		                                    <outputDirectory>${jboss.home}</outputDirectory>
		                                </artifactItem>
		                            </artifactItems>
		                        </configuration>
		                    </execution>
		                </executions>
		            </plugin>
		            <plugin>
		                <groupId>org.wildfly.plugins</groupId>
		                <artifactId>wildfly-maven-plugin</artifactId>
		                <configuration>
		                    <jbossHome>${jboss.home}</jbossHome>
		                    <serverConfig>${server.config}</serverConfig>
		                </configuration>
		                <executions>
		                    <execution>
		                        <id>wildfly-start</id>
		                        <phase>pre-integration-test</phase>
		                        <goals>
		                            <goal>start</goal>
		                        </goals>
			              		<inherited>false</inherited>
		                    </execution>
		                </executions>
		            </plugin>
			        <plugin>
			            <groupId>org.apache.maven.plugins</groupId>
			            <artifactId>maven-surefire-plugin</artifactId>
			            <executions>
			                <execution>
			                    <phase>integration-test</phase>
			                    <goals>
			                        <goal>test</goal>
			                    </goals>
			                    <configuration>
			                        <skip>false</skip>
			                    </configuration>
			                </execution>
			            </executions>
			        </plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>no.ts.all</id>
			<activation>
				<property>
					<name>!ts.all</name>
				</property>
			</activation>
			<build>
				<plugins>
		            <plugin>
		                <groupId>org.apache.maven.plugins</groupId>
		                <artifactId>maven-dependency-plugin</artifactId>
		                <executions>
		                    <execution>
		                        <id>unpack-wildfly</id>
		                        <phase>generate-sources</phase>
		                        <goals>
		                            <goal>unpack</goal>
		                        </goals>
			              		<inherited>true</inherited>
		                        <configuration>
		                            <artifactItems>
		                                <artifactItem>
		                                    <groupId>org.wildfly</groupId>
		                                    <artifactId>wildfly-dist</artifactId>
		                                    <version>${version.wildfly}</version>
		                                    <type>zip</type>
		                                    <overWrite>false</overWrite>
		                                    <outputDirectory>${project.build.directory}</outputDirectory>
		                                </artifactItem>
		                            </artifactItems>
		                        </configuration>
		                    </execution>
		                    <execution>
		                        <id>unpack-wildfly-patch</id>
		                        <phase>generate-test-sources</phase>
		                        <goals>
		                            <goal>unpack</goal>
		                        </goals>
			              		<inherited>true</inherited>
		                        <configuration>
		                            <artifactItems>
		                                <artifactItem>
		                                    <groupId>org.wildfly.camel</groupId>
		                                    <artifactId>wildfly-camel-patch</artifactId>
		                                    <version>${project.version}</version>
		                                    <type>tar.gz</type>
		                                    <overWrite>false</overWrite>
		                                    <outputDirectory>${jboss.home}</outputDirectory>
		                                </artifactItem>
		                            </artifactItems>
		                        </configuration>
		                    </execution>
		                </executions>
		            </plugin>
		            <plugin>
		                <groupId>org.wildfly.plugins</groupId>
		                <artifactId>wildfly-maven-plugin</artifactId>
		                <configuration>
		                    <jbossHome>${jboss.home}</jbossHome>
		                    <serverConfig>${server.config}</serverConfig>
		                </configuration>
		                <executions>
		                    <execution>
		                        <id>wildfly-start</id>
		                        <phase>pre-integration-test</phase>
		                        <goals>
		                            <goal>start</goal>
		                        </goals>
			              		<inherited>true</inherited>
		                    </execution>
		                </executions>
		            </plugin>
			        <plugin>
			            <groupId>org.apache.maven.plugins</groupId>
			            <artifactId>maven-surefire-plugin</artifactId>
			            <executions>
			                <execution>
			                    <phase>integration-test</phase>
			                    <goals>
			                        <goal>test</goal>
			                    </goals>
			                    <configuration>
			                        <skip>false</skip>
			                    </configuration>
			                </execution>
			            </executions>
			        </plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
