<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one
  ~ or more contributor license agreements. See the NOTICE file
  ~ distributed with this work for additional information
  ~ regarding copyright ownership. The ASF licenses this file
  ~ to you 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.
  -->

<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.apache.axis2</groupId>
        <artifactId>axis2</artifactId>
        <version>1.8.0-SNAPSHOT</version>
        <relativePath>../../pom.xml</relativePath>
    </parent>

    <groupId>org.apache.axis2</groupId>
    <artifactId>distribution</artifactId>
    <name>Apache Axis2 - Distribution</name>
    <description>Apache Axis2 Distribution</description>
    <packaging>pom</packaging>

    <properties>
        <docs.folder.version>1_4</docs.folder.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-java2wsdl</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-xmlbeans</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jibx</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jibx-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-json</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-spring</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-soapmonitor-servlet</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-fastinfoset</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxbri-codegen</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxws</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-metadata</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-clustering</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-saaj</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-ant-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mex</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mex</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <classifier>impl</classifier>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-corba</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-mtompolicy</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-http</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-http-hc3</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-transport-local</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.axiom</groupId>
            <artifactId>axiom-jaxb</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>soapmonitor</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>addressing</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>ping</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>scripting</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>mtompolicy</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-jaxws-mar</artifactId>
            <version>${project.version}</version>
            <type>mar</type>
        </dependency>
        
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>version</artifactId>
            <version>${project.version}</version>
            <type>aar</type>
        </dependency>
        
        <!-- Additional transports (with 3rd party dependencies excludes as in Axis2 1.4.1) -->
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axis2-transport-jms</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.geronimo.specs</groupId>
                    <artifactId>geronimo-jms_1.1_spec</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axis2-transport-mail</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axis2-transport-tcp</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axis2-transport-udp</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>axis2-transport-xmpp</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>jivesoftware</groupId>
                    <artifactId>smack</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>jivesoftware</groupId>
                    <artifactId>smackx</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>commons-lang</groupId>
                    <artifactId>commons-lang</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        
        <!-- None of the Axis2 artifacts should have a dependency on log4j
             because we don't want to impose a particular logging implementation
             on our users. However, for the binary distribution, we need to
             choose one. -->
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        
        <!-- This is needed to build the WAR distribution -->
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-webapp</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>
        
        <!-- These are needed to run JAX-WS tools -->
        <!-- TODO: don't add them unless you also add the corresponding license files
                   (and check that inclusion of these dependencies conforms to ASF policies) -->
        <!-- dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>com.sun.xml.ws</groupId>
                    <artifactId>jaxws-rt</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-xjc</artifactId>
                </exclusion>
            </exclusions>           
        </dependency>
        <dependency>
            <groupId>org.jvnet.staxex</groupId>
            <artifactId>stax-ex</artifactId>
            <version>1.4</version>           
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.stream.buffer</groupId>
            <artifactId>streambuffer</artifactId>
            <version>1.2</version>           
            <exclusions>
                <exclusion>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                </exclusion>
            </exclusions>
        </dependency -->
    </dependencies>
    <url>http://axis.apache.org/axis2/java/core/</url>
    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/distribution</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/trunk/modules/distribution</developerConnection>
        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/distribution</url>
    </scm>
    <build>
        <plugins>
            <plugin>
                <groupId>com.github.veithen.alta</groupId>
                <artifactId>alta-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>war-location</id>
                        <goals>
                            <goal>generate-properties</goal>
                        </goals>
                        <configuration>
                            <name>webapp</name>
                            <value>%file%</value>
                            <dependencySet>
                                <scope>test</scope>
                                <includes>
                                    <include>*:axis2-webapp:war:*</include>
                                </includes>
                            </dependencySet>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmavenplus</groupId>
                <artifactId>gmavenplus-plugin</artifactId>
                <executions>
                    <execution>
                        <id>generate-timestamp</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <scripts>
                                <script>
                                    import java.util.Date 
                                    import java.text.MessageFormat 
                                    project.properties['buildTimestamp'] = MessageFormat.format("{0,date,dd-MM-yyyy}", new Date())
                                    project.properties['release_version'] = project.version.replaceAll("-SNAPSHOT", "")
                                </script>
                            </scripts>
                        </configuration>
                    </execution>
                    <execution>
                        <id>check-webapp-content</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <scripts>
                                <script><![CDATA[
                                    import java.util.jar.*
                                    
                                    def jar = new JarInputStream(new FileInputStream(project.properties['webapp']))
                                    def expected = new HashSet()
                                    def entry
                                    while(entry = jar.nextJarEntry) {
                                        if (entry.name != 'META-INF/') {
                                            expected.add(entry.name)
                                        }
                                    }
                                    jar.close()
                                    
                                    jar = new JarInputStream(new FileInputStream(new File(project.build.directory, "axis2-" + project.version + "/dist/axis2.war")))
                                    while(entry = jar.nextJarEntry) {
                                        if (entry.name != 'META-INF/' && !expected.remove(entry.name)) {
                                            throw new Error("Unexpected entry in Web app: " + entry.name)
                                        }
                                    }
                                    if (!expected.empty) {
                                        throw new Error("Missing entries in Web app: " + expected)
                                    }
                                    jar.close()
                                ]]></script>
                            </scripts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.axis2</groupId>
                <artifactId>axis2-repo-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>create-repository</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/tmp-repository</outputDirectory>
                            <stripServiceVersion>false</stripServiceVersion>
                            <generateFileLists>true</generateFileLists>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>distribution-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <finalName>axis2-${project.version}</finalName>
                            <descriptors>
                                <descriptor>src/main/assembly/war-assembly.xml</descriptor>
                                <descriptor>src/main/assembly/src-assembly.xml</descriptor>
                                <descriptor>src/main/assembly/bin-assembly.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <!-- Always remove files from a previous run of the integration tests. -->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <executions>
                    <execution>
                        <id>clean-test-files</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${project.build.directory}/axis2-${project.version}</directory>
                                </fileset>
                            </filesets>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Prepare some additional dependencies required by specific samples. We could
                 also do this by invoking the relevant download.jars targets in the provided
                 ant scripts, but this may cause issues with HTTP proxies and has the disadvantage
                 that the JARs are downloaded every time instead of being copied from the local
                 Maven repository. -->
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-dependencies</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.codehaus.castor</groupId>
                                    <artifactId>castor</artifactId>
                                    <version>1.0.4</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>xerces</groupId>
                                    <artifactId>xercesImpl</artifactId>
                                    <version>2.9.1</version>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/axis2-${project.version}/samples/databinding/lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!-- Now unpack the distribution and run some automated tests on the samples -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-samples</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <unzip src="${project.build.directory}/axis2-${project.version}-bin.zip" dest="${project.build.directory}" />
                                
                                <!-- Build the web app -->
                                <ant dir="${project.build.directory}/axis2-${project.version}/webapp" useNativeBasedir="true" />
                                
                                <!-- Test of the databinding sample -->
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/databinding" />
                                
                                <!-- Test of the mtom sample -->
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/mtom" target="generate.service" />
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/mtom" target="generate.client" />
                                
                                <!-- Test of the faulthandling sample -->
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/faulthandling" target="generate.service" />
                                
                                <!-- Test of the json sample -->
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/json" target="generate.service" />
                                <ant dir="${project.build.directory}/axis2-${project.version}/samples/json" target="client.jar" />
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.veithen.invoker</groupId>
                <artifactId>resolver-proxy-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>start</goal>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-invoker-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-maven-samples</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <projectsDirectory>${project.build.directory}/axis2-${project.version}/samples</projectsDirectory>
                            <pomIncludes>
                                <pomInclude>pom.xml</pomInclude>
                            </pomIncludes>
                            <streamLogs>true</streamLogs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <plugin>
                <!-- We don't want to deploy the distributions to the Maven repository.
                     Reasons:
                      * Deploying the distributions will heavily increase the size of
                        each release on the Maven repos.
                      * There is also the risk that users may start downloading the non-Maven
                        archives from Maven repos rather than the mirrors. -->
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>apache-release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>net.nicoulaj.maven.plugins</groupId>
                        <artifactId>checksum-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>artifacts</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
