Maven – installation

How to install Maven on Windows 10

  1. Download Apache Maven ZIP file and unzip it to some folder (example: C:\Programs\apache-maven-3.3.9 ).
  2. Add maven folder to environment variables:
  • MAVEN_HOME = C:\Programs\apache-maven-3.3.9
  • M2_HOME = %MAVEN_HOME%
  • add to path = %MAVEN_HOME%\bin

Test:

$ mvn –version

$ mvn --version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Programs\apache-maven-3.3.9
Java version: 1.8.0_101, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_101\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "dos"

 

 

 

 

Define JRE version in maven project

Define JRE version in maven project definition

When you create new maven project in Eclipse, project is created with java JRE 1.5.  If you wish to change that to something else, you need to add compiler plugin with desired JRE source and target version.

In maven project configuration file (pom.xml) add this “maven-compiler-plugin” with setting for source and target version:

<build>
     <plugins>
        <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                   <source>1.8</source>
                   <target>1.8</target>
                </configuration>
        </plugin>
    </plugins>
</build>

More detailed informations

Refresh Eclipse project

After changing maven project configuration file (pom.xml) you need to refresh eclipse project.

At project level, with right click open Maven submenu and select Update project…

2016-08-25 21_14_37-Jump List for Mozilla Firefox

Other sources :

Maven for building Java applications – Tutorial