Friday, March 1, 2024
HomeJavaTips on how to set up Maven on Home windows? Instance

Tips on how to set up Maven on Home windows? Instance


There is no such thing as a distinction in putting in Maven on Windows7, Home windows 8, Home windows 8.1, or Home windows 10, you may comply with the identical steps to put in Maven in any model of the Home windows working system. Putting in Maven may be very straightforward, simply obtain the Apache Maven ZIP file from the Apache Maven Venture web site (https://maven.apache.org/obtain.cgi). You’ll be able to obtain the apache-maven-3.3.9-bin.zip for utilizing Maven in your 64-bit Home windows machine. Keep in mind, Maven 3.3 requires JDK 1.7 or above to run, so be sure to already put in JDK 7 or JDK8. When you obtain the binary distribution of Maven, half of the job is down.

Now, you solely have to extract the binary distribution and add the bin folder in PATH or add a few setting variables like M2, M2_HOME into your Home windows machine.

What it’s essential to Set up Maven in Home windows

Listed here are issues you will have to put in Maven on Home windows:


1.JDK

Make sure that JDK is already put in. You want JDK 1.7 or above to run Maven 3.3. If you do not know how one can set up Java, see this information for step-by-step tutorial.


2. JAVA_HOME

 Guarantee that the JAVA_HOME setting variable is outlined and may level to the set up listing of Java. Maven makes use of this setting variable to search out the Java set up listing. See right here to be taught extra in regards to the JAVA_HOME setting variable.

As soon as you make sure that the above is in place, it’s essential to comply with the under steps to put in Maven in your Home windows machine.

1) Setup the next setting variables

export M2_HOME=/Customers/xxx/sdk/apache-maven-3.2.3
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xmx1048m -Xms256m -XX:MaxPermSize=312M"
export PATH=$M2:$PATH

I’m utilizing Cygwin that is why I’m utilizing the export command if you’re utilizing the DOS command immediate then it is best to use the “set” command model proven under.

set M2_HOME=C:software programapache-maven-3.2.3
set M2=%M2_HOME%bin
set MAVEN_OPTS="-Xmx1048m -Xms256m -XX:MaxPermSize=312M"
set PATH=%M2%;%PATH%

Although merely including the bin listing of the Maven set up folder to PATH is sufficient to run the “mvn” command, it is higher to outline well-known maven setting variables like M2_HOME and MAVEN_OPTS

How to install Maven on Windows? Example

The M2_HOME is equal to JAVA_HOME and may level to the set up listing of Maven. Alternatively, MAVEN_OPTS is utilized by the Maven script to fetch extra JVM arguments offered by the consumer. You should use this setting variable to improve the heap measurement of Maven by supplying JVM reminiscence arguments e.g. -Xms and -Xmx. 


As soon as it’s a must to add the bin listing of the Maven folder, both instantly or not directly through an M2 setting variable, it is best to have the ability to run the mvn command from Cygwin or DOS command immediate. 

If Maven is ready up appropriately you will note comparable output as proven under:

$ mvn -version
Apache Maven 3.2.3 
Maven house: C:apache-maven-3.2.3
Java model: 1.6.0_37, vendor: Solar Microsystems Inc.
Java house: C:Javajdk1.6.0_37jre
Default locale: en_US, platform encoding: Cp1252
OS identify: "home windows 7", model: "6.1", arch: "x86", household: "home windows"

You’ll be able to see that it prints the Apache Maven model, together with Maven house, Java model, Java house, and OS identify.

At this time limit set up of Apache Maven is accomplished efficiently and also you at the moment are able to create and construct a Maven-based Java challenge utilizing completely different arch sorts. You can too use this regionally put in Maven in eclipse as an alternative of the default one put in by the M2Eclipse plugin.

Different Maven articles you might like

  • What’s the distinction between Maven, ANT, and Jenkins? (reply)
  • Tips on how to improve the heap measurement of Maven? (steps)
  • High 5 Programs to Study Apache Maven in-depth (programs)
  • Tips on how to repair Maven Eclipse Dependency search not working challenge? (resolution)
  • Tips on how to set up Maven in Home windows 10? (steps)
  • Tips on how to construct a Java challenge utilizing ANT? (article)
  • Tips on how to create or modify construct.xm in ANT? (tutorial)
  • High 5 Apache Maven Books for Free (books)
  • 10 Factors about Maven Java Developer ought to know (maven)
  • 10 Maven Plugins Each Java Builders ought to know (plugins)
  • 6 Free Maven and Jenkins Books for Java builders (books)
  • Tips on how to repair invalid goal launch error in Maven (Resolution)
  • Tips on how to set a selected Java model for Maven (tutorial)



RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments