<?xml version="1.0" encoding="UTF-8"?>
<!--suppress MavenModelInspection -->
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>com.jwebmp.inject</groupId>
        <artifactId>guice-parent</artifactId>
        <version>0.68.0.1</version>
    </parent>

    <artifactId>guice</artifactId>
    <name>Google Guice - Core Library</name>

    <dependencies>
        <dependency>
            <groupId>com.jwebmp.thirdparty</groupId>
            <artifactId>javax.inject</artifactId>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.jwebmp.thirdparty</groupId>
            <artifactId>aopalliance-core</artifactId>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <type>jar</type>
        </dependency>
        <!--
         | CGLIB is embedded by default by the JarJar build profile
        -->
        <!--<dependency>
           <groupId>org.ow2.asm</groupId>
           <artifactId>asm</artifactId>
           <optional>true</optional>
         </dependency>
           -->
        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.ow2.asm</groupId>
            <artifactId>asm</artifactId>
            <optional>true</optional>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.jwebmp.jpms.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <type>jar</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!--
             | Add standard LICENSE and NOTICE files
            -->
            <plugin>
                <artifactId>maven-remote-resources-plugin</artifactId>
            </plugin>

            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!--
                     | Temporarily excluded tests
                    -->
                    <excludes>
                        <exclude>**/*$*</exclude>
                        <exclude>**/ErrorHandlingTest*</exclude>
                        <exclude>**/OSGiContainerTest*</exclude>
                        <exclude>**/ScopesTest*</exclude>
                        <exclude>**/TypeConversionTest*</exclude>
                    </excludes>
                </configuration>
            </plugin>

            <!--
             | Remove duplicate jarjar'd LICENSE and NOTICE
            -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>LICENSE</exclude>
                        <exclude>NOTICE</exclude>
                    </excludes>
                    <archive>
                        <manifestEntries>
                            <Automatic-Module-Name>com.google.guice</Automatic-Module-Name>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>


            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                            <module>
                                <moduleInfoFile>
                                    jre11/module-info.java
                                </moduleInfoFile>
                            </module>
                        </configuration>
                    </execution>
                </executions>
            </plugin>



            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>jarjar-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>jarjar</goal>
                        </goals>
                        <phase>package</phase>
                    </execution>
                </executions>
                <configuration>
                    <overwrite>true</overwrite>
                    <includes>
                        <include>*:asm*</include>
                        <include>*:cglib</include>
                    </includes>
                    <excludes>
                        <exclude>module-info.java</exclude>
                    </excludes>
                    <rules>
                        <rule>
                            <pattern>net.sf.cglib.*</pattern>
                            <result>com.google.inject.internal.cglib.$@1</result>
                        </rule>
                        <rule>
                            <pattern>net.sf.cglib.**.*</pattern>
                            <result>com.google.inject.internal.cglib.@1.$@2</result>
                        </rule>
                        <rule>
                            <pattern>org.objectweb.asm.*</pattern>
                            <result>com.google.inject.internal.asm.$@1</result>
                        </rule>
                        <rule>
                            <pattern>org.objectweb.asm.**.*</pattern>
                            <result>com.google.inject.internal.asm.@1.$@2</result>
                        </rule>
                        <keep>
                            <pattern>com.google.inject.**</pattern>
                        </keep>
                        <keep>
                            <pattern>com.googlecode.**</pattern>
                        </keep>
                    </rules>
                </configuration>
            </plugin>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <copy file="target/guice-${project.version}.jar" tofile="target/guice_11-${project.version}.jar"/>

                                <echo message="Extracting module-info class file after jarjar"/>
                                <unzip src="target/original-guice-${project.version}.jar"
                                       dest="target/classes" overwrite="true">
                                    <patternset>
                                        <include name="module-info.class"/>
                                    </patternset>
                                </unzip>
                                <echo message="Repacking module-info class file after jarjar"/>
                                <zip destfile="target/guice_11-${project.version}.jar"
                                     basedir="target/classes"
                                     includes="module-info.class"
                                     update="true"/>
                                <echo message="Done Repacking with module-info"/>
                                <copy file="target/guice_11-${project.version}.jar" tofile="target/guice-${project.version}.jar" overwrite="true"/>
                                <echo message="Cleaning dormant jar files"/>
                                <delete file="target/guice_11-${project.version}.jar"/>
                                <!--<delete file="target/original-guice-${project.version}.jar"/>-->
                                 <delete file="target/jarjar/hull-guice-${project.version}.jar"/>
                                 <delete file="target/jarjar/uber-guice-${project.version}.jar"/>
                                <echo message="Finished with JAR"/>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>attach-artifact</goal>
                        </goals>
                        <configuration>
                            <artifacts>
                                <artifact>
                                    <file>${project.build.directory}/original-${project.build.finalName}.jar</file>
                                    <classifier>classes</classifier>
                                </artifact>
                            </artifacts>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <!--
             | m2e profile - enable use of JarJar inside Eclipse
            -->
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.eclipse.m2e</groupId>
                            <artifactId>lifecycle-mapping</artifactId>
                            <version>1.0.0</version>
                            <configuration>
                                <lifecycleMappingMetadata>
                                    <pluginExecutions>
                                        <pluginExecution>
                                            <pluginExecutionFilter>
                                                <groupId>org.sonatype.plugins</groupId>
                                                <artifactId>jarjar-maven-plugin</artifactId>
                                                <versionRange>[1.4,)</versionRange>
                                                <goals>
                                                    <goal>jarjar</goal>
                                                </goals>
                                            </pluginExecutionFilter>
                                            <action>
                                                <execute/>
                                            </action>
                                        </pluginExecution>
                                    </pluginExecutions>
                                </lifecycleMappingMetadata>
                            </configuration>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>

        <profile>
            <id>jdk11</id>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.release>1.8</maven.compiler.release>
                <jwebmp.runtime.classifier></jwebmp.runtime.classifier>
            </properties>
            <build>
                <plugins>

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

                    <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.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</source>
                                        <!--<source>src/jre10/java</source>-->
                                        <!--<source>jre11</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>jdk12</id>
            <properties>
                <maven.compiler.source>1.8</maven.compiler.source>
                <maven.compiler.target>1.8</maven.compiler.target>
                <maven.compiler.release>1.8</maven.compiler.release>
                <jwebmp.runtime.classifier></jwebmp.runtime.classifier>
            </properties>
            <build>
                <plugins>

                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.6.1</version>
                        <configuration>
                            <source>1.8</source>
                            <target>1.8</target>
                            <release>8</release>
                        </configuration>
                    </plugin>

                    <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.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</source>
                                        <!--<source>src/jre10/java</source>-->
                                        <!--<source>jre11</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>

    </profiles>
</project>
