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

    <groupId>com.github.xmlet</groupId>
    <artifactId>xsd2poet-java</artifactId>
    <version>1.0.8</version>
    <modelVersion>4.0.0</modelVersion>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <mainClass>org.xmlet.Main</mainClass>
                    <includeProjectDependencies>true</includeProjectDependencies>
                    <classpathScope>compile</classpathScope>
                </configuration>
                <executions>
                    <execution>
                        <id>Generates htmlapifaster API</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>package</phase> <!-- Run after process-classes -->
                        <goals>
                            <goal>
                                jar-no-fork
                            </goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>org/xmlet/htmlapifaster/**/*.java</include>
                                <include>org/xmlet/xsdasmfaster/**/*.java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>add-generated-sources</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>target/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- Delete conflicting sources from src/main/java -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>clean-conflicting-sources</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <!-- Delete conflicting files from src/main/java -->
                                <delete file="${project.basedir}/src/main/java/org/xmlet/htmlapifaster/Element.java" />
                                <delete file="${project.basedir}/src/main/java/org/xmlet/htmlapifaster/ElementVisitor.java" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- If we clean the project and delete the generated-sources then we should restore the former deleted files-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>reset-specific-file</id>
                        <phase>clean</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <executable>git</executable>
                            <arguments>
                                <argument>restore</argument>
                                <argument>--</argument>
                                <argument>src/main/java/org/xmlet/htmlapifaster/Element.java</argument>
                                <argument>src/main/java/org/xmlet/htmlapifaster/ElementVisitor.java</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-gpg-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>
                                sign
                            </goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <goals>deploy</goals>
                    <pushChanges>false</pushChanges>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.6.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <executions>
                    <execution>
                        <id>compile</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <source>9</source>
                    <target>9</target>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>prepare-package</phase>
                    </execution>
                </executions>
                <configuration>
                    <includes>
                        <include>org/xmlet/htmlapifaster/**/*.class</include>
                        <include>org/xmlet/xsdasmfaster/**/*.class</include>
                    </includes>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.6.3</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <failOnError>false</failOnError>
                </configuration>
            </plugin>

        </plugins>
    </build>

    <!-- ***************************************************************** -->

    <packaging>jar</packaging>
    <name>${project.groupId}:${project.artifactId}</name>
    <description>
        Xsd2Poet is dedicated to generate a fluent java DSL based on a XSD file
    </description>
    <url>https://github.com/xmlet/xsd2poet</url>
    <licenses>
        <license>
            <name>MIT license</name>
            <url>https://opensource.org/licenses/MIT</url>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Luís Duarte</name>
            <email>39378@alunos.isel.ipl.pt</email>
        </developer>
        <developer>
            <name>André Vizinha</name>
            <email>A43567@alunos.isel.pt</email>
        </developer>
        <developer>
            <name>Miguel Gamboa</name>
            <email>miguel.gamboa@isel.pt</email>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:git@github.com:xmlet/xsd2poet.git</connection>
        <developerConnection>scm:git:git@github.com:xmlet/xsd2poet.git</developerConnection>
        <url>git@github.com:xmlet/xsd2poet.git</url>
        <tag>xsd2poet-java-1.0.8</tag>
    </scm>
    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <!-- ***************************************************************** -->

    <dependencies>
        <dependency>
            <groupId>com.github.xmlet</groupId>
            <artifactId>xsd2poet-core</artifactId>
            <version>1.0.8</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.squareup</groupId>
            <artifactId>javapoet</artifactId>
            <version>1.13.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

</project>
