<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>8.10.0.Beta2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>teiid</artifactId>
  <name>Build</name>
  <description>Teiid Build</description>
    <dependencies>
        <dependency>
            <groupId>org.jboss.teiid</groupId>
            <artifactId>teiid-client-jdk15</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.retrotranslator</groupId>
            <artifactId>retrotranslator-runtime</artifactId>
        </dependency>
        <dependency>
            <groupId>net.sf.retrotranslator</groupId>
            <artifactId>retrotranslator-transformer</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>
                </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>
                </excludes>
            </resource>
        </resources>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
              <configuration>
                  <archiverConfig>
                      <fileMode>0644</fileMode>
                      <directoryMode>0755</directoryMode>
                      <defaultDirectoryMode>0755</defaultDirectoryMode>
                  </archiverConfig>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>

            <configuration>
              <descriptors>
                <descriptor>assembly/client-jar.xml</descriptor>
                <descriptor>assembly/jboss-as7/dist.xml</descriptor>
                <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
                <descriptor>assembly/embedded-dist.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>exec-maven-plugin</artifactId>
                <version>1.1.1</version>
                <executions>
                    <execution>
                        <id>jdbc-15</id>
                        <phase>package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
                            <arguments>                     
                                <argument>-srcjar</argument>
                                <argument>${project.basedir}/target/teiid-${project.version}-jdbc.jar</argument>
                                <argument>-destjar</argument>
                                <argument>${project.basedir}/target/teiid-${project.version}-jdbc-jdk15.jar</argument>            
                                <argument>-embed</argument>
                                <argument>org.teiid</argument>
                                <argument>-target</argument>
                                <argument>1.5</argument>    
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>jdbc-14</id>
                        <phase>package</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>net.sf.retrotranslator.transformer.Retrotranslator</mainClass>
                            <arguments>                     
                                <argument>-srcjar</argument>
                                <argument>${project.basedir}/target/teiid-${project.version}-jdbc.jar</argument>
                                <argument>-destjar</argument>
                                <argument>${project.basedir}/target/teiid-${project.version}-jdbc-jdk14.jar</argument>            
                                <argument>-embed</argument>
                                <argument>org.teiid</argument>
                                <argument>-target</argument>
                                <argument>1.4</argument>    
                            </arguments>
                        </configuration>
                    </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/teiid-${project.version}-jdbc-jdk15.jar</file>
                                    <type>jar</type>
                                    <classifier>jdbc-jdk15</classifier>
                                </artifact>
                                <artifact>
                                    <file>target/teiid-${project.version}-jdbc-jdk14.jar</file>
                                    <type>jar</type>
                                    <classifier>jdbc-jdk14</classifier>
                                </artifact>
                                <artifact>
                                    <file>target/kits/karaf/teiid-karaf-features.xml</file>
                                    <type>xml</type>
                                    <classifier>karaf-features</classifier>
                                </artifact>                                
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jboss-eap-dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.as</groupId>
                                    <artifactId>jboss-as-dist</artifactId>
                                    <version>${version.org.jboss.as}</version>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/uberzip</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>teiid-dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.teiid</groupId>
                                    <artifactId>teiid</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>jboss-dist</classifier>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/uberzip/jboss-eap-6.3</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                    <execution>
                        <id>console-dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.jboss.teiid.web-console</groupId>
                                    <artifactId>teiid-console-dist</artifactId>
                                    <version>1.2.0</version>
                                    <classifier>jboss-as7</classifier>
                                    <type>zip</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/uberzip/jboss-eap-6.3</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </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/console-jar.xml</descriptor>    
                  <descriptor>assembly/jboss-as7/dist.xml</descriptor>
                  <descriptor>assembly/adminshell/adminshell-dist.xml</descriptor>
                  <descriptor>assembly/embedded-dist.xml</descriptor>
                </descriptors>
              </configuration>
            </plugin>

          </plugins>
        </build>
      </profile>
    </profiles>
</project>
