<?xml version="1.0"?>
<!--

    Copyright 2022-2026 benelog GmbH & Co. KG

        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.

-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
         xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>io.openepcis</groupId>
        <artifactId>openepcis-document-converter-parent</artifactId>
        <version>0.9.3</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>openepcis-document-converter</artifactId>
    <name>openepcis-document-converter</name>
    <description>Project to convert EPCIS events in XML format to JSON/JSON-LD and vice-versa. Also, supports the
        conversion of EPCIS 1.2 XML document to 2.0 XML document and vice
        versa.
    </description>
    <url>https://github.com/openepcis/openepcis-document-converter</url>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Aravinda Baliga B</name>
            <email>aravinda.baliga@benelog.com</email>
            <organization>benelog GmbH &amp; Co. KG</organization>
            <organizationUrl>https://www.benelog.com</organizationUrl>
        </developer>
        <developer>
            <name>Sven Boeckelmann</name>
            <email>sven.boeckelmann@benelog.com</email>
            <organization>benelog GmbH &amp; Co. KG</organization>
            <organizationUrl>https://www.benelog.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/openepcis/openepcis-document-converter.git</connection>
        <developerConnection>scm:git:ssh://github.com:openepcis/openepcis-document-converter.git</developerConnection>
        <url>https://github.com/openepcis/openepcis-document-converter/tree/main</url>
    </scm>

    <dependencies>
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-model-rest</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-model-epcis</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-document-validation-service</artifactId>
            <version>${project.parent.version}</version>
        </dependency>
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-model-format</artifactId>
        </dependency>
        <dependency>
            <groupId>io.smallrye.reactive</groupId>
            <artifactId>mutiny</artifactId>
        </dependency>

        <!-- Reactive event publisher for non-blocking JSON parsing with backpressure -->
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-reactive-event-publisher</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <dependency>
            <groupId>jakarta.enterprise</groupId>
            <artifactId>jakarta.enterprise.cdi-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- JAXB Annotations Dependencies START -->
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.moxy</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>org.eclipse.persistence.asm</artifactId>
        </dependency>
        <!-- JAXB Annotations Dependencies END -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.datatype</groupId>
            <artifactId>jackson-datatype-jsr310</artifactId>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
        </dependency>

        <!-- Add constants as dependencies -->
        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-epcis-constants</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <!-- external xalan is required to support class generation from xsl in native builds -->
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>serializer</artifactId>
        </dependency>

        <!-- Optional Netty dependency for zero-copy buffer operations -->
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-buffer</artifactId>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>io.openepcis</groupId>
            <artifactId>openepcis-test-resources</artifactId>
            <version>${project.parent.version}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>


    <build>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>

            <!--
              PRE-COMPILE XSL Translets
            -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <id>convert-2.0-to-1.2</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.apache.xalan.xsltc.cmdline.Compile</mainClass>
                            <arguments>
                                <argument>-o</argument>
                                <argument>From20To12</argument>
                                <argument>-d</argument>
                                <argument>${build.directory}/classes</argument>
                                <argument>-p</argument>
                                <argument>io.openepcis.converter.translet</argument>
                                <argument>-n</argument>
                                <argument>-x</argument>
                                <argument>-u</argument>
                                <argument>
                                    file:${project.basedir}/src/main/resources/xalan-conversion/convert-2.0-to-1.2.xsl
                                </argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>convert-1.2-to-2.0</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>org.apache.xalan.xsltc.cmdline.Compile</mainClass>
                            <arguments>
                                <argument>-o</argument>
                                <argument>From12To20</argument>
                                <argument>-d</argument>
                                <argument>${build.directory}/classes</argument>
                                <argument>-p</argument>
                                <argument>io.openepcis.converter.translet</argument>
                                <argument>-n</argument>
                                <argument>-x</argument>
                                <argument>-u</argument>
                                <argument>
                                    file:${project.basedir}/src/main/resources/xalan-conversion/convert-1.2-to-2.0.xsl
                                </argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <configuration>
                    <attach>true</attach>
                    <defaultManifestFile/>
                </configuration>
            </plugin>
        </plugins>
    </build>


    <profiles>
        <profile>
            <id>coverage</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>report</id>
                                <goals>
                                    <goal>report</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <repositories>
        <!-- Sonatype Central snapshots -->
        <repository>
            <id>central-snapshots</id>
            <url>https://central.sonatype.com/repository/maven-snapshots/</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>

</project>
