<?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/xsd/maven-4.0.0.xsd">
  <parent>
    <groupId>org.apache.manifoldcf</groupId>
    <artifactId>mcf-connectors</artifactId>
    <version>2.30</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <chemistry.version>1.1.0</chemistry.version>
    <chemistry.jaxws.version>2.3.1</chemistry.jaxws.version>
	<chemistry.activation.version>1.2.1</chemistry.activation.version>
	<chemistry.log4j.version>2.17.2</chemistry.log4j.version>
	<chemistry.cxf.version>3.5.2</chemistry.cxf.version>
  </properties>

  <developers>
    <developer>
      <name>Piergiorgio Lucidi</name>
      <organization>Zia Consulting</organization>
      <organizationUrl>https://www.ziaconsulting.com</organizationUrl>
      <url>https://www.open4dev.com</url>
    </developer>
  </developers>
  
  <artifactId>mcf-cmis-connector</artifactId>
  <name>ManifoldCF - Connectors - CMIS</name>

  <build>
    <defaultGoal>integration-test</defaultGoal>
    <sourceDirectory>${basedir}/connector/src/main/java</sourceDirectory>
    <testSourceDirectory>${basedir}/connector/src/test/java</testSourceDirectory>
    <resources>
      <resource>
        <directory>${basedir}/connector/src/main/native2ascii</directory>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>${basedir}/connector/src/main/resources</directory>
        <includes>
          <include>**/*.html</include>
          <include>**/*.js</include>
        </includes>
      </resource>
    </resources> 
    <testResources>
      <testResource>
        <directory>${basedir}/connector/src/test/resources</directory>
      </testResource>
    </testResources>

    <plugins>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>native2ascii-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
        <configuration>
            <workDir>target/classes</workDir>
        </configuration>
        <executions>
            <execution>
                <id>native2ascii-utf8</id>
                <goals>
                    <goal>native2ascii</goal>
                </goals>
                <configuration>
                    <encoding>UTF8</encoding>
                    <includes>
                      <include>**/*.properties</include>
                    </includes>
                </configuration>
            </execution>
        </executions>
      </plugin>

      <!-- Test plugin configuration -->
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
           <execution>
            <id>copy-war</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <outputDirectory>target/dependency</outputDirectory>
              <artifactItems>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-api-service</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                  <destFileName>mcf-api-service.war</destFileName>
                </artifactItem>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-authority-service</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                  <destFileName>mcf-authority-service.war</destFileName>
                </artifactItem>
                <artifactItem>
                  <groupId>${project.groupId}</groupId>
                  <artifactId>mcf-crawler-ui</artifactId>
                  <version>${project.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                  <destFileName>mcf-crawler-ui.war</destFileName>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.chemistry.opencmis</groupId>
                  <artifactId>chemistry-opencmis-server-inmemory</artifactId>
                  <version>${chemistry.version}</version>
                  <type>war</type>
                  <overWrite>false</overWrite>
                  <destFileName>chemistry-opencmis-server-inmemory.war</destFileName>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
          <execution>
          	<id>opencmis-server-download-dependencies</id>
          	<phase>process-test-resources</phase>
          	<goals>
              <goal>copy</goal>
            </goals>
            <configuration>
            <outputDirectory>target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib</outputDirectory>
            <artifactItems>
            	<artifactItem>
                  <groupId>javax.xml.ws</groupId>
                  <artifactId>jaxws-api</artifactId>
                  <version>${chemistry.jaxws.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>jakarta.activation</groupId>
                  <artifactId>jakarta.activation-api</artifactId>
                  <version>${chemistry.activation.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.logging.log4j</groupId>
                  <artifactId>log4j-slf4j-impl</artifactId>
                  <version>${chemistry.log4j.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.logging.log4j</groupId>
                  <artifactId>log4j-core</artifactId>
                  <version>${chemistry.log4j.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.logging.log4j</groupId>
                  <artifactId>log4j-api</artifactId>
                  <version>${chemistry.log4j.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                 <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-core</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-bindings-soap</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-bindings-xml</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-databinding-jaxb</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-frontend-jaxws</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-frontend-simple</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-transports-http</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-ws-addr</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-ws-policy</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>
                <artifactItem>
                  <groupId>org.apache.cxf</groupId>
                  <artifactId>cxf-rt-wsdl</artifactId>
                  <version>${chemistry.cxf.version}</version>
                  <type>jar</type>
                  <overWrite>false</overWrite>
                </artifactItem>   
                </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
     <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-antrun-plugin</artifactId>
      <version>3.0.0</version>
      <executions>
      	<execution>
      		<id>opencmis-server-remove-old-dependencies</id>
      		<phase>generate-test-resources</phase>
      		<goals>
              <goal>run</goal>
            </goals>
      		<configuration>
      			<target>
      				<copyfile src="target/dependency/chemistry-opencmis-server-inmemory.war" dest="target/dependency/chemistry-opencmis-server-inmemory-patched.war"/>
		
					<unzip src="target/dependency/chemistry-opencmis-server-inmemory-patched.war" dest="target/dependency/chemistry-opencmis-server-inmemory-patched"/>
					
					<!-- Removing the old dependencies -->
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-core-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-bindings-soap-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-bindings-xml-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-databinding-jaxb-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-frontend-jaxws-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-frontend-simple-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-transports-http-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-ws-addr-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-ws-policy-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/cxf-rt-wsdl-3.0.12.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/log4j-slf4j-impl-2.6.1.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/log4j-core-2.6.1.jar" />
					<delete file="target/dependency/chemistry-opencmis-server-inmemory-patched/WEB-INF/lib/log4j-api-2.6.1.jar" />
		
      			</target>
      		</configuration>
      	</execution>
      	<execution>
      		<id>opencmis-server-package-war</id>
      		<phase>pre-integration-test</phase>
      		<goals>
              <goal>run</goal>
            </goals>
            <configuration>
            	<target>
            		<delete file="target/dependency/chemistry-opencmis-server-inmemory.war"/>
            		<jar destfile="target/dependency/chemistry-opencmis-server-inmemory.war" basedir="target/dependency/chemistry-opencmis-server-inmemory-patched"/>
            	</target>
            </configuration>
      	</execution>
      </executions>
     </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*Postgresql*.java</exclude>
            <exclude>**/*MySQL*.java</exclude>
          </excludes>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
          <workingDirectory>target/test-output</workingDirectory>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>2.22.2</version>
        <configuration>
          <skipTests>${skipITs}</skipTests>
          <systemPropertyVariables>
            <crawlerWarPath>../dependency/mcf-crawler-ui.war</crawlerWarPath>
            <authorityserviceWarPath>../dependency/mcf-authority-service.war</authorityserviceWarPath>
            <apiWarPath>../dependency/mcf-api-service.war</apiWarPath>
            <openCmisServerWarPath>../dependency/chemistry-opencmis-server-inmemory.war</openCmisServerWarPath>
          </systemPropertyVariables>
          <excludes>
            <exclude>**/*Postgresql*.java</exclude>
            <exclude>**/*MySQL*.java</exclude>
          </excludes>
          <forkCount>1</forkCount>
          <reuseForks>false</reuseForks>
          <workingDirectory>target/test-output</workingDirectory>
        </configuration>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
          <execution>
            <id>verify</id>
            <goals>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
    <pluginManagement>
    	<plugins>
    		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
    		<plugin>
    			<groupId>org.eclipse.m2e</groupId>
    			<artifactId>lifecycle-mapping</artifactId>
    			<version>1.0.0</version>
    			<configuration>
    				<lifecycleMappingMetadata>
    					<pluginExecutions>
    						<pluginExecution>
    							<pluginExecutionFilter>
    								<groupId>org.codehaus.mojo</groupId>
    								<artifactId>
    									native2ascii-maven-plugin
    								</artifactId>
    								<versionRange>
    									[1.0-beta-1,)
    								</versionRange>
    								<goals>
    									<goal>native2ascii</goal>
    								</goals>
    							</pluginExecutionFilter>
    							<action>
    								<ignore></ignore>
    							</action>
    						</pluginExecution>
    					</pluginExecutions>
    				</lifecycleMappingMetadata>
    			</configuration>
    		</plugin>
    	</plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-connector-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-agents</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-pull-agent</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-ui-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.chemistry.opencmis</groupId>
        <artifactId>chemistry-opencmis-client-impl</artifactId>
        <version>1.1.0</version>
     </dependency>
     <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>${commons-lang.version}</version>
    </dependency>
     <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>${commons-collections.version}</version>
    </dependency>
     <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>${commons-io.version}</version>
    </dependency>
    <dependency>
		  <groupId>joda-time</groupId>
		  <artifactId>joda-time</artifactId>
		  <version>2.8.1</version>
    </dependency>
    
    <!-- Test scope -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-core</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-agents</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-pull-agent</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.chemistry.opencmis</groupId>
      <artifactId>chemistry-opencmis-server-inmemory</artifactId>
      <version>1.1.0</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>${postgresql.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>${hsqldb.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>${mysql.version}</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-api-service</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-authority-service</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>mcf-crawler-ui</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-util</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10</groupId>
      <artifactId>jetty-ee10-webapp</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty.ee10</groupId>
      <artifactId>jetty-ee10-servlet</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-http</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-io</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-security</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-xml</artifactId>
      <version>${jetty.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jsp-api-2.1-glassfish</artifactId>
      <version>${glassfish.version}</version>
      <scope>test</scope>
    </dependency>    
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jsp-2.1-glassfish</artifactId>
      <version>${glassfish.version}</version>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-simple</artifactId>
      <version>${slf4j.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>
</project>
