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

     <!--=================================== 
     The shared dependencies project is built separately
     from the framework because it leads to errors
     when imported in an IDE with the other projects.
     
     Also, it won't change frequently.
     ====================================-->
     
    <parent>
        <groupId>org.spincast</groupId>
        <artifactId>spincast-parent-pom</artifactId>
        <version>2.0.1</version>
    </parent>

	<artifactId>spincast-shaded-dependencies</artifactId>
	<version>2.0.1</version>
    
    <scm>
        <connection>scm:git:git@github.com:spincast/spincast-shaded-dependencies</connection>
        <developerConnection>scm:git:git@github.com:spincast/spincast-shaded-dependencies</developerConnection>
        <url>git@github.com:spincast/spincast-shaded-dependencies.git</url>
        <tag>2.0.1</tag>
    </scm>

	<dependencies>
    
        <dependency>
        	<groupId>org.apache.httpcomponents</groupId>
        	<artifactId>httpclient</artifactId>
        	<version>4.5.13</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.13</version>
        </dependency>
        
        <dependency>
        	<groupId>commons-io</groupId>
        	<artifactId>commons-io</artifactId>
        	<version>2.11.0</version>
        </dependency>
        
        <dependency>
        	<groupId>org.apache.commons</groupId>
        	<artifactId>commons-lang3</artifactId>
        	<version>3.12.0</version>
        </dependency>
        
        <dependency>
            <groupId>commons-validator</groupId>
            <artifactId>commons-validator</artifactId>
            <version>1.7</version>
        </dependency>
        
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>1.9</version>
        </dependency>
        
        <dependency>
            <groupId>org.jsoup</groupId>
            <artifactId>jsoup</artifactId>
            <version>1.14.3</version>
        </dependency>
 
	</dependencies>

	<build>
        
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.3.0</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            
                            <relocations>
                                <relocation>
                                    <pattern>org.apache</pattern>
                                    <shadedPattern>org.spincast.shaded.org.apache</shadedPattern>
                                </relocation>
                                <relocation>
                                    <pattern>org.jsoup</pattern>
                                    <shadedPattern>org.spincast.shaded.org.jsoup</shadedPattern>
                                </relocation>
                            </relocations>
                            
                            <shadeSourcesContent>true</shadeSourcesContent>
                            <createSourcesJar>true</createSourcesJar>
                            <generateUniqueDependencyReducedPom>false</generateUniqueDependencyReducedPom>
                            
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                    
                                        <!-- Spincast provides a version of Slf4j -->
                                        <exclude>
                                            org/slf4j/**
                                        </exclude>
                                        
                                        <!-- Guava already comes with Guice! -->
                                        <exclude>
                                            com/google/**
                                        </exclude>
                                        
                                    </excludes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <manifestEntries>
                                        <Automatic-Module-Name>org.spincast.shaded</Automatic-Module-Name>
                                    </manifestEntries>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            
            <!--===================================
            Delete the unecessary original-xxx 
            generated artifact
            ====================================-->
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <id>delete-unwanted-artifacts</id>
                        <phase>package</phase>
                        <goals>
                            <goal>clean</goal>
                        </goals>
                        <configuration>
                            <excludeDefaultDirectories>true</excludeDefaultDirectories>
                            <filesets>
                                <fileset>
                                    <directory>${project.build.directory} </directory>
                                    <includes>
                                        <include>original-${project.build.finalName}.jar</include>
                                    </includes>
                                </fileset>
                             </filesets>
                         </configuration>
                    </execution>
                </executions>
            </plugin>
 
        </plugins>
	</build>
</project>
