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

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.syncope</groupId>
    <artifactId>syncope</artifactId>
    <version>4.1.1</version>
  </parent>

  <name>Apache Syncope Archetype</name>
  <description>Apache Syncope Archetype</description>
  <groupId>org.apache.syncope</groupId>
  <artifactId>syncope-archetype</artifactId>
  <packaging>maven-archetype</packaging>

  <properties>
    <maven.archetype.version>3.4.1</maven.archetype.version>

    <rootpom.basedir>${basedir}/..</rootpom.basedir>
  </properties>

  <build>
    <extensions>
      <extension>
        <groupId>org.apache.maven.archetype</groupId>
        <artifactId>archetype-packaging</artifactId>
        <version>${maven.archetype.version}</version>
      </extension>
    </extensions>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-archetype-plugin</artifactId>
          <version>${maven.archetype.version}</version>
          <extensions>true</extensions>
        </plugin>
      </plugins>
    </pluginManagement>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>adjust-MasterContent</id>
            <goals>
              <goal>run</goal>
            </goals>
            <phase>prepare-package</phase>
            <configuration>
              <target>
                <replace file="${project.build.outputDirectory}/archetype-resources/pom.xml"
                         token="syncopeVersion"
                         value="${project.version}"/>
                <replace file="${project.build.outputDirectory}/archetype-resources/core/src/main/resources/domains/MasterContent.xml"
                         token="http://localhost:"
                         value="https://localhost:"/>
                <replace file="${project.build.outputDirectory}/archetype-resources/core/src/test/resources/domains/MasterContent.xml"
                         token="http://localhost:"
                         value="https://localhost:"/>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <configuration>
          <resourceIncludes>src/main/resources/**/*.properties</resourceIncludes>
        </configuration>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>

      <resource>
        <directory>..</directory>
        <targetPath>META-INF</targetPath>
        <includes>
          <include>LICENSE</include>
          <include>NOTICE</include>
        </includes>
      </resource>

      <resource>
        <directory>../core/starter/src/main/resources</directory>
        <includes>
          <include>core.properties</include>
        </includes>
        <targetPath>archetype-resources/core/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../core/provisioning-java/src/main/resources</directory>
        <targetPath>archetype-resources/core/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../core/persistence-jpa/src/main/resources</directory>
        <excludes>
          <exclude>META-INF/spring-persistence.xml</exclude>
        </excludes>
        <targetPath>archetype-resources/core/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../core/persistence-jpa-json/src/main/resources/</directory>
        <includes>
          <include>META-INF/*</include>
          <include>audit/*</include>
        </includes>
        <targetPath>archetype-resources/core/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../core/persistence-jpa/src/test/resources/domains</directory>
        <targetPath>archetype-resources/core/src/test/resources/domains</targetPath>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/main/resources</directory>
        <targetPath>archetype-resources/core/src/main/resources</targetPath>
        <includes>
          <include>log4j2.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/test/resources</directory>
        <targetPath>archetype-resources/core/src/test/resources</targetPath>
        <includes>
          <include>keystore</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/test/resources/scriptedsql</directory>
        <targetPath>archetype-resources/core/src/test/resources/scriptedsql</targetPath>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/test/resources/rest</directory>
        <targetPath>archetype-resources/core/src/test/resources/rest</targetPath>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/main/webapp/WEB-INF</directory>
        <targetPath>archetype-resources/core/src/main/webapp/WEB-INF</targetPath>
      </resource>
      <resource>
        <directory>../fit/core-reference/src/main/resources</directory>
        <targetPath>archetype-resources/core/src/test/resources</targetPath>
        <includes>
          <include>core-embedded.properties</include>
          <include>core-all.properties</include>
          <include>core-https.properties</include>
          <include>userWorkflow.bpmn20.xml</include>
        </includes>
      </resource>
            
      <resource>
        <directory>../client/idrepo/console/src/main/resources</directory>
        <targetPath>archetype-resources/console/src/main/resources</targetPath>
        <includes>
          <include>console.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/console-reference/src/main/resources</directory>
        <targetPath>archetype-resources/console/src/main/resources</targetPath>
        <includes>
          <include>log4j2.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/console-reference/src/main/webapp/WEB-INF</directory>
        <targetPath>archetype-resources/console/src/main/webapp/WEB-INF</targetPath>
      </resource>
      <resource>
        <directory>../fit/console-reference/src/main/resources</directory>
        <targetPath>archetype-resources/console/src/test/resources</targetPath>
        <includes>
          <include>console-embedded.properties</include>
          <include>console-https.properties</include>
        </includes>
      </resource>
      
      <resource>
        <directory>../client/idrepo/enduser/src/main/resources</directory>
        <targetPath>archetype-resources/enduser/src/main/resources</targetPath>
        <includes>
          <include>enduser.properties</include>
          <include>customFormLayout.json</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/enduser-reference/src/main/resources</directory>
        <targetPath>archetype-resources/enduser/src/main/resources</targetPath>
        <includes>
          <include>log4j2.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/enduser-reference/src/main/webapp/WEB-INF</directory>
        <targetPath>archetype-resources/enduser/src/main/webapp/WEB-INF</targetPath>
      </resource>
      <resource>
        <directory>../fit/enduser-reference/src/main/resources</directory>
        <targetPath>archetype-resources/enduser/src/test/resources</targetPath>
        <includes>
          <include>enduser-embedded.properties</include>
          <include>enduser-https.properties</include>
        </includes>
      </resource>
      
      <resource>
        <directory>../sra/src/main/resources</directory>
        <targetPath>archetype-resources/sra/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../fit/wa-reference/src/test/resources</directory>
        <targetPath>archetype-resources/sra/src/test/resources</targetPath>
        <includes>
          <include>sra-*.properties</include>
        </includes>
      </resource>

      <resource>
        <directory>../wa/starter/src/main/resources</directory>
        <includes>
          <include>cas-theme-default.properties</include>
          <include>wa.properties</include>
        </includes>
        <targetPath>archetype-resources/wa/src/main/resources</targetPath>
      </resource>
      <resource>
        <directory>../fit/wa-reference/src/main/webapp/WEB-INF</directory>
        <targetPath>archetype-resources/wa/src/main/webapp/WEB-INF</targetPath>
      </resource>
      <resource>
        <directory>../fit/wa-reference/src/main/resources</directory>
        <targetPath>archetype-resources/wa/src/main/resources</targetPath>
        <includes>
          <include>log4j2.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>../fit/wa-reference/src/main/resources</directory>
        <targetPath>archetype-resources/wa/src/test/resources</targetPath>
        <includes>
          <include>wa-embedded.properties</include>
        </includes>
      </resource>

      <resource>
        <directory>../fit/wa-reference/src/test/resources</directory>
        <targetPath>archetype-resources/fit/src/test/resources</targetPath>
        <includes>
          <include>keystore.jks</include>
        </includes>
      </resource>
    </resources>
  </build>
  
  <profiles>
    <profile>
      <id>site</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.asciidoctor</groupId>
            <artifactId>asciidoctor-maven-plugin</artifactId>
            <inherited>false</inherited>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-site-plugin</artifactId>
            <inherited>true</inherited>
            <configuration>
              <skip>true</skip>
              <skipDeploy>true</skipDeploy>
              <generateReports>false</generateReports>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-docs-to-site</id>
                <phase>none</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  
</project>
