<?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>4.2.1</version>
    </parent>

    <name>Wildfly Camel :: Patch</name>

    <artifactId>wildfly-camel-patch</artifactId>
	<packaging>pom</packaging>
	
    <!-- Properties -->
    <properties>
        <jboss.home>${project.build.directory}/wildfly-camel-${version.wildfly}</jboss.home>
    </properties>
    
    <!-- Dependencies -->
    <dependencies>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-feature-pack</artifactId>
            <version>${project.version}</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.wildfly.camel</groupId>
            <artifactId>wildfly-camel-config</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    
    <!-- Build -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.wildfly.build</groupId>
                <artifactId>wildfly-server-provisioning-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>wildfly</id>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <config-file>scripts/wildfly-provisioning.xml</config-file>
                            <server-name>wildfly-${version.wildfly}</server-name>
                        </configuration>
                    </execution>
                    <execution>
                        <id>wildfly-camel</id>
                        <goals>
                            <goal>build</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <config-file>scripts/wildfly-camel-provisioning.xml</config-file>
                            <server-name>wildfly-camel-${version.wildfly}</server-name>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-configs</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <java classname="org.wildfly.extras.config.internal.Main" classpathref="maven.compile.classpath" failonerror="true">
                                    <sysproperty key="jboss.home" value="${jboss.home}" />
                                    <arg value="--configs=camel" />
                                    <arg value="--enable" />
                                </java>
                            </target>
                        </configuration>
                    </execution>
                    <execution>
                        <id>sync-resources</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <ant antfile="scripts/sync-resources.xml" inheritRefs="true" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>groovy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>module-list-generate</id>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <phase>verify</phase>
                        <configuration>
                            <source>${project.basedir}/scripts/module-list-generate.groovy</source>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <appendAssemblyId>false</appendAssemblyId>
                            <descriptors>
                                <descriptor>scripts/assembly-wildfly-patch.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
