<?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>mytechia-commons-library</artifactId>
    <groupId>com.mytechia</groupId>
    <version>1.2.0</version>
    <packaging>jar</packaging>
    <url>https://github.com/mytechia/mytechia_commons</url>
    
    <name>${project.groupId}:${project.artifactId}</name>
    <description>A collection of general utilities for programming in JAVA.</description>
    
    <developers>
        <developer>
            <name>Gervasio Varela</name>
            <url>https://github.com/gervarela</url>
        </developer>
        <developer>
            <name>Alma Mallo</name>
            <url>https://github.com/almamallo</url>
        </developer>
        <developer>
            <name>Alejandro Paz</name>
            <url>https://github.com/alejandropl</url>
        </developer>
        <developer>
            <name>Julio Gomez</name>
            <url>https://github.com/atsuqui</url>
        </developer>
        <developer>
            <name>Victor Sonora Pombo</name>
            <url>https://github.com/VictorP</url>
        </developer>
    </developers>
    
    <organization>
        <name>Mytech Ingenieria Aplicada</name>
    </organization>
  
    <licenses>
        <license>
            <name>GNU Lesser General Public License Version 3</name>
            <url>https://www.gnu.org/licenses/lgpl.html</url>
        </license>
    </licenses>
               
    <scm>
        <connection>scm:git:https://github.com/mytechia/mytechia_commons.git</connection>
        <developerConnection>scm:git:https://github.com/mytechia/mytechia_commons.git</developerConnection>
        <url>https://github.com/mytechia/mytechia_commons.git</url>
        <tag>HEAD</tag>
    </scm>
    
    <properties>
        <maven.compiler.source>1.5</maven.compiler.source>
        <maven.compiler.target>1.5</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.build.timestamp.format>yyyy_MM_dd</maven.build.timestamp.format>
        <release.basedir>release</release.basedir>
        <release.dir>${maven.build.timestamp}_${project.version}</release.dir>
    </properties>

    <profiles>
        
        <profile>
            <id>publicRelease</id>
            
            <distributionManagement>
                <snapshotRepository>
                    <id>ossrh</id>
                    <url>https://oss.sonatype.org/content/repositories/snapshots</url>
                </snapshotRepository>
            </distributionManagement>
            
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>1.5</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
            
            
                    <plugin>
                        <groupId>org.sonatype.plugins</groupId>
                        <artifactId>nexus-staging-maven-plugin</artifactId>
                        <version>1.6.3</version>
                        <extensions>true</extensions>
                        <configuration>
                            <serverId>ossrh</serverId>
                            <nexusUrl>https://oss.sonatype.org/</nexusUrl>
                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
                        </configuration>
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>2.2.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.9.1</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    
                </plugins>
            </build>
            
        </profile>
        
        <profile>
            <id>release</id>
            
            <build>
            
                <plugins>        
                
                    <!-- el plugin release actualiza el numero de version de todos los proyectos 
                    (modulo padre y submodulos), genera un tag-->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-release-plugin</artifactId>
                        <version>2.5.1</version>

                        <configuration>
                            <tagNameFormat>v@{project.version}</tagNameFormat>
                            <preparationGoals>install</preparationGoals>         
                            <pushChanges>false</pushChanges>
                        </configuration>
        
                    </plugin>
                    
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <version>1.7</version>
                        <executions>
                            <execution>
                                <id>generate-changelog</id>
                                <phase>install</phase>
                                <configuration>
                            
                                    <tasks>
                                        <ant target="update-changelog-file" inheritRefs="true">
                                            <property name="release.dir" value="${release.basedir}" />
                                            <property name="project.version" value="${project.version}" />
                                            <property name="release.version" value="${maven.build.timestamp}_${project.version}" />
                                            <property name="release" value="${release.basedir}/${release.dir}" />
                                        </ant>
                                    </tasks>
 
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>ant-contrib</groupId>
                                <artifactId>ant-contrib</artifactId>
                                <version>1.0b3</version>
                                <exclusions>
                                    <exclusion>
                                        <groupId>ant</groupId>
                                        <artifactId>ant</artifactId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.ant</groupId>
                                <artifactId>ant-nodeps</artifactId>
                                <version>1.8.1</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    
                
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.1</version>
                        <executions>
                            <execution>
                                <id>zip-javadoc</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>javadoc</goal>
                                </goals>
                            </execution>                       
                        </executions>
                    </plugin>
                
           
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.5.1</version>
                        <executions>
                            <execution>
                                <id>copy-dependencies</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
           
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>2.4</version>
                
                        <executions>
                            <execution>
                                <id>generate_source_zip</id>
                                <phase>install</phase>
                            
                                <configuration>
                                    <descriptor>${basedir}/src/assembly/src_assembly.xml</descriptor>
                                    <finalName>${project.artifactId}-${project.version}</finalName>
                                </configuration>
                            
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            
                            </execution>
                        
                            <execution>
                                <id>generate_javadoc_zip</id>
                                <phase>install</phase>
                            
                                <configuration>
                                    <descriptor>${basedir}/src/assembly/javadoc_assembly.xml</descriptor>
                                    <finalName>${project.artifactId}-${project.version}</finalName>
                                </configuration>
                            
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            
                            </execution>
                        
                        </executions>
                    </plugin>
                    
                
                    <!-- Copia todos los recursos al directorio release -->        
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <version>2.7</version>
                        <executions>
                            <execution>
                                <id>copy-resources</id>
                                <!-- here the phase you need -->
                                <phase>install</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.basedir}/${release.basedir}/${release.dir}/${project.build.finalName}</outputDirectory>
                                    <resources>          
                                        <resource>
                                            <includes>
                                                <include>${project.artifactId}-${project.version}.jar</include>
                                                <include>${project.artifactId}-${project.version}.jar.asc</include>
                                                <include>${project.artifactId}-${project.version}.pom</include>
                                                <include>${project.artifactId}-${project.version}.pom.asc</include>
                                                <include>${project.artifactId}-${project.version}-sources.jar</include>
                                                <include>${project.artifactId}-${project.version}-sources.jar.asc</include>
                                                <include>${project.artifactId}-${project.version}-javadoc.jar</include>
                                                <include>${project.artifactId}-${project.version}-javadoc.jar.asc</include>
                                                <include>dependency-jars/**</include>
                                            </includes>
                                            <directory>target</directory>
                                        </resource>
                                    </resources>              
                                </configuration>            
                            </execution>
                        </executions>
                    </plugin>
                    
                    
                </plugins>
       
            </build>
            
        </profile>
        
    </profiles>

    
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>  
            <groupId>org.picocontainer</groupId>  
            <artifactId>picocontainer</artifactId>
            <version>2.8</version>
        </dependency>
    </dependencies>

    <distributionManagement>

        <repository>
            <id>nexus-snapshots</id>
            <name>Snapshots en el repositorio de por aquí</name>
            <url>http://bizancio:7080/nexus/content/repositories/snapshots/</url>
        </repository>

    </distributionManagement>

    
</project>
