<?xml version="1.0"?>
<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>cypher-shell-parent</artifactId>
    <version>2026.02.2</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>cypher-shell</artifactId>
  <version>2026.02.2</version>
  <packaging>jar</packaging>
  <name>Neo4j - Cypher Shell</name>
  <description>Cypher Shell</description>
  <url>http://components.neo4j.org/${project.artifactId}/${project.version}</url>

  <properties>
    <appassembler-maven-plugin.version>2.1.0</appassembler-maven-plugin.version>
    <assembly-suffix/>
    <executable-suffix/>
    <jline.version>3.21.0</jline.version>
    <moduleName>org.neo4j.shell</moduleName>
    <name-of-main-class>org.neo4j.shell.Main</name-of-main-class>
    <native-maven-plugin.version>0.9.9</native-maven-plugin.version>
    <os-maven-plugin.version>1.7.0</os-maven-plugin.version>
    <skipCompress>false</skipCompress>
    <svm.version>21.3.0</svm.version>
    <dependency.analyze.failOnWarning>true</dependency.analyze.failOnWarning>
  </properties>

  <scm>
    <connection>scm:git:git://github.com/neo4j/neo4j.git</connection>
    <developerConnection>scm:git:git@github.com:neo4j/neo4j.git</developerConnection>
    <url>https://github.com/neo4j/neo4j</url>
  </scm>

  <dependencies>

    <!-- Java 8 base classes for MRJAR - scope=provided ensures build order but excludes from runtime -->
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-shell-base</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
    </dependency>

    <!-- Neo4j dependencies -->
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-preparser</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j.driver</groupId>
      <artifactId>neo4j-java-driver</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-antlr-ast-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-v25-ast-factory</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-v5-literal-interpreter</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-exceptions</artifactId>
      <scope>compile</scope>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-cypher-dsl</artifactId>
      <version>${cypherdsl.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.apiguardian</groupId>
          <artifactId>apiguardian-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-antlr-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>cypher-v25-antlr-parser</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-common</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-graphdb-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.neo4j</groupId>
      <artifactId>neo4j-values</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Other dependencies -->

    <dependency>
      <groupId>net.sourceforge.argparse4j</groupId>
      <artifactId>argparse4j</artifactId>
      <version>0.9.0</version>
    </dependency>
    <dependency>
      <groupId>org.jline</groupId>
      <artifactId>jline-terminal</artifactId>
      <version>${jline.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jline</groupId>
      <artifactId>jline-reader</artifactId>
      <version>${jline.version}</version>
    </dependency>
    <dependency>
      <groupId>org.jline</groupId>
      <artifactId>jline-terminal-jansi</artifactId>
      <version>${jline.version}</version>
    </dependency>
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4-runtime</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse.collections</groupId>
      <artifactId>eclipse-collections-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.fusesource.jansi</groupId>
      <artifactId>jansi</artifactId>
      <version>2.4.0</version>
    </dependency>
    <dependency>
      <groupId>org.graalvm.nativeimage</groupId>
      <artifactId>svm</artifactId>
      <version>${svm.version}</version>
      <!-- Provided scope as it is only needed for compiling the SVM substitution classes -->
      <scope>provided</scope>
      <!-- We don't use those, they are not GPLv2 licensed. -->
      <exclusions>
        <exclusion>
          <groupId>org.graalvm.sdk</groupId>
          <artifactId>graal-sdk</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.graalvm.truffle</groupId>
          <artifactId>truffle-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest</artifactId>
      <scope>test</scope>
    </dependency>
      <dependency>
          <groupId>org.neo4j</groupId>
          <artifactId>neo4j-kernel</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
      </dependency>
  </dependencies>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>build.properties</include>
        </includes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <!-- Additional execution to output classes to META-INF/versions/{version}/ for MRJAR -->
          <execution>
            <id>compile-java${maven.compiler.release}-versioned</id>
            <phase>compile</phase>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <release>${maven.compiler.release}</release>
              <multiReleaseOutput>true</multiReleaseOutput>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <manifestEntries>
              <Multi-Release>true</Multi-Release>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>appassembler-maven-plugin</artifactId>
        <version>${appassembler-maven-plugin.version}</version>
        <configuration>
          <assembleDirectory>${project.build.directory}/assembly</assembleDirectory>
          <repositoryLayout>flat</repositoryLayout>
          <repositoryName>lib</repositoryName>
          <useWildcardClassPath>true</useWildcardClassPath>
          <programs>
            <program>
              <mainClass>org.neo4j.shell.startup.CypherShellBoot</mainClass>
              <id>cypher-shell</id>
            </program>
          </programs>
        </configuration>
        <executions>
          <execution>
            <id>make-distribution</id>
            <goals>
              <goal>assemble</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
          <appendAssemblyId>false</appendAssemblyId>
        </configuration>
        <executions>
          <execution>
            <phase>package</phase>
            <id>assembly-java</id>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/assembly/assembly-java.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>copy-java8-base-classes</id>
            <phase>process-classes</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <overwrite>true</overwrite>
              <resources>
                <resource>
                  <directory>${project.basedir}/../cypher-shell-base/target/classes</directory>
                  <excludes>
                    <exclude>META-INF/**</exclude>
                  </excludes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>analyze</id>
            <goals>
              <goal>analyze-only</goal>
            </goals>
            <configuration>
              <failOnWarning>true</failOnWarning>
              <ignoredDependencies>
                <ignoredDependency>org.neo4j.bolt:neo4j-bolt-connection</ignoredDependency>
              </ignoredDependencies>
              <ignoredUnusedDeclaredDependencies>
                <ignoredUnusedDeclaredDependency>co.helmethair:scalatest-junit-runner</ignoredUnusedDeclaredDependency>
                <ignoredUnusedDeclaredDependency>org.junit.jupiter:junit-jupiter</ignoredUnusedDeclaredDependency>
                <ignoredUnusedDeclaredDependency>org.neo4j:neo4j-codegen</ignoredUnusedDeclaredDependency>
                <ignoredUnusedDeclaredDependency>org.jline:jline-terminal-jansi</ignoredUnusedDeclaredDependency>
                <ignoredUnusedDeclaredDependency>org.hamcrest:hamcrest</ignoredUnusedDeclaredDependency>
                <ignoredUnusedDeclaredDependency>org.neo4j:cypher-shell-base</ignoredUnusedDeclaredDependency>
              </ignoredUnusedDeclaredDependencies>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>${os-maven-plugin.version}</version>
      </extension>
    </extensions>
  </build>

  <profiles>
    <profile>
      <id>windows</id>
      <activation>
        <os>
          <family>windows</family>
        </os>
      </activation>
      <properties>
        <executable-suffix>.exe</executable-suffix>
      </properties>
    </profile>
    <profile>
      <id>native</id>
      <activation>
        <property>
          <name>native</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.graalvm.buildtools</groupId>
            <artifactId>native-maven-plugin</artifactId>
            <version>${native-maven-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <mainClass>${name-of-main-class}</mainClass>
              <imageName>cypher-shell</imageName>
              <buildArgs>
                <buildArg>--no-fallback</buildArg>
                <!--
                 | Caused by
                 | org.neo4j.collection.trackable.HeapTrackingCollections and
                 | org.neo4j.cypher.internal.runtime.interpreted.commands.predicates.ConstantCachedIn
                 | need some investigation
                 -->
                <buildArg>--allow-incomplete-classpath</buildArg>
              </buildArgs>
            </configuration>
            <executions>
              <execution>
                <id>create-native-image</id>
                <goals>
                  <goal>build</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>compress-binary</id>
                <goals>
                  <goal>exec</goal>
                </goals>
                <phase>package</phase>
                <configuration combine.self="override">
                  <executable>upx</executable>
                  <skip>${skipCompress}</skip>
                  <arguments>
                    <argument>${project.build.directory}/cypher-shell${executable-suffix}</argument>
                  </arguments>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>assembly-native</id>
                <goals>
                  <goal>single</goal>
                </goals>
                <phase>package</phase>
                <configuration>
                  <finalName>cypher-shell-${project.version}-${os.detected.classifier}</finalName>
                  <attach>false</attach>
                  <descriptors>
                    <descriptor>src/main/assembly/assembly-native${assembly-suffix}.xml</descriptor>
                  </descriptors>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
