<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <artifactId>xml</artifactId>
    <version>0.1-SNAPSHOT</version>
    <name>xml</name>

    <parent>
        <groupId>com.baeldung</groupId>
        <artifactId>parent-modules</artifactId>
        <version>1.0.0-SNAPSHOT</version>
    </parent>

    <dependencies>
        <!-- xml libraries -->
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>${dom4j.version}</version>
        </dependency>
        <dependency>
            <groupId>jaxen</groupId>
            <artifactId>jaxen</artifactId>
            <version>${jaxen.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>joox-java-6</artifactId>
            <version>${joox.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jdom</groupId>
            <artifactId>jdom2</artifactId>
            <version>${jdom2.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>${jaxb-api.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>${jaxb-impl.version}</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>${jaxb-core.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml</groupId>
            <artifactId>jaxp-api</artifactId>
            <version>${jaxp-api.version}</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.stream</groupId>
            <artifactId>stax-api</artifactId>
            <version>${stax-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>${freemarker.version}</version>
        </dependency>
        <dependency>
            <groupId>com.github.spullara.mustache.java</groupId>
            <artifactId>compiler</artifactId>
            <version>${mustache.version}</version>
        </dependency>
        <!-- JMH Libraries -->
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-core</artifactId>
            <version>${jmh.version}</version>
        </dependency>
        <dependency>
            <groupId>org.openjdk.jmh</groupId>
            <artifactId>jmh-generator-annprocess</artifactId>
            <version>${jmh.version}</version>
        </dependency>
        <!-- utils -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>${commons-io.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>${commons-collections4.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>${commons-lang3.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jibx</groupId>
            <artifactId>jibx-run</artifactId>
            <version>${jibx-version}</version>
        </dependency>

        <dependency>
            <groupId>commons-lang</groupId>
            <artifactId>commons-lang</artifactId>
            <version>${commons-lang.version}</version>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.vintage</groupId>
            <artifactId>junit-vintage-engine</artifactId>
            <version>${junit-jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>${assertj-core.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.xmlunit</groupId>
            <artifactId>xmlunit-assertj</artifactId>
            <version>${xmlunit-assertj.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>xml</finalName>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jibx</groupId>
                    <artifactId>maven-jibx-plugin</artifactId>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jibx</groupId>
                <artifactId>maven-jibx-plugin</artifactId>
                <version>${maven-jibx-plugin.version}</version>
                <configuration>
                    <directory>src/main/resources</directory>
                    <includes>
                        <includes>*-binding.xml</includes>
                    </includes>
                    <excludes>
                        <exclude>template-binding.xml</exclude>
                    </excludes>
                    <schemaBindingDirectory>src/main/resources</schemaBindingDirectory>
                    <includeSchemaBindings>
                        <includeSchemaBindings>*-binding.xml</includeSchemaBindings>
                    </includeSchemaBindings>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <id>process-classes</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>bind</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>process-test-classes</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>test-bind</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven-compiler-plugin.version}</version>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>${maven-surefire-plugin.version}</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>schemaGen</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.jibx</groupId>
                        <artifactId>maven-jibx-plugin</artifactId>
                        <version>${maven-jibx-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>generate-java-code-from-schema</id>
                                <goals>
                                    <goal>schema-codegen</goal>
                                </goals>
                                <configuration>
                                    <directory>src/main/resources</directory>
                                    <includes>
                                        <include>Order.xsd</include>
                                    </includes>
                                    <verbose>true</verbose>
                                </configuration>
                            </execution>
                            <execution>
                                <id>compile-binding</id>
                                <goals>
                                    <goal>bind</goal>
                                </goals>
                                <configuration>
                                    <directory>target/generated-sources</directory>
                                    <load>true</load>
                                    <validate>true</validate>
                                    <!--<verbose>true</verbose> -->
                                    <verify>true</verify>
                                </configuration>
                            </execution>
                            <execution>
                                <id>generate-test-code-from-schema</id>
                                <phase>generate-test-sources</phase>
                                <goals>
                                    <goal>test-schema-codegen</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>compile-test-binding</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>test-bind</goal>
                                </goals>
                                <configuration>
                                    <directory>target/generated-test-sources</directory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>${maven-surefire-plugin.version}</version>
                        <configuration>
                            <excludes>
                                <exclude>CustomerTest.java</exclude>
                            </excludes>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>bindGen</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.jibx</groupId>
                            <artifactId>maven-jibx-plugin</artifactId>
                        </plugin>
                    </plugins>
                </pluginManagement>
                <plugins>
                    <plugin>
                        <groupId>org.jibx</groupId>
                        <artifactId>maven-jibx-plugin</artifactId>
                        <version>${maven-jibx-plugin.version}</version>
                        <configuration>
                            <directory>src/main/resources</directory>
                            <includes>
                                <includes>*-binding.xml</includes>
                            </includes>
                            <excludes>
                                <exclude>template-binding.xml</exclude>
                            </excludes>
                            <schemaBindingDirectory>src/main/resources</schemaBindingDirectory>
                            <includeSchemaBindings>
                                <includeSchemaBindings>*-binding.xml</includeSchemaBindings>
                            </includeSchemaBindings>
                            <verbose>true</verbose>
                        </configuration>
                        <executions>
                            <execution>
                                <id>process-classes</id>
                                <phase>process-classes</phase>
                                <goals>
                                    <goal>bind</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>process-test-classes</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>test-bind</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <configuration>
                            <source>${java-version}</source>
                            <target>${java-version}</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <!-- NOTE: We don't need a groupId specification 
                            because the group is org.apache.maven.plugins ...which is assumed by default. -->
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <archiveBaseDirectory>${project.basedir}</archiveBaseDirectory>
                            <descriptorRefs>
                                <descriptorRef>
                                    jar-with-dependencies
                                </descriptorRef>
                            </descriptorRefs>
                            <archive>
                                <manifest>
                                    <mainClass>
                                        com.baeldung.xml.jibx.JiBXDemoApplication
                                    </mainClass>
                                </manifest>
                            </archive>
                        </configuration>
                        <executions>
                            <execution>
                                <id>make-assembly</id><!-- this is used for 
                                    inheritance merges -->
                                <phase>package</phase><!-- append to the 
                                    packaging phase. -->
                                <goals>
                                    <goal>attached</goal><!-- goals == mojos -->
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

    <properties>
        <dom4j.version>2.1.1</dom4j.version>
        <jaxen.version>1.2.0</jaxen.version>
        <jdom2.version>2.0.6</jdom2.version>
        <joox.version>1.6.2</joox.version>
        <commons-io.version>2.5</commons-io.version>
        <commons-collections4.version>4.1</commons-collections4.version>
        <jibx-version>1.2.4.5</jibx-version>
        <jaxb-api.version>2.3.1</jaxb-api.version>
        <jaxp-api.version>1.4.2</jaxp-api.version>
        <jaxb-core.version>2.3.0.1</jaxb-core.version>
        <jaxb-impl.version>2.3.2</jaxb-impl.version>
        <stax-api.version>1.0-2</stax-api.version>
        <assertj-core.version>3.12.2</assertj-core.version>
        <xmlunit-assertj.version>2.6.3</xmlunit-assertj.version>
        <junit-jupiter.version>5.5.0</junit-jupiter.version>
        <jmh.version>1.21</jmh.version>
        <freemarker.version>2.3.29</freemarker.version>
        <mustache.version>0.9.6</mustache.version>
        <!-- util -->
        <commons-lang3.version>3.5</commons-lang3.version>
        <commons-lang.version>2.4</commons-lang.version>
        <java-version>1.8</java-version>

        <!-- maven plugins -->
        <maven-jibx-plugin.version>1.3.1</maven-jibx-plugin.version>
        <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version>
        <maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
    </properties>

</project>