<?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 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-parent</artifactId>
    <version>1.4.0</version>
  </parent>

  <artifactId>camel-spring</artifactId>
  <name>Camel :: Spring</name>
  <description>Camel Spring support</description>
  <packaging>bundle</packaging>

  <properties>
  <camel.osgi.import>
    !javax.xml.bind.annotation.adapters,
    org.apache.camel.osgi;resolution:=optional,
    *
  </camel.osgi.import>
  <camel.osgi.export>
    org.apache.camel.spring.*;${camel.osgi.version},
    org.apache.camel.component;${camel.osgi.split.pkg};${camel.osgi.version},
    org.apache.camel.component.event;${camel.osgi.split.pkg};${camel.osgi.version},
    org.apache.camel.component.test;${camel.osgi.split.pkg};${camel.osgi.version},
    org.apache.camel.component.validator;${camel.osgi.split.pkg};${camel.osgi.version},
    org.apache.camel.component.xslt;${camel.osgi.split.pkg};${camel.osgi.version}
  </camel.osgi.export>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-aop</artifactId>
    </dependency>

    <!-- for testing -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-hamcrest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>jsr250-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <repositories>
    <!-- for maven jaxb plugin -->
    <repository>
      <id>java.net</id>
      <name>java.net Maven Repository</name>
      <url>http://download.java.net/maven/1</url>
      <!--<url>https://maven-repository.dev.java.net/nonav/repository</url>-->
      <layout>legacy</layout>
    </repository>
  </repositories>

  <build>
    <resources>
      <resource>
        <directory>target/schema</directory>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>

    <plugins>

      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <childDelegation>false</childDelegation>
          <useFile>true</useFile>
          <forkMode>pertest</forkMode>
          <excludes>
          </excludes>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>process-sources</id>
            <phase>process-sources</phase>
            <configuration>
              <tasks>
                <echo>Copying to code together for the XSD generation</echo>

                <mkdir dir="${project.build.directory}/schema-src"/>
                <copy todir="${project.build.directory}/schema-src">
                  <fileset dir="${basedir}/src/main/java">
                    <include name="org/apache/camel/spring/Camel*.java"/>
                    <include name="org/apache/camel/spring/Endpoint*.java"/>
                    <include name="org/apache/camel/spring/package-info.java"/>
                  </fileset>
                  <fileset dir="${basedir}/../../camel-core/src/main/java">
                    <include name="org/apache/camel/model/**/*.java"/>
                  </fileset>
                </copy>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>

          <execution>
            <id>package</id>
            <phase>package</phase>
            <configuration>
              <tasks>
                <echo>Deleting unwanted resources from the test-jar</echo>
                <delete file="${project.build.directory}/test-classes/log4j.properties" verbose="true"/>
                <delete file="${project.build.directory}/test-classes/META-INF/spring/*" verbose="true"/>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>xsddoc</groupId>
            <artifactId>maven-xsddoc-plugin</artifactId>
            <version>1.0</version>
          </dependency>
          <dependency>
            <groupId>xsddoc</groupId>
            <artifactId>xsddoc</artifactId>
            <version>1.0</version>
          </dependency>
        </dependencies>
      </plugin>

      <!-- generate the attached tests jar -->
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <!-- TODO: this doesn't work - if ever we can figure out the maven ninja to get it working -->
          <!-- TODO: we can zap the Ant package phase stuff above -->
          <excludes>
            <exclude>**/*/log4j.properties</exclude>
          </excludes>
        </configuration>
      </plugin>


      <plugin>
        <groupId>com.sun.tools.jxc.maven2</groupId>
        <artifactId>maven-jaxb-schemagen-plugin</artifactId>
        <!--<version>1.3-dev</version>-->
        <executions>
          <execution>
            <phase>process-sources</phase>
            <configuration>
              <destdir>${project.build.directory}/schema</destdir>
              <srcdir>${project.build.directory}/schema-src</srcdir>
              <schemas>
                <schema>
                  <namespace>http://activemq.apache.org/camel/schema/spring</namespace>
                  <file>camel-spring.xsd</file>
                </schema>
              </schemas>
              <!--<verbose>false</verbose>-->
            </configuration>
            <goals>
              <goal>generate</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/schema/camel-spring.xsd</file>
                  <type>xsd</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>


<!--
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>org.apache.camel.spring.Main</mainClass>
        </configuration>
      </plugin>
-->
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>release</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>package</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <links>
                <link>http://java.sun.com/j2se/1.5.0/docs/api/</link>
                <link>http://java.sun.com/j2ee/1.4/docs/api/</link>
                <link>http://commons.apache.org/collections/api-release/</link>
                <link>http://jakarta.apache.org/commons/dbcp/apidocs/</link>
                <link>http://jakarta.apache.org/commons/fileupload/apidocs/</link>
                <link>http://jakarta.apache.org/commons/httpclient/apidocs/</link>
                <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
                <link>http://jakarta.apache.org/commons/pool/apidocs/</link>
                <link>http://junit.sourceforge.net/javadoc/</link>
                <link>http://logging.apache.org/log4j/docs/api/</link>
                <link>http://mina.apache.org/report/trunk/apidocs/</link>
              </links>
              <stylesheetfile>${basedir}/../../etc/css/stylesheet.css</stylesheetfile>
              <linksource>true</linksource>
              <source>1.5</source>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

<!--
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </reporting>
-->
</project>
