<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~ 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-parent</artifactId>
        <version>1.6-wso2v2</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>
    <artifactId>axis2.eclipse.codegen.plugin</artifactId>
    <name>Apache Axis2 - tool - Eclipse Codegen Plugin</name>
    <description>The Axis 2 Eclipse Codegen Plugin for wsdl2java and java2wsdl</description>
    <dependencies>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>org.eclipse.core.jobs</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.commands</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.variables</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.contenttype</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.expressions</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.filesystem</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.update</groupId>
                    <artifactId>org.eclipse.update.ui</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.update</groupId>
                    <artifactId>org.eclipse.update.configurator</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.update</groupId>
                    <artifactId>org.eclipse.update.core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.help</groupId>
                    <artifactId>org.eclipse.help</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.ant</groupId>
                    <artifactId>org.eclipse.ant.core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>org.eclipse.core.resources</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.core</groupId>
            <artifactId>org.eclipse.core.runtime</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.runtime.compatibility</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.core</groupId>
                    <artifactId>org.eclipse.core.runtime.compatibility.auth</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.equinox</groupId>
            <artifactId>org.eclipse.equinox.common</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.equinox</groupId>
                    <artifactId>org.eclipse.equinox.registry</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.equinox</groupId>
                    <artifactId>org.eclipse.equinox.preferences</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jface</groupId>
            <artifactId>org.eclipse.jface</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.osgi</groupId>
            <artifactId>org.eclipse.osgi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>org.eclipse.swt</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.swt</groupId>
            <artifactId>org.eclipse.swt.win32.win32.x86</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.ui</groupId>
            <artifactId>org.eclipse.ui.ide</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.eclipse.ui</groupId>
                    <artifactId>org.eclipse.ui.forms</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.eclipse.ui</groupId>
                    <artifactId>org.eclipse.ui.views</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-javamail_1.4_spec</artifactId>
            <version>${geronimo.spec.javamail.version}</version>
        </dependency>
       <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons.logging.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-kernel</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-adb-codegen</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-java2wsdl</artifactId>
            <version>${version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-stax-api_1.0_spec</artifactId>
            <version>${geronimo.spec.stax.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.neethi</groupId>
            <artifactId>neethi</artifactId>
            <version>${neethi.version}</version>
        </dependency>

        <dependency>
            <groupId>wsdl4j</groupId>
            <artifactId>wsdl4j</artifactId>
            <version>${wsdl4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.xmlbeans</groupId>
            <artifactId>xmlbeans</artifactId>
            <version>${xmlbeans.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>stax</groupId>
                        <artifactId>stax-api</artifactId>
                    </exclusion>
                </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.ws.commons.schema</groupId>
            <artifactId>XmlSchema</artifactId>
            <version>${xmlschema.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>${ant.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.woden</groupId>
            <artifactId>woden-api</artifactId>
            <version>${woden.version}</version>
        </dependency>

        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>${commons.httpclient.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>${commons.codec.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-bind</artifactId>
            <version>${jibx.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-run</artifactId>
            <version>${jibx.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.woden</groupId>
            <artifactId>woden-impl-dom</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>${log4j.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>${javax.mail.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs</groupId>
            <artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
        </dependency>
    </dependencies>
    <!--distributionManagement>
        <repository>
            <id>apache-repo</id>
            <name>Maven Central Repository</name>
            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-ibiblio-rsync-repository</url>
        </repository>
        <snapshotRepository>
            <id>apache-snapshots</id>
            <name>Apache Development Repository</name>
            <url>scpexe://people.apache.org//www/people.apache.org/repo/m2-snapshot-repository</url>
        </snapshotRepository>
    </distributionManagement-->
    <build>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>legal-files</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <resourceBundles>
                                <resourceBundle>org.apache.axis2:axis2-resource-bundle:${pom.version}</resourceBundle>
                            </resourceBundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>distribution-package</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${pom.basedir}/eclipse-codegen-plugin-assembly.xml</descriptor>
                            </descriptors>
                            <finalName>dist</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>package</id>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                
                                <property name="codegen.plugin.version"
                                          value="Axis2_Codegen_Wizard_${eclipse.plugins.version}"/>
                                <property name="codegen.plugin.zip.name" value="axis2-eclipse-codegen-wizard.zip"/>
                                <property name="codegen.plugin.jar.name" value="Axis2CodegenWizard.jar"/>
                                <property name="src" value="./src"/>
                                <property name="codegen.src.dir" value="../axis2-eclipse-codegen-plugin/src/main/java"/>
                                <property name="output" value="../target/eclipse_plugins"/>
                                <property name="output.target" value="${output}/release"/>
                                <property name="plugin.output.dir" value="${output}/plugin"/>
                                <property name="codegen.output.dir" value="${output}/code-gen"/>
                                <property name="codegen.plugin.output.dir"
                                          value="${plugin.output.dir}/${codegen.plugin.version}"/>
                                <property name="source.dir.name" value="src"/>
                                <property name="lib.dir.name" value="lib"/>
                                <property name="bin.dir.name" value="bin"/>
                                <property name="help.dir.name" value="help"/>
                                <property name="icons.dir.name" value="icons"/>
                                <property name="plugin.project.file.name" value=".project"/>
                                <property name="plugin.classpath.file.name" value=".classpath"/>
                                <property name="plugin.help.file.name" value="help_toc.xml"/>
                                <property name="codegen.resource.dir" value="../conf/codegen"/>
                                <property name="codegen.help.resource.file"
                                          value="../../../modules/documentation/xdocs/tools/1_4/eclipse/wsdl2java-plugin.html"/>
                                <property name="codegen.help.images.dir"
                                          value="../../../modules/documentation/xdocs/tools/1_4/eclipse/images"/>
                                <property name="axis2.lib.dir" value="../../../target/lib"/>
                                <property name="codegen.resource.dir" value="../conf/codegen"/>
                                <delete dir="./target/plugin/${codegen.plugin.version}"/>
                                <mkdir dir="./target/plugin/${codegen.plugin.version}"/>
                                <delete dir="./target/dist"/>
                                <mkdir dir="./target/dist"/>
                                <!--Filter tokens for the copy command to filter the versions of external dependencies -->
                                <filter token="eclipse.plugins.version" value="${eclipse.plugins.version}"/>
                                <filter token="version" value="${version}"/>
                                <filter token="geronimo.spec.activation.version"
                                        value="${geronimo.spec.activation.version}"/>
                                <filter token="geronimo.spec.stax.version"
                                        value="${geronimo.spec.stax.version}"/>
                                <filter token="ant.version" value="${ant.version}"/>
                                <filter token="axiom.version" value="${axiom.version}"/>
                                <filter token="commons.logging.version" value="${commons.logging.version}"/>
                                <filter token="neethi.version" value="${neethi.version}"/>
                                <filter token="xmlbeans.version" value="${xmlbeans.version}"/>
                                <filter token="xmlschema.version" value="${xmlschema.version}"/>
                                <filter token="log4j.version" value="${log4j.version}"/>
                                <filter token="wsdl4j.version" value="${wsdl4j.version}"/>
                                <filter token="woden.version" value="${woden.version}"/>
                                <filter token="commons.httpclient.version" value="${commons.httpclient.version}"/>
                                <filter token="commons.codec.version" value="${commons.codec.version}"/>
                                <filter token="jibx.version" value="${jibx.version}"/>
                                <filter token="javax.mail.version" value="${javax.mail.version}"/>
                                <filter token="geronimo.spec.metadata.version" value="${geronimo.spec.metadata.version}"/>
                                <filter token="geronimo.spec.javamail.version" value="${geronimo.spec.javamail.version}"/>
                                <filter token="stax.impl.version" value="${stax.impl.version}"/>                                
                
								<!--
								  If it is neccessary to create the eclipse project manually without using "mvn eclipse:eclipse" command uncomment the following section which copies 
								  the required jars to the the project lib folder
								  -->


                                <!--
                                <property name="m2.local.repo" value="${settings.localRepository}"/>
                                <mkdir dir="./lib"/>
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/geronimo/specs/geronimo-activation_1.1_spec/${geronimo.spec.activation.version}/geronimo-activation_1.1_spec-${geronimo.spec.activation.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/ant/ant/${ant.version}/ant-${ant.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/ws/commons/axiom/axiom-api/${axiom.version}/axiom-api-${axiom.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/ws/commons/axiom/axiom-dom/${axiom.version}/axiom-dom-${axiom.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/ws/commons/axiom/axiom-impl/${axiom.version}/axiom-impl-${axiom.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/commons-logging/commons-logging/${commons.logging.version}/commons-logging-${commons.logging.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/neethi/neethi/${neethi.version}/neethi-${neethi.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/geronimo/specs/geronimo-stax-api_1.0_spec/${geronimo.spec.stax.version}/geronimo-stax-api_1.0_spec-${geronimo.spec.stax.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/codehaus/woodstox/wstx-asl/${stax.impl.version}/wstx-asl-${stax.impl.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/xmlbeans/xmlbeans/${xmlbeans.version}/xmlbeans-${xmlbeans.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/ws/commons/schema/XmlSchema/${xmlschema.version}/XmlSchema-${xmlschema.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/log4j/log4j/${log4j.version}/log4j-${log4j.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/wsdl4j/wsdl4j/${wsdl4j.version}/wsdl4j-${wsdl4j.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/woden/woden-api/${woden.version}/woden-api-${woden.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/commons-codec/commons-codec/${commons.codec.version}/commons-codec-${commons.codec.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/commons-httpclient/commons-httpclient/${commons.httpclient.version}/commons-httpclient-${commons.httpclient.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/axis2/axis2/${version}/axis2-${version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/geronimo/specs/geronimo-javamail_1.4_spec/${geronimo.spec.javamail.version}/geronimo-javamail_1.4_spec-${geronimo.spec.javamail.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/javax/mail/mail/${javax.mail.version}/mail-${javax.mail.version}.jar" />
                                <copy todir="./lib" file="${m2.local.repo}/org/apache/geronimo/specs/geronimo-ws-metadata_2.0_spec/${geronimo.spec.metadata.version}/geronimo-ws-metadata_2.0_spec-${geronimo.spec.metadata.version}.jar" />
                                -->
                                        
                                <mkdir dir="./icons"/>
                                <copy todir="./icons" overwrite="true">
                                    <fileset dir="../conf/codegen/icons" />
                                </copy>
                                <copy todir="." file="../conf/codegen/build.properties" overwrite="true" filtering="on"/>
                                <copy todir="." file="../conf/codegen/help_toc.xml" overwrite="true"/>
                                <copy todir="." file="../conf/codegen/plugin.xml" overwrite="true" filtering="on"/>
                                <copy todir="." file="../conf/codegen/.classpath" overwrite="true" filtering="on"/>
                                <copy todir="." file="../conf/codegen/.project" overwrite="true" filtering="on"/>
                                <copy todir="." file="../conf/codegen/readme.txt" overwrite="true"/>

                                <unzip src="./target/axis2.eclipse.codegen.plugin-${pom.version}.jar"
                                       dest="./target/plugin/${codegen.plugin.version}"/>
                                <!-- Copy to the same position with the filtering on-->
                                <copy todir="./target/plugin/${codegen.plugin.version}" filtering="on">
                                    <fileset dir="${codegen.resource.dir}">
                                        <include name="plugin.xml"/>
                                        <include name="build.properties"/>
                                        <include name="${plugin.classpath.file.name}"/>
                                    </fileset>
                                </copy>
                                <!-- copy the help directory -->
                                <mkdir dir="./target/plugin/${codegen.plugin.version}/${help.dir.name}"/>
                                <mkdir dir="./target/plugin/${codegen.plugin.version}/${help.dir.name}/${icons.dir.name}"/>
                                <copy todir="./target/plugin/${codegen.plugin.version}/${help.dir.name}">
                                    <fileset file="${codegen.help.resource.file}"/>
                                </copy>
                                <copy todir="./target/plugin/${codegen.plugin.version}/${help.dir.name}/${icons.dir.name}">
                                    <fileset dir="${codegen.help.images.dir}"/>
                                </copy>
                                <!-- copy the  icons-->
                                <mkdir dir="./target/plugin/${codegen.plugin.version}/${icons.dir.name}"/>
                                <copy todir="./target/plugin/${codegen.plugin.version}/${icons.dir.name}">
                                    <fileset dir="${codegen.resource.dir}/${icons.dir.name}"/>
                                </copy>
                                <!-- copy the lib files -->
                                <mkdir dir="./target/plugin/temp"/>
                                <unzip src="./target/dist-axis2-eclipse-codege-plugin.zip" dest="./target/plugin/temp"/>
                                <mkdir dir="./target/plugin/${codegen.plugin.version}/lib"/>
                                <copy todir="./target/plugin/${codegen.plugin.version}/lib">
                                    <fileset dir="./target/plugin/temp/lib"/>
                                </copy>
                                <delete dir="./target/plugin/temp"/>
                                <!-- copy the other project files-->
                                <copy todir="./target/plugin/${codegen.plugin.version}">
                                    <fileset file="${codegen.resource.dir}/${plugin.project.file.name}"/>
                                    <fileset file="${codegen.resource.dir}/${plugin.help.file.name}"/>
                                </copy>
                                <!-- copy the classes to classes directory-->
                                <mkdir dir="./target/plugin/${codegen.plugin.version}/classes"/>
                                <copy todir="./target/plugin/${codegen.plugin.version}/classes">
                                    <fileset dir="./target/plugin/${codegen.plugin.version}">
                                        <include name="**/org/**"/>
                                    </fileset>
                                </copy>
                                <!--Zip the classes to a jar file-->
                                <zip destfile="./target/plugin/${codegen.plugin.version}/${codegen.plugin.jar.name}"
                                     basedir="./target/plugin/${codegen.plugin.version}/classes" update="true"/>
                                <delete dir="./target/plugin/${codegen.plugin.version}/classes"/>
                                <!--Zip the eclipse plugin to the target/dist directory -->
                                <zip destfile="./target/dist/${codegen.plugin.zip.name}" basedir="./target/plugin"
                                     update="true"/>
                                <delete dir="./target/temp"/>
                                <delete dir="./target/classes"/>
                                <delete dir="./target/test-classes"/>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
