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

  <!-- The Basics -->
  <groupId>dev.aulait.cl</groupId>
  <artifactId>csv-loader</artifactId>
  <version>0.8</version>
  <packaging>pom</packaging>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.junit</groupId>
        <artifactId>junit-bom</artifactId>
        <version>5.10.2</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <modules>
    <module>csv-loader-db</module>
    <module>csv-loader-core</module>
    <module>csv-loader-flyway</module>
  </modules>

  <properties>
    <db.jdbc.groupId>org.postgresql</db.jdbc.groupId>
    <db.jdbc.artifactId>postgresql</db.jdbc.artifactId>
    <db.jdbc.version>42.7.2</db.jdbc.version>
    <db.jdbc.driver>org.postgresql.Driver</db.jdbc.driver>
    <db.jdbc.url>jdbc:postgresql://${db.host}:${db.port}/${db.name}</db.jdbc.url>
    <db.password>postgres</db.password>
    <db.host>localhost</db.host>
    <db.name>postgres</db.name>
    <db.port>5439</db.port>
    <db.schema>public</db.schema>
    <db.username>postgres</db.username>

    <flyway.version>10.14.0</flyway.version>

    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <maven.compiler.release>21</maven.compiler.release>
  </properties>

  <!-- Build Settings -->
  <build>
    <defaultGoal>antrun:run</defaultGoal>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>3.0.0</version>
        <dependencies>
          <dependency>
            <groupId>ant-contrib</groupId>
            <artifactId>ant-contrib</artifactId>
            <version>1.0b3</version>
            <exclusions>
              <exclusion>
                <groupId>ant</groupId>
                <artifactId>ant</artifactId>
              </exclusion>
            </exclusions>
          </dependency>
        </dependencies>
        <configuration>
          <target>
            <ant antfile="build.xml" target="${ant.target}" />
          </target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.0.0-M5</version>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.13.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>3.0.0-M5</version>
        </plugin>

        <plugin>
          <groupId>dev.aulait.bt</groupId>
          <artifactId>batch-translator-maven-plugin</artifactId>
          <version>1.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <!-- More Project Information -->
  <name>csv-loader</name>
  <description>A application used to load CSV files to DB with JDBC connection.</description>
  <url>https://aulait.dev</url>
  <licenses>
    <license>
      <name>The Apache License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
  </licenses>
  <developers>
    <developer>
      <name>Yuichi Kuwahara</name>
      <email>yuichi.kuwahara.0@gmail.com</email>
    </developer>
  </developers>

  <!-- Environment Settings -->
  <scm>
    <connection>scm:git:git://github.com/project-au-lait/csv-loader.git</connection>
    <developerConnection>scm:git:git://github.com/project-au-lait/csv-loader.git</developerConnection>
    <url>https://github.com/project-au-lait/csv-loader.git</url>
  </scm>

  <distributionManagement>
    <snapshotRepository>
      <id>github</id>
      <name>GitHub Project Au Lait Apache Maven Packages</name>
      <url>https://maven.pkg.github.com/project-au-lait/csv-loader</url>
    </snapshotRepository>
  </distributionManagement>

  <profiles>
    <profile>
      <id>release</id>

      <properties>
        <maven.test.skip>true</maven.test.skip>
      </properties>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <version>3.3.1</version>
            <executions>
              <execution>
                <id>attach-sources</id>
                <goals>
                  <goal>jar-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>3.8.0</version>
            <executions>
              <execution>
                <id>attach-javadocs</id>
                <goals>
                  <goal>jar</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-gpg-plugin</artifactId>
            <version>3.2.4</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>maven-central</id>

      <build>
        <plugins>
          <plugin>
            <groupId>org.sonatype.central</groupId>
            <artifactId>central-publishing-maven-plugin</artifactId>
            <version>0.5.0</version>
            <extensions>true</extensions>
            <configuration>
              <publishingServerId>central</publishingServerId>
              <autoPublish>true</autoPublish>
              <excludeArtifacts>csv-loader-db</excludeArtifacts>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>