Maven

References

Maven Releases History

https://maven.apache.org/docs/history.html


Install

sudo apt install maven

FILE settings.xml

The default location for the settings file is ~/.m2/settings.xml

Sample with proxy and server configuration

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

    <pluginGroups/>

    <proxies>

        <!-- Proxy for HTTP -->

        <proxy>

            <id>proxyidhttp</id>

            <active>true</active>

            <protocol>http</protocol>

            <!-- <username>proxyuser</username> -->

            <!-- <password>proxypass</password> -->

            <host>127.0.0.1</host>

            <port>3128</port>

            <nonProxyHosts>localhost|127.0.0.1|artifactory|artifactory.uco.es</nonProxyHosts>

        </proxy>

        <!-- Proxy for HTTPS -->

        <proxy>

            <id>proxyidhttps</id>

            <active>true</active>

            <protocol>https</protocol>

            <!-- <username>proxyuser</username> -->

            <!-- <password>proxypass</password> -->

            <host>127.0.0.1</host>

            <port>3128</port>

            <nonProxyHosts>localhost|127.0.0.1|artifactory|artifactory.uco.es</nonProxyHosts>

        </proxy>

    </proxies>

    <servers>

        <server>

            <id>EsUcoArtifactory</id>

            <username>myUsername</username>

            <password>myPassword</password>

        </server>

    </servers>

    <mirrors/>

    <profiles/>

</settings>

Sample w/ configuration for Canigó

<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <profiles>

    <profile>

      <id>defaultProfile</id>

      <activation>

        <activeByDefault>true</activeByDefault>

      </activation>

      <repositories>

        <repository>

          <id>canigo</id>

          <url>https://sic.ctti.extranet.gencat.cat/nexus/content/groups/canigo-group-maven2/</url>

          <snapshots>

            <enabled>true</enabled>

            <updatePolicy>always</updatePolicy>

          </snapshots>

          <releases>

            <enabled>true</enabled>

          </releases>

        </repository>

      </repositories>

      <properties>

        <downloadSources>true</downloadSources>

        <downloadJavadocs>false</downloadJavadocs>

      </properties>

    </profile>

  </profiles>

</settings>


FILE toolchains.xml

The default location for the toolchains file is ~/.m2/toolchains.xml

Sample w/ JDK 1.5 & JDK 8

<?xml version="1.0" encoding="UTF8"?>

<toolchains>

    <!-- JDK 8 toolchain -->   

    <toolchain>

        <type>jdk</type>

        <provides>

            <version>1.8</version>

            <vendor>Oracle Corporation</vendor>

        </provides>

        <configuration>

            <jdkHome>J:\COMPANY\UCO\bins\jdk1.8.0_144</jdkHome>

        </configuration>

    </toolchain>


    <!-- JDK 1.5 toolchain -->   

    <toolchain>

<type>jdk</type>

<provides>

<version>1.5</version>

<vendor>Sun Microsystems Inc.</vendor>

</provides>

<configuration>

<jdkHome>/usr/lib/jvm/java-5-sun</jdkHome>

</configuration>

    </toolchain>

</toolchains>

HOW-TO Purge the local repo

Remark: This command line order deletes the local maven repository, eg: ~/.m2/repository/

              A pom.xml has to exist in the directory from where it is executed.

mvn dependency:purge-local-repository -DmanualInclude=.

HOW-TO check all the plugins and reports used in your project and display a list of those plugins with newer versions available

mvn versions:display-plugin-updates

HOW-TO Command line download of a remote repository dependency, placing it into the local repository

mvn dependency:get -Dartifact=org.springframework:spring-instrument:3.2.3.RELEASE


mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://artifactory.cou.es/artifactory/repo-gestio  -Dartifact=edu.cou:default-maven-project:1.0.2:pom


mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=http://artifactory.cou.es/artifactory/repo-gestio  -Dartifact=com.oracle:ojdbc14:10.2.0.4:jar