<?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.5.2</version>
        <relativePath>../../parent/pom.xml</relativePath>
    </parent>
    <artifactId>axis2.eclipse.service.plugin</artifactId>
    <name>Apache Axis2 - tool - Eclipse service Plugin</name>
    <packaging>bundle</packaging>
    <description>The Axis 2 Eclipse Service Plugin for Service archive creation</description>
    <scm>
        <connection>scm:svn:http://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.5.2/modules/tool/axis2-eclipse-service-plugin</connection>
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/axis/axis2/java/core/tags/v1.5.2/modules/tool/axis2-eclipse-service-plugin</developerConnection>
        <url>http://svn.apache.org/viewvc/axis/axis2/java/core/tags/v1.5.2/modules/tool/axis2-eclipse-service-plugin</url>
    </scm>
    <dependencies>
        <dependency>
            <groupId>org.apache.axis2</groupId>
            <artifactId>axis2-codegen</artifactId>
            <version>${project.version}</version>
        </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>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>.</directory>
                <includes>
                    <include>plugin.xml</include>
                    <include>icons/**</include>
                    <include>help_toc.xml</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <configuration>
                            <resourceBundles>
                                <resourceBundle>org.apache.axis2:axis2-resource-bundle:${pom.version}</resourceBundle>
                            </resourceBundles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <!-- We don't use the PDE mode here because we don't want maven-eclipse-plugin to tamper with
                         the manifest generated by maven-bundle-plugin -->
                    <additionalBuildcommands>
                        <buildcommand>org.eclipse.pde.ManifestBuilder</buildcommand>
                        <buildcommand>org.eclipse.pde.SchemaBuilder</buildcommand>
                    </additionalBuildcommands>
                    <additionalProjectnatures>
                        <projectnature>org.eclipse.pde.PluginNature</projectnature>
                    </additionalProjectnatures>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.1</version>
                <executions>
                    <execution>
                        <!-- This copies the dependencies so that they can be located by Eclipse -->
                        <id>copy-dependencies</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>lib</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>false</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.3</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>lib</directory>
                        </fileset>
                        <fileset>
                            <directory>META-INF</directory>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <!-- Produce the manifest in the location expected by Eclipse -->
                    <manifestLocation>META-INF</manifestLocation>
                    <instructions>
                        <!-- Embed all dependencies, except those which are provided by the Eclipse runtime -->
                        <Embed-Dependency>*;scope=compile|runtime;artifactId=!org.eclipse.*|commons-logging|wstx-asl|geronimo-activation_1.1_spec|geronimo-javamail_1.4_spec|geronimo-stax-api_1.0_spec|ant*</Embed-Dependency>
                        <Embed-Directory>lib</Embed-Directory>
                        <Embed-Transitive>true</Embed-Transitive>
                        <!-- Exclude imports that are actually not used -->
                        <Import-Package>!org.dom4j*,!nu.xom,!org.jdom*,!javax.portlet,!org.apache.commons.io*,*</Import-Package>
                        <Export-Package />
                        <Bundle-Name>Axis2 Service Maker</Bundle-Name>
                        <Bundle-Activator>org.apache.axis2.tool.service.eclipse.plugin.ServiceArchiver</Bundle-Activator>
                        <Bundle-SymbolicName>org.apache.axis2.eclipse.service.plugin;singleton:=true</Bundle-SymbolicName>
                        <Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
                        <Bundle-RequiredExecutionEnvironment>J2SE-1.5</Bundle-RequiredExecutionEnvironment>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>extract-bundle-symbolicname-and-version</id>
                        <phase>package</phase>
                        <goals>
                            <goal>execute</goal>
                        </goals>
                        <configuration>
                            <source>
                                import java.util.jar.Manifest
                                
                                Manifest manifest = new Manifest(new FileInputStream(new File(project.basedir, "META-INF/MANIFEST.MF")))
                                project.properties["bundle-symbolic-name"] = manifest.mainAttributes.getValue("Bundle-SymbolicName").find("^[^;]*") 
                                project.properties["bundle-version"] = manifest.mainAttributes.getValue("Bundle-Version")
                            </source>
                        </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>attached</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>${pom.basedir}/eclipse-service-plugin-assembly.xml</descriptor>
                            </descriptors>
                            <finalName>dist</finalName>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
