<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
         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>
    <parent>
        <groupId>com.jwebmp</groupId>
        <artifactId>jwebmp-parent</artifactId>
        <version>0.68.0.1</version>
    </parent>

    <artifactId>jwebmp-builder</artifactId>
    <packaging>pom</packaging>

    <name>JWebMP Builder</name>
    <description>The Builder POM for JWebMP</description>
    <url>https://jwebmp.com</url>

    <build>
        <resources>
            <resource>
                <directory>jar-resources</directory>
                <excludes>
                    <exclude>**/*.gzip</exclude>
                    <exclude>**/*.map</exclude>
                    <exclude>**/*.md</exclude>
                    <exclude>**/*.md</exclude>
                    <exclude>**/package.json</exclude>
                    <exclude>**/bower.json</exclude>
                    <exclude>**/.bower.json</exclude>
                    <exclude>**/.gitignore</exclude>
                    <exclude>**/.jshint</exclude>
                    <exclude>**/.jshint</exclude>
                    <exclude>**/Gruntfile.js</exclude>
                    <exclude>**/*.sh</exclude>
                </excludes>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.js</include>
                    <include>**/*.json</include>
                    <include>**/*.css</include>
                    <include>**/*.min</include>
                    <include>**/*.html</include>
                    <include>**/*.htm</include>
                    <include>**/*.txt</include>
                    <include>**/*.sql</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <excludes>
                    <exclude>**/*.gzip</exclude>
                    <exclude>**/*.map</exclude>
                    <exclude>**/*.md</exclude>
                    <exclude>**/*.md</exclude>
                    <exclude>**/package.json</exclude>
                    <exclude>**/bower.json</exclude>
                    <exclude>**/.bower.json</exclude>
                    <exclude>**/.gitignore</exclude>
                    <exclude>**/.jshint</exclude>
                    <exclude>**/.jshint</exclude>
                    <exclude>**/Gruntfile.js</exclude>
                    <exclude>**/*.sh</exclude>
                </excludes>
            </resource>
        </resources>
    </build>

    <profiles>
        <profile>
            <id>jdk8</id>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <jwebmp.runtime.classifier></jwebmp.runtime.classifier>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>testJar</id>
                                <goals>
                                    <goal>test-jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/java</source>
                                        <source>src/jre8/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

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

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <configuration>
                            <excludes>
                                <exclude>module-info.java</exclude>
                            </excludes>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <additionalOptions>
                                <additionalOption>-Xdoclint:none</additionalOption>
                            </additionalOptions>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.jacoco</groupId>
                        <artifactId>jacoco-maven-plugin</artifactId>
                    </plugin>
                </plugins>

                <resources>
                    <resource>
                        <directory>src/jre8/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                    <resource>
                        <directory>src/main/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                </resources>
            </build>
        </profile>

        <profile>
            <id>jdk11</id>
            <properties>
                <jdk.version>1.11</jdk.version>
                <maven.compiler.source>1.11</maven.compiler.source>
                <maven.compiler.target>1.11</maven.compiler.target>
                <maven.compiler.release>11</maven.compiler.release>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <offlineLinks>
                                <offlineLink>
                                    <url>https://docs.oracle.com/javase/${maven.compiler.release}/docs/api/</url>
                                    <location>${project.basedir}</location>
                                </offlineLink>
                            </offlineLinks>
                            <failOnError>false</failOnError>
                            <javadocExecutable>/opt/jdk11/jdk-11/bin/javadoc</javadocExecutable>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.ow2.asm</groupId>
                                <artifactId>asm</artifactId>
                                <version>${maven.asm.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/java</source>
                                        <!--<source>src/jre10/java</source>-->
                                        <source>src/jre11/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

                <resources>
                    <resource>
                        <directory>src/jre11/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                    <resource>
                        <directory>src/main/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                </resources>
            </build>
        </profile>

        <profile>
            <id>jdk12</id>
            <properties>
                <jdk.version>1.12</jdk.version>
                <maven.compiler.source>1.12</maven.compiler.source>
                <maven.compiler.target>1.12</maven.compiler.target>
                <maven.compiler.release>12</maven.compiler.release>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-jar-plugin</artifactId>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <configuration>
                            <detectJavaApiLink>false</detectJavaApiLink>
                            <offlineLinks>
                                <offlineLink>
                                    <url>https://docs.oracle.com/javase/${maven.compiler.release}/docs/api/</url>
                                    <location>${project.basedir}</location>
                                </offlineLink>
                            </offlineLinks>
                            <failOnError>false</failOnError>
                            <javadocExecutable>/opt/jdk12/bin/javadoc</javadocExecutable>
                        </configuration>
                        <executions>
                            <execution>
                                <id>attach-javadoc</id>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>org.ow2.asm</groupId>
                                <artifactId>asm</artifactId>
                                <version>${maven.asm.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>

                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>build-helper-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>add-source</id>
                                <phase>generate-sources</phase>
                                <goals>
                                    <goal>add-source</goal>
                                </goals>
                                <configuration>
                                    <sources>
                                        <source>src/main/java</source>
                                        <!--<source>src/jre10/java</source>-->
                                        <source>src/jre11/java</source>
                                    </sources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>

                <resources>
                    <resource>
                        <directory>src/jre11/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                    <resource>
                        <directory>src/main/resources</directory>
                        <excludes>
                            <exclude>.gitignore</exclude>
                        </excludes>
                    </resource>
                </resources>
            </build>
        </profile>


        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <!--suppress MavenModelInspection -->
                        <groupId>org.eclipse.m2e</groupId>
                        <!--suppress MavenModelInspection -->
                        <artifactId>lifecycle-mapping</artifactId>
                        <!--suppress MavenModelInspection -->
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.codehaus.mojo</groupId>
                                            <artifactId>build-helper-maven-plugin</artifactId>
                                            <versionRange>[1.0,)</versionRange>
                                            <goals>
                                                <goal>test-compile</goal>
                                                <goal>compile</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <execute/>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>devkit</id>
            <modules>
                <module>GuicedEE</module>
                <module>JWebMPCore</module>
                <module>ThirdParty</module>
                <module>JPMSPending</module>
            </modules>
        </profile>
        <profile>
            <id>enable-plugins</id>
            <modules>
                <module>JWebMPPlugins</module>
            </modules>
        </profile>
        <profile>
            <id>enable-apps</id>
            <modules>
                <module>JWebMPApps</module>
            </modules>
        </profile>
        <profile>
            <id>enable-examples</id>
            <modules>
                <module>JWebMPExamples</module>
            </modules>
        </profile>
    </profiles>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>report</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
</project>
