<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">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>alfresco-remote-api</artifactId>
    <name>Alfresco Remote API</name>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.alfresco</groupId>
        <artifactId>alfresco-community-repo</artifactId>
        <version>7.310</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-data-model</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-csv</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.santuario</groupId>
            <artifactId>xmlsec</artifactId>
            <version>1.5.8</version>
        </dependency>
        <!-- newer version, see REPO-3133 -->
        <dependency>
            <groupId>org.alfresco.surf</groupId>
            <artifactId>spring-webscripts</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxrpc-api</artifactId>
            <version>1.1</version>
        </dependency>

        <!-- This is needed at runtime by Web Client, so not really a test dependency -->
        <dependency>
            <groupId>org.apache.chemistry.opencmis</groupId>
            <artifactId>chemistry-opencmis-test-tck</artifactId>
            <version>${dependency.opencmis.version}</version>
            <!-- <scope>test</scope> -->
        </dependency>
        <!-- the cxf libs were updated, see dependencyManagement section -->


        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-repository</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco</groupId>
            <artifactId>alfresco-core</artifactId>
            <version>${project.version}</version>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco.surf</groupId>
            <artifactId>spring-webscripts</artifactId>
            <classifier>tests</classifier>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-server</artifactId>
            <version>8.2.0.v20160908</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-security</artifactId>
            <version>8.2.0.v20160908</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-webapp</artifactId>
            <version>8.2.0.v20160908</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.alfresco.cmis.client</groupId>
            <artifactId>alfresco-opencmis-extension</artifactId>
            <version>2.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <profiles>
         <!-- Profiles to extract the alfresco-pdf-renderer -->
		<profile>
			<id>win-alfresco-pdf-renderer-test</id>
			<activation>
				<os>
					<family>windows</family>
				</os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.alfresco</groupId>
					<artifactId>alfresco-pdf-renderer</artifactId>
					<classifier>win64</classifier>
					<type>tgz</type>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<inherited>false</inherited>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>extract-alfresco-pdf-renderer-test</id>
								<phase>generate-test-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<skip>${skipTests}</skip>
									<target>
										<echo message="Extracting alfresco-pdf-renderer (windows) for testing..." />
										<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
										<untar compression="gzip" src="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-win64.tgz" dest="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
			<properties>
				<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
			</properties>
		</profile>
		<profile>
			<id>linux-alfresco-pdf-renderer-test</id>
			<activation>
				<os>
					<family>linux</family>
				</os>
			</activation>
			<dependencies>
				<dependency>
					<groupId>org.alfresco</groupId>
					<artifactId>alfresco-pdf-renderer</artifactId>
					<classifier>linux</classifier>
					<type>tgz</type>
				</dependency>
			</dependencies>
			<build>
				<plugins>
					<plugin>
						<inherited>false</inherited>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>extract-alfresco-pdf-renderer-test</id>
								<phase>generate-test-resources</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<skip>${skipTests}</skip>
									<target>
										<echo message="Extracting alfresco-pdf-renderer (linux) for testing..." />
										<mkdir dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer" />
										<exec failonerror="true" executable="tar" dir="${project.build.directory}/test-binaries/alfresco-pdf-renderer">
											<arg value="xf" />
											<arg value="${settings.localRepository}/org/alfresco/alfresco-pdf-renderer/${dependency.alfresco-pdf-renderer.version}/alfresco-pdf-renderer-${dependency.alfresco-pdf-renderer.version}-linux.tgz" />
										</exec>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
			<properties>
				<alfresco-pdf-renderer.exe>${project.build.directory}/test-binaries/alfresco-pdf-renderer/alfresco-pdf-renderer</alfresco-pdf-renderer.exe>
			</properties>
		</profile>
    </profiles>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>license-maven-plugin</artifactId>
                    <version>2.0.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <!-- Create a jar of test classes -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>create-test-jar</id>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-test</id>
                        <configuration>
                            <!-- To prevent tests alfresco.log to be created in project roots and bother while synchronizing with SCM -->
                            <workingDirectory>${project.build.directory}</workingDirectory>
                            <systemPropertyVariables>
                                <alfresco-pdf-renderer.exe>${alfresco-pdf-renderer.exe}</alfresco-pdf-renderer.exe>

                                <!-- Database related properties -->
                                <db.url>${db.url}</db.url>
                                <db.driver>${db.driver}</db.driver>
                                <db.name>${db.name}</db.name>
                                <db.username>${db.username}</db.username>
                                <db.password>${db.password}</db.password>
                                <dir.root>${dir.root}</dir.root>
                                <img.exe>${img.exe}</img.exe>
                                <!-- BDE-91 -->
                                <alfresco.rmi.services.retries>30</alfresco.rmi.services.retries>
                                <alfresco.rmi.services.retryInterval>2000</alfresco.rmi.services.retryInterval>
                                <!-- FTR used in TransferWebScriptTest -->
                                <transferservice.receiver.enabled>true</transferservice.receiver.enabled>
                            </systemPropertyVariables>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- We still use committed generated sources -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>src/main/generated</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- ACE-3329 Create _en.properties message files  -->
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                 <executions>
                    <execution>
                        <id>duplicate-english-messages</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <target>
                        <copy todir="${project.build.outputDirectory}">
                            <fileset dir="${basedir}/src/main/resources" includes="alfresco/messages/**/*.properties,alfresco/templates/webscripts/**/*.properties" />
                            <mapper type="regexp" from="^([^_]*).properties$" to="\1_en.properties" />
                        </copy>
                    </target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <configuration>
                    <addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
                    <organizationName>Alfresco Software Limited</organizationName>
                    <failOnMissingHeader>true</failOnMissingHeader>
                    <failOnNotUptodateHeader>true</failOnNotUptodateHeader>
                    <licenseResolver>classpath://alfresco</licenseResolver>
                    <licenseName>${licenseName}</licenseName>
                    <roots>
                        <root>src</root>
                    </roots>
                    <includes>
                        <include>**/*.java</include>
                        <include>**/*.jsp</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <id>check-licenses</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>check-file-header</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.alfresco</groupId>
                        <artifactId>alfresco-license-headers</artifactId>
                        <version>1.0</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

</project>
