<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>org.web3j</groupId>
    <artifactId>web3j-maven-plugin</artifactId>
    <version>5.0.2</version>
    <packaging>maven-plugin</packaging>

    <name>web3j Maven Mojo</name>
    <description>
        Mojo's web3j Maven plugin is used to create java classes based on the solidity contract files.
    </description>
    <url>https://web3j.io</url>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <maven.version>3.9.9</maven.version>
        <maven-plugin.version>3.13.0</maven-plugin.version>

        <web3j.version>5.0.2</web3j.version>

        <!-- Central Portal publishing plugin -->
        <central.publishing.plugin.version>0.10.0</central.publishing.plugin.version>
        <!-- Signing/source/javadoc plugins -->
        <maven.source.plugin.version>3.3.1</maven.source.plugin.version>
        <maven.javadoc.plugin.version>3.8.0</maven.javadoc.plugin.version>
        <maven.gpg.plugin.version>3.2.7</maven.gpg.plugin.version>

        <junit.version>5.11.4</junit.version>
        <surefire.version>3.5.2</surefire.version>
    </properties>

    <licenses>
        <license>
            <name>Apache 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Marti Heinz</name>
            <email>github@h2m.ch</email>
            <organization>Zuehlke Engineering</organization>
            <organizationUrl>http://www.zuehlke.com</organizationUrl>
            <timezone>Europe/Bern</timezone>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://ssh@github.com/LFDT-web3j/${project.artifactId}.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/LFDT-web3j/${project.artifactId}.git</developerConnection>
        <url>https://github.com/LFDT-web3j/${project.artifactId}.git</url>
        <tag>HEAD</tag>
    </scm>

    <!-- Repositories are not required for publishing to Central.
         Keep ONLY if you truly need them to resolve deps at build time. -->
    <repositories>
        <repository>
            <id>central</id>
            <url>https://repo1.maven.org/maven2/</url>
            <snapshots><enabled>false</enabled></snapshots>
            <releases><enabled>true</enabled></releases>
        </repository>
        <repository>
            <id>consensys</id>
            <url>https://artifacts.consensys.net/public/maven/maven</url>
            <snapshots><enabled>true</enabled></snapshots>
            <releases><enabled>true</enabled></releases>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>maven2</id>
            <url>https://repo.maven.apache.org/maven2/</url>
        </pluginRepository>
    </pluginRepositories>

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

    <dependencies>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven-plugin.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.shared</groupId>
            <artifactId>file-management</artifactId>
            <version>3.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.web3j</groupId>
            <artifactId>codegen</artifactId>
            <version>${web3j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.web3j</groupId>
            <artifactId>core</artifactId>
            <version>${web3j.version}</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.json-simple</groupId>
            <artifactId>json-simple</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.web3j</groupId>
            <artifactId>web3j-sokt</artifactId>
            <version>0.6.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.20.0</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.18.0</version>
        </dependency>

        <!-- tests -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.maven.plugin-testing</groupId>
            <artifactId>maven-plugin-testing-harness</artifactId>
            <version>3.3.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-compat</artifactId>
            <version>${maven.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Generates the plugin descriptor (META-INF/maven/plugin.xml) -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin.version}</version>
            </plugin>

            <!-- Central Publisher Portal (new Maven Central publishing) -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>${central.publishing.plugin.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <!-- Must match a <server><id> in ~/.m2/settings.xml -->
                    <publishingServerId>central</publishingServerId>

                    <!-- Publish automatically after validation -->
                    <autoPublish>true</autoPublish>

                    <!-- Optional: wait for a state (uploaded/validated/published) -->
                    <!-- <waitUntil>published</waitUntil> -->
                </configuration>
            </plugin>

            <!-- coverage (unchanged) -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.10</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Attach sources -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven.source.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Attach javadocs -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>${maven.javadoc.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Sign artifacts -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>${maven.gpg.plugin.version}</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <keyname>3C55BB78E011361C</keyname>
                            <gpgArguments>
                                <arg>--pinentry-mode</arg>
                                <arg>loopback</arg>
                            </gpgArguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${surefire.version}</version>
                        <configuration>
                            <useModulePath>false</useModulePath>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

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

</project>
