<?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>

    <developers>
        <developer>
            <name>Maurizio Pillitu</name>
            <organization>Alfresco</organization>
            <organizationUrl>http://www.alfresco.com</organizationUrl>
            <url>http://session.it</url>
        </developer>
        <developer>
            <name>Rafa Haro</name>
            <organization>Zaizi</organization>
            <organizationUrl>http://www.zaizi.com</organizationUrl>
            <url>https://github.com/rafaharo</url>
        </developer>
    </developers>

    <artifactId>mcf-alfresco-webscript-connector</artifactId>
    <name>ManifoldCF - Connectors - Alfresco Webscript</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <alfresco.indexer.version>0.8.1</alfresco.indexer.version>
        <icu4j.version>68.2</icu4j.version>
    </properties>

    <repositories>
        <repository>
            <id>alfresco-release</id>
            <url>https://maven.alfresco.com/nexus/repository/releases</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>alfresco-release</id>
            <url>https://maven.alfresco.com/nexus/repository/releases</url>
        </pluginRepository>
    </pluginRepositories>

    <build>
        <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>
            <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>
                    <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
                </configuration>
            </plugin>
            <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>
                                    <artifactId>alfresco-indexer-webscripts-war</artifactId>
                                    <groupId>com.github.maoo.indexer</groupId>
                                    <version>${alfresco.indexer.version}</version>
                                    <type>war</type>
                                    <overWrite>false</overWrite>
                                    <destFileName>alfresco.war</destFileName>
                                </artifactItem>
                                <artifactItem>
                                    <artifactId>icu4j</artifactId>
                                    <groupId>com.ibm.icu</groupId>
                                    <version>${icu4j.version}</version>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <destFileName>icu4j-${icu4j.version}.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                     <execution>
                        <id>unpack-filtered-alfresco-indexer-war</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                    <configuration>
                    <outputDirectory>target/alfresco-indexer-webscripts-war-${alfresco.indexer.version}</outputDirectory>
	                    <artifactItems>
	                         <artifactItem>
	                             <artifactId>alfresco-indexer-webscripts-war</artifactId>
	                             <groupId>com.github.maoo.indexer</groupId>
	                             <version>${alfresco.indexer.version}</version>
	                             <type>war</type>
	                             <overWrite>false</overWrite>
	                             <destFileName>alfresco.war</destFileName>
	                             <excludes>WEB-INF/lib/icu4j-3.6.1.jar</excludes>
	                         </artifactItem>
	                    </artifactItems>
                    </configuration>
                   </execution>
                   <execution>
                        <id>copy-icu-in-alfresco-indexer-war</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                    <configuration>
                    <outputDirectory>target/alfresco-indexer-webscripts-war-${alfresco.indexer.version}/WEB-INF/lib</outputDirectory>
                        <artifactItems>
                             <artifactItem>
                                 <artifactId>icu4j</artifactId>
                                 <groupId>com.ibm.icu</groupId>
                                 <version>${icu4j.version}</version>
                                 <type>jar</type>
                                 <overWrite>false</overWrite>
                             </artifactItem>
                        </artifactItems>
                    </configuration>
                   </execution>
                </executions>
            </plugin>
            <plugin>
		        <artifactId>maven-antrun-plugin</artifactId>
		        <executions>
	               <execution>
	                   <id>Zip Alfresco WAR with ICU JAR</id>
	                   <phase>generate-resources</phase>
	                   <goals>
	                       <goal>run</goal>
	                   </goals>
	                   <configuration>
	                     <target>
	                       <zip destfile="target/dependency/alfresco.war" basedir="target/alfresco-indexer-webscripts-war-${alfresco.indexer.version}" />
	                     </target>
	                  </configuration>
                  </execution>
	              </executions>
	              </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>
                        <alfrescoServerWarPath>../dependency/alfresco.war</alfrescoServerWarPath>
                    </systemPropertyVariables>
                    <excludes>
                        <exclude>**/*Postgresql*.java</exclude>
                        <exclude>**/*MySQL*.java</exclude>
                    </excludes>
                    <forkCount>1</forkCount>
                    <reuseForks>false</reuseForks>
                    <workingDirectory>target/test-output</workingDirectory>
                    <argLine>-Xms512m -Xmx1024m -Xss1024k -XX:MaxPermSize=256m -XX:NewSize=256m</argLine>
                    <argLine>--add-opens java.base/java.lang=ALL-UNNAMED</argLine>
                </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>
    </build>

    <dependencies>
        <dependency>
            <groupId>com.github.maoo.indexer</groupId>
            <artifactId>alfresco-indexer-client</artifactId>
            <version>${alfresco.indexer.version}</version>
            <exclusions>
              <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
              </exclusion>
            </exclusions>
        </dependency>

        <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>0.13.0</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.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-plus</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.eclipse.jetty.toolchain</groupId>
          <artifactId>jetty-schemas</artifactId>
          <version>${jetty-schemas.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>

        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-junit-jupiter</artifactId>
            <version>${mockito.version}</version>
            <scope>test</scope>
        </dependency>
        
        <dependency>
            <groupId>org.wiremock</groupId>
            <artifactId>wiremock</artifactId>
            <version>${wiremock.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>
</project>
