<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">
  <parent>
    <artifactId>teiid-parent</artifactId>
    <groupId>org.jboss.teiid</groupId>
        <version>9.0.0.Beta1</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  
  <artifactId>teiid</artifactId>
  <name>Build</name>
  <description>Teiid Build</description>
  
  <properties>
      <!-- Directory name from upstream Wildfly server dist. -->
      <dir.wildfly>wildfly-${version.org.wildfly}</dir.wildfly>
      <!-- Teiid server directory name. -->
      <dir.teiid>teiid-${project.version}</dir.teiid>
  </properties>
  
    <dependencies>
    	<dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency> 
       
		<dependency>
		    <groupId>org.jboss.narayana.jta</groupId>
		    <artifactId>narayana-jta</artifactId>
		</dependency> 
		<dependency>
		    <groupId>org.jboss.ironjacamar</groupId>
		    <artifactId>ironjacamar-jdbc</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.jboss.ironjacamar</groupId>
		    <artifactId>ironjacamar-core-api</artifactId>
		</dependency>
		<dependency>
		    <groupId>org.jboss.ironjacamar</groupId>
		    <artifactId>ironjacamar-core-impl</artifactId>
		</dependency>

    </dependencies>   
      
    <build>
        <outputDirectory>target/kits</outputDirectory>
        
        <resources>
            <resource>
                <directory>kits</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                    <include>**/*.sh</include>
                    <include>**/*.bat</include>
                    <include>**/*.html</include>
                    <include>**/*.cli</include>
                    <include>**/Dockerfile</include>
                </includes>
            </resource>
            <resource>
                <directory>kits</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/*.xml</exclude>
                    <exclude>**/*.properties</exclude>
                    <exclude>**/*.sh</exclude>
                    <exclude>**/*.bat</exclude>
                    <exclude>**/*.html</exclude>
                    <exclude>**/*.cli</exclude>
                    <exclude>**/Dockerfile</exclude>
                </excludes>
            </resource>
        </resources>
        
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <configuration>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        
        <plugins>                        
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-server-deps</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
									<groupId>org.wildfly</groupId>
									<artifactId>wildfly-dist</artifactId>
                                    <version>${version.org.wildfly}</version>
                                    <type>zip</type>
                                    <outputDirectory>${project.build.directory}</outputDirectory>
                                </artifactItem>
                                <artifactItem>
									  <groupId>org.jboss.teiid.hal</groupId>
									  <artifactId>dist</artifactId>
									  <version>${version.teiid.console}</version>
									  <classifier>overlay</classifier>
									  <type>zip</type>
	                                  <outputDirectory>${project.build.directory}/${dir.wildfly}</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>assembly/src.xml</descriptor>
                        <descriptor>assembly/client-jar.xml</descriptor>
                        <descriptor>assembly/wildfly-dist.xml</descriptor>
                        <descriptor>assembly/adminshell-dist.xml</descriptor>
                        <descriptor>assembly/wildfly-server.xml</descriptor>
                        <descriptor>assembly/docker.xml</descriptor>            
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>create-assemblies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>target/kits/karaf/teiid-karaf-features.xml</file>
                                    <type>xml</type>
                                    <classifier>karaf-features</classifier>
                                </artifact>                                
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
    
    <profiles>
        <profile>
            <!--
            This profile is activated manually, as in "mvn ... -P release ..."
            -->
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptors>
                                <descriptor>assembly/src.xml</descriptor>
                                <descriptor>assembly/client-jar.xml</descriptor>
                                <descriptor>assembly/wildfly-dist.xml</descriptor>
                                <descriptor>assembly/adminshell-dist.xml</descriptor>
                                <descriptor>assembly/wildfly-server.xml</descriptor>
                                <descriptor>assembly/docker.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>    
</project>
