<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.eximeebpms</groupId>
    <artifactId>eximeebpms-release-parent</artifactId>
    <version>1.2.0</version>
  </parent>

  <groupId>org.eximeebpms.bpm</groupId>
  <artifactId>eximeebpms-root</artifactId>
  <version>1.3.0</version>
  <packaging>pom</packaging>
  <name>EximeeBPMS - Root Pom</name>
  <inceptionYear>2025</inceptionYear>

  <description>
    This pom defines the modules that make up the build.
    The parent pom for all EximeeBPMS projects can be found in the parent directory relative to this file.
  </description>

  <properties>
    <license.includeTransitiveDependencies>false</license.includeTransitiveDependencies>

    <!-- These properties are used in both the BOM as well as eximeebpms-parent and subprojects -->
    <version.mybatis>3.5.19</version.mybatis>
    <version.joda-time>2.14.0</version.joda-time>
    <version.uuid-generator>5.2.0</version.uuid-generator>
    <version.feel-scala>1.19.3</version.feel-scala>
    <sonar.organization>eximeebpms</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>1.14</version>
        <configuration>
          <acceptPomPackaging>true</acceptPomPackaging>
          <excludedScopes>test</excludedScopes>
        </configuration>
      </plugin>
      <plugin>
        <!--
          Produces a single, whole-project coverage report aggregated from every module
          listed (transitively) under this POM's <modules>. This execution intentionally
          does not inherit to child POMs (see <inherited>false</inherited> below): the
          jacoco-maven-plugin report-aggregate goal collects data via
          MavenProject#getCollectedProjects(), i.e. the <modules> reachable from the
          POM that runs it. If this execution were inherited, every descendant module in
          the reactor - including leaf modules with no <modules> of their own, such as
          the qa/** integration-test harness - would redundantly re-run report-aggregate
          on every partial build (e.g. `mvn -f qa verify`), producing no useful output
          while still writing a full report site to disk. That inflates CI's already
          disk-pressured runs (WildFly, browser binaries, per-database Docker containers)
          and previously caused intermittent
          "Can't create directory .../jacoco-aggregate/jacoco-resources" build failures.
        -->
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>0.8.13</version>
        <inherited>false</inherited>
        <executions>
          <execution>
            <id>report-aggregate</id>
            <goals>
              <goal>report-aggregate</goal>
            </goals>
            <phase>verify</phase>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>distro</id>
      <modules>
        <!-- This profile is run in the CI as the first step (platform-ASSEMBLY); It must not activate
          any modules that have a dependency to the webapps. See also the referenced POMs,
          they usually define which modules are covered by the distro profile -->
        <module>spring-boot-starter</module>

        <module>quarkus-extension</module>

        <module>qa</module>

        <module>javaee/ejb-service</module>
        <module>javaee/ejb-client</module>
        <module>javaee/ejb-client-jakarta</module>
        <module>javaee/jobexecutor-ra</module>
        <module>javaee/jobexecutor-rar</module>

        <module>model-api</module>
        <module>engine-dmn</module>
        <module>connect</module>
        <module>juel</module>
        <module>spin</module>
        <module>commons</module>
        <module>freemarker-template-engine</module>

        <module>test-utils/testcontainers</module>
        <module>test-utils/junit5-extension</module>
        <module>test-utils/junit5-extension-dmn</module>
        <module>test-utils/assert</module>
        <module>test-utils/archunit</module>

        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>webapps</module>

        <module>examples</module>

        <module>engine-plugins</module>

        <module>distro/license-book</module>
        <module>distro/jboss</module>
        <module>distro/tomcat</module>
        <module>distro/sql-script</module>
        <module>distro/run</module>

        <module>clients/java</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <id>distro-ce</id>
      <modules>
        <!-- This profile is run in the CI after the webapps were built (platform-ASSEMBLY);
          It should activate any module that has a dependency to the webapps -->
        <module>spring-boot-starter</module>

        <module>distro/license-book</module>
        <module>distro/jboss</module>
        <module>distro/tomcat</module>
        <module>distro/run</module>
      </modules>
    </profile>

    <profile>
      <id>javadocs</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <configuration>
              <top><![CDATA[
                <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
                new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
                j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
                'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
                })(window,document,'script','dataLayer','GTM-N39WSFRC');</script>
              ]]></top>
              <failOnError>false</failOnError>
              <additionalJOptions>
                <additionalJOption>-Xdoclint:none</additionalJOption>
                <additionalJOption>--ignore-source-errors</additionalJOption>
                <additionalJOption>--allow-script-in-comments</additionalJOption>
              </additionalJOptions>
              <doctitle>EximeeBPMS Javadocs ${project.version}</doctitle>
              <windowtitle>EximeeBPMS Javadocs ${project.version}</windowtitle>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>sbom</id>
      <!--
        Generates an aggregate CycloneDX SBOM for all production modules.
        Run standalone: ./mvnw package -Psbom -DskipTests

        qa, test-utils and examples aren't shipped artifacts, but several kept modules have
        real (compile/test-scope) dependencies reaching into them regardless - this used to
        be satisfied for free because sbom always ran combined with a larger profile set
        that happened to include them. Now that it runs standalone, they're listed here
        explicitly:
          - qa: distro/wildfly/distro has a scope=provided, type=pom dependency on
            eximeebpms-qa purely to force build order (see that module's own comment).
            qa/pom.xml's own "distro" profile is activeByDefault, so listing `qa` here
            also pulls in its full integration-test tree (wildfly/tomcat runtimes,
            selenium-based webapp ITs, DB migration fixtures, ...), which in turn needs
            javaee/ejb-client and test-utils/junit5-extension - this doesn't affect what's
            published anywhere (this step only packages, never deploys), so it's just
            extra build time, not a correctness concern.
          - javaee/ejb-client: needed by qa/integration-tests-engine (see above).
          - test-utils/archunit, test-utils/testcontainers: real test-scope dependencies of
            engine and several model-api/engine-* modules (ArchUnit architecture tests).
          - test-utils/assert: a scope=compile dependency of spring-boot-starter/starter-test;
            its own qa submodule needs test-utils/junit5-extension, which in turn needs
            test-utils/junit5-extension-dmn.
          - examples: distro/tomcat/distro, distro/wildfly/distro and distro/run/modules/example
            all depend on eximeebpms-example-invoice-jakarta.
      -->
      <modules>
        <module>spring-boot-starter</module>
        <module>quarkus-extension</module>

        <module>javaee/ejb-service</module>
        <module>javaee/ejb-client</module>
        <module>javaee/ejb-client-jakarta</module>
        <module>javaee/jobexecutor-ra</module>
        <module>javaee/jobexecutor-rar</module>

        <module>model-api</module>
        <module>engine-dmn</module>
        <module>connect</module>
        <module>juel</module>
        <module>spin</module>
        <module>commons</module>
        <module>freemarker-template-engine</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>

        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>webapps</module>

        <module>engine-plugins</module>

        <module>distro/license-book</module>
        <module>distro/jboss</module>
        <module>distro/tomcat</module>
        <module>distro/wildfly</module>
        <module>distro/sql-script</module>
        <module>distro/run</module>
        <module>distro/webjar</module>

        <module>clients/java</module>

        <!-- built only, to satisfy the dependencies explained above -->
        <module>qa</module>
        <module>test-utils/archunit</module>
        <module>test-utils/testcontainers</module>
        <module>test-utils/assert</module>
        <module>test-utils/junit5-extension</module>
        <module>test-utils/junit5-extension-dmn</module>
        <module>examples</module>
      </modules>
      <build>
        <plugins>
          <plugin>
            <groupId>org.cyclonedx</groupId>
            <artifactId>cyclonedx-maven-plugin</artifactId>
            <version>2.9.2</version>
            <executions>
              <execution>
                <id>generate-sbom</id>
                <phase>package</phase>
                <goals>
                  <goal>makeAggregateBom</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <projectType>library</projectType>
              <schemaVersion>1.6</schemaVersion>
              <includeBomSerialNumber>true</includeBomSerialNumber>
              <includeCompileScope>true</includeCompileScope>
              <includeProvidedScope>true</includeProvidedScope>
              <includeRuntimeScope>true</includeRuntimeScope>
              <includeSystemScope>false</includeSystemScope>
              <includeTestScope>false</includeTestScope>
              <includeLicenseText>false</includeLicenseText>
              <outputFormat>all</outputFormat>
              <outputName>bom</outputName>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>distro-serverless</id>
      <modules>
        <module>qa</module>
        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>webapps</module>

        <module>examples</module>

        <module>engine-plugins</module>

        <module>distro/sql-script</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <id>distro-tomcat</id>
      <modules>
        <module>distro/license-book</module>
        <module>distro/tomcat</module>
      </modules>
    </profile>

    <profile>
      <id>distro-wildfly</id>
      <modules>
        <module>javaee/ejb-client</module>
        <module>javaee/ejb-client-jakarta</module>
        <module>distro/license-book</module>
        <module>distro/wildfly</module>
        <!-- DEPRECATED since 1.3.0, will be removed in 1.4.0 - see distro/wildfly26/pom.xml -->
        <module>distro/wildfly26</module>
      </modules>
    </profile>

    <profile>
      <id>distro-webjar</id>
      <modules>
        <module>distro/webjar</module>
      </modules>
    </profile>

    <profile>
      <id>distro-run</id>
      <modules>
        <module>distro/run</module>
      </modules>
    </profile>

    <profile>
      <id>distro-starter</id>
      <!-- This profile is run in the release CI for building the enterprise artifacts
          It can be removed if the distro job is merged with the assembly job and
          distro-ce is not used for building the spring boot starter -->
      <modules>
        <module>spring-boot-starter</module>
      </modules>
    </profile>

    <profile>
      <!-- profile for running process-engine unit tests in QA -->
      <id>check-engine</id>
      <modules>
        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <!-- profile for running webapp unit tests in QA -->
      <id>check-webapps</id>
      <modules>
        <module>internal-dependencies</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <!-- Scope of what gets published to Maven Central: consumable libraries only. Excludes
        qa, examples, distro/license-book, distro/jboss, distro/tomcat and distro/run - none of
        those are libraries meant for public consumption, and staging them (plus javadoc/sources)
        pushed the JReleaser upload bundle past the ~2GB JVM array-size ceiling in
        Files.readAllBytes, which reliably OOM'd (see BPMS-385). Verified locally: this trimmed
        scope stages ~183MB across 2048 files, vs. multiple GB before.

        Three module trees from that excluded set are still reachable below - distro/license-book,
        distro/tomcat and examples - because kept modules have a real build-time dependency on
        one of their children (clients/java/client on eximeebpms-tomcat-assembly, itself needing
        distro/license-book; spring-boot-starter's own qa submodule on
        eximeebpms-example-invoice-jakarta). They still need to be built so those dependencies
        resolve, but each carries its own sonatype-oss-release-scoped profile (or, for
        distro/tomcat, a same-named profile mirroring its existing "distro" one) setting
        maven.deploy.skip=true, so none of them is actually staged for Central.

        distro/tomcat and examples are listed by their aggregator path, not their specific child,
        because other profiles active alongside this one during "Release prepare"/"Release
        perform" (distro-tomcat, distro-serverless, check-webapps, ...) already reach the same
        child module via a different module path; listing that same aggregator path here instead
        of a second, different path to the same child avoids Maven's reactor rejecting it as a
        duplicate project. -->
      <id>sonatype-oss-release</id>
      <modules>
        <module>spring-boot-starter</module>
        <module>quarkus-extension</module>
        <module>model-api</module>

        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>engine-dmn</module>
        <module>connect</module>
        <module>juel</module>
        <module>spin</module>
        <module>commons</module>
        <module>freemarker-template-engine</module>

        <module>javaee/ejb-client</module>
        <module>javaee/ejb-client-jakarta</module>

        <module>webapps</module>

        <module>engine-plugins</module>

        <module>distro/sql-script</module>
        <module>distro/webjar</module>
        <!-- built only, not deployed - see comment above -->
        <module>distro/license-book</module>
        <module>distro/tomcat</module>
        <module>examples</module>

        <module>clients/java</module>

        <module>test-utils/junit5-extension</module>
        <module>test-utils/junit5-extension-dmn</module>
        <module>test-utils/assert</module>
        <module>test-utils/testcontainers</module>
        <module>test-utils/archunit</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <!-- full profile is default and builds the complete distribution. Does not run integration tests. -->
      <id>full</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <modules>
        <module>spring-boot-starter</module>

        <module>quarkus-extension</module>

        <module>qa</module>

        <module>javaee/jobexecutor-ra</module>
        <module>javaee/jobexecutor-rar</module>

        <module>model-api</module>
        <module>engine-dmn</module>
        <module>connect</module>
        <module>juel</module>
        <module>spin</module>
        <module>commons</module>
        <module>freemarker-template-engine</module>

        <module>test-utils/testcontainers</module>
        <module>test-utils/junit5-extension</module>
        <module>test-utils/junit5-extension-dmn</module>
        <module>test-utils/assert</module>
        <module>test-utils/archunit</module>

        <module>engine</module>
        <module>engine-cdi</module>
        <module>engine-spring</module>
        <module>engine-rest</module>

        <module>webapps</module>

        <module>examples</module>

        <module>engine-plugins</module>

        <module>distro/license-book</module>
        <module>distro/jboss</module>
        <module>distro/tomcat</module>
        <module>distro/sql-script</module>
        <module>distro/run</module>
        <module>distro/webjar</module>

        <module>clients/java</module>

        <module>internal-dependencies</module>
        <module>database</module>
        <module>parent</module>
        <module>bom</module>
      </modules>
    </profile>

    <profile>
      <id>license-header-check</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <distributionManagement>
    <snapshotRepository>
      <id>central</id>
      <url>https://central.sonatype.com/repository/maven-snapshots/</url>
    </snapshotRepository>
  </distributionManagement>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>

  <organization>
    <name>EximeeBPMS services GmbH</name>
    <url>http://eximeebpms.org</url>
  </organization>

  <url>http://eximeebpms.org</url>

  <developers>
    <developer>
      <id>eximeebpms.org</id>
      <name>EximeeBPMS Community</name>
      <organization>eximeebpms.org</organization>
      <organizationUrl>http://eximeebpms.org</organizationUrl>
    </developer>
  </developers>

  <scm>
    <url>https://github.com/EximeeBPMS/eximeebpms</url>
    <developerConnection>scm:git:https://github.com/EximeeBPMS/eximeebpms.git</developerConnection>
    <tag>v1.3.0</tag>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/eximeebpms/eximeebpms/issues</url>
  </issueManagement>
</project>
