<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <groupId>ai.timefold.solver.enterprise</groupId>
  <artifactId>timefold-solver-enterprise-parent</artifactId>
  <version>2.2.0</version> <!-- Keep in sync with open-source. -->
  <packaging>pom</packaging>
  <name>Timefold Solver Enterprise Edition</name>
  <description>
    Timefold solves planning problems.
    This lightweight, embeddable planning engine implements powerful and scalable algorithms
    to optimize business resource scheduling and planning.

    This module is just the multiproject parent for Timefold Solver Enterprise Edition.
    The planning engine itself is in timefold-solver-enterprise-core.
  </description>
  <url>https://solver.timefold.ai</url>
  <inceptionYear>2023</inceptionYear>

  <properties>
    <revision>2.2.0</revision>

    <enforcer.failOnDuplicatedClasses>true</enforcer.failOnDuplicatedClasses>
    <project.root.dir>${maven.multiModuleProjectDirectory}</project.root.dir>
    <!-- ************************************************************************ -->
    <!-- Plugins -->
    <!-- ************************************************************************ -->
    <version.antrun.plugin>3.2.0</version.antrun.plugin>
    <version.cyclonedx.plugin>2.9.1</version.cyclonedx.plugin>
    <version.flatten.plugin>1.7.3</version.flatten.plugin>
    <version.javadoc.plugin>3.12.0</version.javadoc.plugin>
    <version.source.plugin>3.4.0</version.source.plugin>
    <version.jar.plugin>3.5.0</version.jar.plugin>
  </properties>

  <licenses>
    <license>
      <name>Timefold License</name>
      <comments>
         Timefold Solver Enterprise Edition is proprietary software.
         It is not open-source and its use requires an explicit license,
         which can be obtained at https://licenses.timefold.ai
         or by contacting Timefold.
         For more information, see https://timefold.ai/terms.
      </comments>
      <url>https://timefold.ai/terms</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <scm>
    <connection>scm:git:https://github.com/TimefoldAI/timefold-solver-enterprise.git</connection>
    <developerConnection>scm:git:ssh://git@github.com/TimefoldAI/timefold-solver-enterprise.git</developerConnection>
    <url>https://github.com/TimefoldAI/timefold-solver-enterprise</url>
  </scm>

  <developers>
    <developer>
      <name>Timefold Engineering</name>
      <organization>Timefold</organization>
      <organizationUrl>https://timefold.ai</organizationUrl>
    </developer>
  </developers>

  <repositories>
    <repository>
      <id>artifactory-releases</id>
      <name>Timefold JFrog Artifactory Releases</name>
      <url>https://timefold.jfrog.io/artifactory/releases-all</url>
      <releases>
        <enabled>true</enabled>
      </releases>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <modules>
    <module>build/bom</module>
    <module>build/build-parent</module>
    <module>core</module>
    <module>persistence</module>
    <module>quarkus-integration</module>
    <module>spring-boot</module>
    <module>service</module>
  </modules>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-source-plugin</artifactId>
          <version>${version.source.plugin}</version>
        </plugin>
        <plugin>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>${version.javadoc.plugin}</version>
          <configuration>
            <author>false</author>
            <failOnError>true</failOnError>
            <quiet>true</quiet>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.cyclonedx</groupId>
          <artifactId>cyclonedx-maven-plugin</artifactId>
          <version>${version.cyclonedx.plugin}</version>
        </plugin>
        <!-- Together with the revision property enables overriding the project version in the CI -->
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>flatten-maven-plugin</artifactId>
          <version>${version.flatten.plugin}</version>
          <configuration>
            <updatePomFile>true</updatePomFile>
            <flattenMode>resolveCiFriendliesOnly</flattenMode>
            <keepCommentsInPom>true</keepCommentsInPom>
          </configuration>
          <executions>
            <execution>
              <id>flatten</id>
              <phase>process-resources</phase>
              <goals>
                <goal>flatten</goal>
              </goals>
            </execution>
            <execution>
              <id>flatten.clean</id>
              <phase>clean</phase>
              <goals>
                <goal>clean</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <!-- flatten maven plugin must be configured for all projects, even the top-level parent -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>flatten-maven-plugin</artifactId>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>fullProfile</id>
      <activation>
        <property>
          <name>full</name>
        </property>
      </activation>
      <build>
        <plugins>
          <!-- Create the empty-source-dir and README.txt used to generate empty sources JARs. -->
          <!-- The empty source JAR files are needed to prevent publishing the source code to Maven Central. -->
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>${version.antrun.plugin}</version>
            <inherited>false</inherited>
            <executions>
              <execution>
                <id>create-empty-source-dir</id>
                <phase>generate-resources</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <mkdir dir="${project.root.dir}/empty-source-dir"/>
                    <echo file="${project.root.dir}/empty-source-dir/README.txt" append="false">Omitted because Timefold Solver Enterprise Edition is not an open-source project.</echo>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- Skip source plugin -->
          <plugin>
            <artifactId>maven-source-plugin</artifactId>
            <configuration>
              <skipSource>true</skipSource>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-jar-plugin</artifactId>
            <version>${version.jar.plugin}</version>
            <executions>
              <!-- Generate empty sources -->
              <execution>
                <id>empty-sources-jar</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <classifier>sources</classifier>
                  <classesDirectory>${project.root.dir}/empty-source-dir</classesDirectory>
                  <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                  </archive>
                </configuration>
              </execution>
              <!-- Generate empty test sources -->
              <execution>
                <id>empty-test-sources-jar</id>
                <goals>
                  <goal>jar</goal>
                </goals>
                <configuration>
                  <classifier>test-sources</classifier>
                  <classesDirectory>${project.root.dir}/empty-source-dir</classesDirectory>
                  <archive>
                    <addMavenDescriptor>false</addMavenDescriptor>
                  </archive>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin> <!-- Make sure the build fails-fast on Javadoc issues. -->
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
              <execution>
                <id>build-javadoc-jar</id>
                <phase>package</phase>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.cyclonedx</groupId>
            <artifactId>cyclonedx-maven-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>makeAggregateBom</goal>
                </goals>
                <configuration>
                  <excludeTestProject>true</excludeTestProject>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
