<?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>
  <parent>
    <groupId>org.neo4j</groupId>
    <artifactId>neo4j-front-end-parent</artifactId>
    <version>2026.06.0</version>
    <relativePath>../pom.xml</relativePath>
  </parent>
  <artifactId>neo4j-util</artifactId>
  <packaging>jar</packaging>
  <name>openCypher Utils</name>

  <description>Cypher utilities</description>
  <url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>

  <scm>
    <connection>scm:git:git://github.com/openCypher/front-end.git</connection>
    <developerConnection>scm:git:git://github.com/openCypher/front-end.git</developerConnection>
    <url>https://github.com/openCypher/front-end</url>
  </scm>

  <properties>
    <moduleName>org.neo4j.cypher.internal.util</moduleName>
    <scala.binary.version>3</scala.binary.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>co.helmethair</groupId>
      <artifactId>scalatest-junit-runner</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-common</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-exceptions</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-gql-status</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <version>${asm.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala3-library_3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.scalacheck</groupId>
      <artifactId>scalacheck_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest-funsuite_${scala.binary.version}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.teavm</groupId>
      <artifactId>teavm-interop</artifactId>
      <version>${teavm.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.teavm</groupId>
      <artifactId>teavm-metaprogramming-api</artifactId>
      <version>${teavm.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Tests: neo4j-test-util supplies CypherFunSuite etc.; neo4j-test-util-scala3 supplies Scala 3 ScalaTest stack. -->
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-test-util</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.scalatest</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.scalatestplus</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.scalacheck</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.scalactic</groupId>
          <artifactId>*</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.lihaoyi</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-test-util-scala3</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalactic</groupId>
      <artifactId>scalactic_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest-compatible</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest-core_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest-matchers-core_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest-shouldmatchers_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.scalatest</groupId>
      <artifactId>scalatest_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.scalatestplus</groupId>
      <artifactId>scalacheck-1-16_${scala.binary.version}</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>org/neo4j/cypher/internal/util/buildtools/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>net.alchim31.maven</groupId>
        <artifactId>scala-maven-plugin</artifactId>
        <configuration>
          <scalaVersion>${scala3.version}</scalaVersion>
          <scalaCompatVersion>3</scalaCompatVersion>
          <args combine.self="override">
            <!-- TODO(Scala 3): drop -nowarn and fix warnings (infix, unchecked patmat, etc.). Needed so -DscalaFatalWarnings does not fail the build while util is on Scala 3. -->
            <arg>-nowarn</arg>
          </args>
          <analysisCacheFile>${project.build.directory}/scala-maven-analysis/compile</analysisCacheFile>
          <testAnalysisCacheFile>${project.build.directory}/scala-maven-analysis/test-compile</testAnalysisCacheFile>
        </configuration>
        <executions>
          <!-- Re-run scala:compile after javac; mixed Java/Scala modules can lose Scala .class files under target/classes before test-compile. -->
          <execution>
            <id>scala-compile-after-java</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <phase>process-classes</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <!-- After scala + javac in compile; also after scala:compile re-run on process-classes. -->
          <execution>
            <id>rewriter-lift-jvm-bridge-compile</id>
            <goals>
              <goal>java</goal>
            </goals>
            <phase>compile</phase>
            <configuration>
              <mainClass>org.neo4j.cypher.internal.util.buildtools.RewriterLiftJvmBridgeInstaller</mainClass>
              <arguments>
                <argument>${project.build.outputDirectory}</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>rewriter-lift-jvm-bridge-process-classes</id>
            <goals>
              <goal>java</goal>
            </goals>
            <phase>process-classes</phase>
            <configuration>
              <mainClass>org.neo4j.cypher.internal.util.buildtools.RewriterLiftJvmBridgeInstaller</mainClass>
              <arguments>
                <argument>${project.build.outputDirectory}</argument>
              </arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <failOnWarning>true</failOnWarning>
          <!-- dependency:analyze-only can mark Scala/TeaVM (and related) deps as unused; list them here as groupId:artifactId instead of removing. -->
          <ignoredUnusedDeclaredDependencies>
            <dependency>org.apache.commons:commons-lang3</dependency>
            <dependency>org.eclipse.collections:eclipse-collections</dependency>
            <dependency>org.eclipse.collections:eclipse-collections-api</dependency>
            <dependency>org.neo4j:neo4j-common</dependency>
            <dependency>org.neo4j:neo4j-exceptions</dependency>
            <dependency>org.neo4j:neo4j-gql-status</dependency>
            <dependency>org.ow2.asm:asm</dependency>
            <dependency>org.scala-lang:scala-library</dependency>
            <dependency>org.scala-lang:scala3-library_3</dependency>
            <dependency>org.neo4j:neo4j-test-util-scala3</dependency>
            <dependency>co.helmethair:scalatest-junit-runner</dependency>
            <dependency>org.scalatest:scalatest_3</dependency>
            <dependency>org.teavm:teavm-interop</dependency>
            <dependency>org.teavm:teavm-metaprogramming-api</dependency>
          </ignoredUnusedDeclaredDependencies>
          <ignoredNonTestScopedDependencies>
            <ignoredNonTestScopedDependency>org.scala-lang:scala-library</ignoredNonTestScopedDependency>
            <ignoredNonTestScopedDependency>org.scala-lang:scala3-library_3</ignoredNonTestScopedDependency>
          </ignoredNonTestScopedDependencies>
        </configuration>
      </plugin>
      <!-- JUnit Jupiter must not discover ScalaTest *Test classes (reflection can fail before ScalaTest engine runs). -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludeJUnit5Engines>
            <engine>junit-jupiter</engine>
          </excludeJUnit5Engines>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>
