<?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>dev.ikm.build</groupId>
        <artifactId>java-parent</artifactId>
        <version>1.40.0</version>
        <relativePath></relativePath>
    </parent>

    <groupId>dev.ikm.jpms</groupId>
    <artifactId>mvstore</artifactId>
    <packaging>jar</packaging>
    <name>MVStore</name>
    <version>2.2.220-r1</version>
    <properties>
        <h2-mvstore.version>2.2.220</h2-mvstore.version>
        <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version>
        <maven.moditect.plugin>1.0.0.RC2</maven.moditect.plugin>
        <maven.antrun.plugin>3.1.0</maven.antrun.plugin>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>${basedir}/</directory>
                <includes>
                    <include>LICENSE.txt</include>
                </includes>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.moditect</groupId>
                    <artifactId>moditect-maven-plugin</artifactId>
                    <version>${maven.moditect.plugin}</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>${maven.antrun.plugin}</version>
                </plugin>

            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.jlgrock</groupId>
                <artifactId>pom-check-maven-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <classifier>sources</classifier>
                            <classesDirectory>${project.build.directory}/generated-sources/java/</classesDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.6.0</version>
                <executions>
                    <execution>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.h2database</groupId>
                                    <artifactId>h2-mvstore</artifactId>
                                    <version>${h2-mvstore.version}</version>
                                    <classifier>sources</classifier>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/generated-sources/java</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <skip>true</skip>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.4.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources/java/</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}/moditect</outputDirectory>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                            <modules>
                                <module>
                                    <artifact>
                                        <groupId>com.h2database</groupId>
                                        <artifactId>h2-mvstore</artifactId>
                                        <version>${h2-mvstore.version}</version>
                                    </artifact>
                                    <moduleInfoSource>
                                        open module org.h2.mvstore {
                                            exports org.h2.mvstore;
                                        }
                                    </moduleInfoSource>
                                </module>
                            </modules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                        <configuration>
                            <target>
                                <echo message="unzipping file" />
                                <unzip src="${project.build.directory}/moditect/h2-mvstore-${h2-mvstore.version}.jar"
                                       dest="${project.build.directory}/classes/" />
                                <move file="${project.build.directory}/classes/META-INF/versions/9/org/h2/util/Bits.class"
                                      tofile="${project.build.directory}/classes/org/h2/util/Bits.class"/>
                                <delete dir="${project.build.directory}/classes/META-INF/versions/"/>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
