<?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.35</version>
		<relativePath>../../parent/pom.xml</relativePath>
	</parent>
	<artifactId>axis2.eclipse.service.plugin</artifactId>
	<name>Apache Axis 2.0 - tool - Eclipse service Plugin</name>
	<packaging>maven-plugin</packaging>
	<description>The Axis 2 Eclipse Service Plugin for Service archive creation</description>
	<dependencies>
		<dependency>
			<groupId>org.apache.axis2</groupId>
			<artifactId>axis2</artifactId>
			<version>${version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.axis2</groupId>
                        <artifactId>axis2-java2wsdl</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>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</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.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.equinox</groupId>
					<artifactId>org.eclipse.equinox.registry</artifactId>
				</exclusion>
				<exclusion>
					<groupId>org.eclipse.equinox</groupId>
					<artifactId>org.eclipse.equinox.preferences</artifactId>
				</exclusion>
				<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>
				<exclusion>
					<groupId>org.eclipse.ant</groupId>
					<artifactId>org.eclipse.ant.core</artifactId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>org.eclipse.swt</groupId>
			<artifactId>org.eclipse.swt</artifactId>
		</dependency>
		<dependency>
			<groupId>org.eclipse.osgi</groupId>
			<artifactId>org.eclipse.osgi</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.eclipse.jface</groupId>
			<artifactId>org.eclipse.jface</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.ant</groupId>
			<artifactId>ant</artifactId>
		</dependency>
	</dependencies>
	<build>
		<resources>
			<resource>
				<directory>src/main/java</directory>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.4</source>
					<target>1.4</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-service-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="service.plugin.version" value="Axis2_Service_Archiver_${eclipse.plugins.version}"/>
								<property name="service.plugin.zip.name" value="axis2-eclipse-service-archiver-wizard.zip"/>
								<property name="service.plugin.jar.name" value="Axis_Service_Archiver.jar"/>
								<property name="src" value="./src"/>
								<property name="service.src.dir" value="../axis2-eclipse-service-plugin/src/main/java"/>
								<property name="output" value="../target/eclipse_plugins"/>
								<property name="output.target" value="${output}/release"/>
								<property name="service.output.dir" value="${output}/service-archiver"/>
								<property name="plugin.output.dir" value="${output}/plugin"/>
								<property name="service.plugin.output.dir" value="${plugin.output.dir}/${service.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="service.resource.dir" value="../conf/service"/>
								<property name="service.help.resource.file" value="../../../modules/documentation/xdocs/tools/1_3/eclipse/servicearchiver-plugin.html"/>
								<property name="service.help.images.dir" value="../../../modules/documentation/xdocs/tools/1_3/eclipse/images"/>
								<property name="axis2.lib.dir" value="../../../target/lib"/>
								<!--Filter tockens for the copy command to filter the versions of external dependencies -->
								<filter token="version" value="${version}"/>
								<filter token="eclipse.plugins.version" value="${eclipse.plugins.version}"/>
								<filter token="ant.version" value="${ant.version}"/>
								<filter token="commons.logging.version" value="${commons.logging.version}"/>
								<filter token="log4j.version" value="${log4j.version}"/>
								<delete dir="./target/plugin/${service.plugin.version}"/>
								<mkdir dir="./target/plugin/${service.plugin.version}"/>
								<delete dir="./target/dist"/>
								<mkdir dir="./target/dist"/>
								<unzip src="./target/axis2.eclipse.service.plugin-${version}.jar" dest="./target/plugin/${service.plugin.version}"/>
								<!-- Copy to the same position with the filtering on-->
								<copy todir="./target/plugin/${service.plugin.version}" filtering="on">
									<fileset dir="${service.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/${service.plugin.version}/${help.dir.name}"/>
								<mkdir dir="./target/plugin/${service.plugin.version}/${help.dir.name}/${icons.dir.name}"/>
								<copy todir="./target/plugin/${service.plugin.version}/${help.dir.name}">
									<fileset file="${service.help.resource.file}"/>
								</copy>
								<copy todir="./target/plugin/${service.plugin.version}/${help.dir.name}/${icons.dir.name}">
									<fileset dir="${service.help.images.dir}"/>
								</copy>
								<!-- copy the  icons-->
								<mkdir dir="./target/plugin/${service.plugin.version}/${icons.dir.name}"/>
								<copy todir="./target/plugin/${service.plugin.version}/${icons.dir.name}">
									<fileset dir="${service.resource.dir}/${icons.dir.name}"/>
								</copy>
                                                                <!-- copy the lib files -->
                                                                <mkdir dir="./target/plugin/temp"/>
                                                                <unzip src="./target/dist-axis2-eclipse-service-plugin.zip" dest="./target/plugin/temp"/>
                                                                <mkdir dir="./target/plugin/${service.plugin.version}/lib"/>
                                                                <copy todir="./target/plugin/${service.plugin.version}/lib">
                                                                        <fileset dir="./target/plugin/temp/lib"/>
                                                                </copy>
                                                                <delete dir="./target/plugin/temp"/>
							
								<!-- copy the other project files-->
								<copy todir="./target/plugin/${service.plugin.version}">
									<fileset file="${service.resource.dir}/${plugin.project.file.name}"/>
									<fileset file="${service.resource.dir}/${plugin.help.file.name}"/>
								</copy>
								<!-- copy the classes to classes directory-->
								<mkdir dir="./target/plugin/${service.plugin.version}/classes"/>
								<copy todir="./target/plugin/${service.plugin.version}/classes">
									<fileset dir="./target/plugin/${service.plugin.version}">
										<include name="**/org/**"/>
									</fileset>
								</copy>
								<!--Zip the classes to a jar file -->
								<zip destfile="./target/plugin/${service.plugin.version}/${service.plugin.jar.name}" basedir="./target/plugin/${service.plugin.version}/classes" update="true"/>
								<delete dir="./target/plugin/${service.plugin.version}/classes"/>
								<!--Zip the eclipse plugin to the target/dist directory -->
								<zip destfile="./target/dist/${service.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>
<distributionManagement>
   <repository>
         <id>wso2-maven2-repository</id>
	       <name>WSO2 Maven2 Repository</name>
	             <url>scp://dist.wso2.org/home/httpd/dist.wso2.org/maven2/</url>
		        </repository>

			   <snapshotRepository>
			         <id>wso2-maven2-snapshot-repository</id>
				       <name>WSO2 Maven2 Repository</name>
				             <url>scp://dist.wso2.org/home/httpd/dist.wso2.org/maven2/</url>
					        </snapshotRepository>
						</distributionManagement>
						</project>

