Install Build Tools in a Windows Operating System (Gradle, Maven)

How to install Gradle and Maven, two powerful automatic build systems, on Windows 10. This comprehensive guide covers checking the Java version, downloading the binary distributions, and configuring environment variables. Follow the step-by-step instructions to set up these build tools and unleash their potential for your projects.

Used:

Windows 10 Gradle Maven

Pre-installed
Windows 10
Java JDK 8

To check the version of Java on a Windows system, type java -version at the command line

C:\Users\java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

Gradle Installation

Gradle is a powerful dependency management and build tool. Unlike Maven and Ant, which rely on an XML-based approach, Gradle utilizes the Groovy DSL (Domain-Specific Language). This makes Gradle flexible and intuitive, allowing developers to define and configure their build processes with ease.

1. Download Gradle from the official website of the site.
The Gradle binary distribution is conveniently packaged as a .zip archive, providing a comprehensive and self-contained package for installation and usage.

2. Once you’ve downloaded the Gradle binary distribution as a .zip archive, extract its contents to a designated working directory, such as ‘DevTools’.

3. After extracting the contents of the Gradle binary distribution to your designated working directory, you’ll need to add Gradle to the environment variables.

VARIABLE VALUE
GRADLE_HOME D:\SATAProgramFiles\DevTools\gradle-6.3
PATH %GRADLE_HOME%\bin
C:\Users\gradle -version
 
Welcome to Gradle 6.3!
 
Here are the highlights of this release:
 - Java 14 support
 - Improved error messages for unexpected failures
 
For more details see https://docs.gradle.org/6.3/release-notes.html
 
 
------------------------------------------------------------
Gradle 6.3
------------------------------------------------------------
 
Build time:   2020-03-24 19:52:07 UTC
Revision:     bacd40b727b0130eeac8855ae3f9fd9a0b207c60
 
Kotlin:       1.3.70
Groovy:       2.5.10
Ant:          Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM:          1.8.0_202 (Oracle Corporation 25.202-b08)
OS:           Windows 10 10.0 amd64

Maven Installation

Apache Maven is indeed an open-source build tool that is distributed under the Apache License. It is widely recognized as one of the most popular build tools available. With Maven, you can build not only Java projects but also projects written in JVM languages such as Kotlin or Scala, as well as other languages like C# and Ruby. Its versatility makes it a valuable tool for a wide range of software development projects.

1. To download Apache Maven, visit the official website and obtain the binary zip archive.

2. Extract its contents to a designated working directory, such as “DevTools”.

3. It is necessary to add Maven to the environment variables to ensure proper configuration. However, it’s important to note that there is a slight discrepancy depending on different versions. It is recommended to follow the official recommendations, particularly starting from version 3.5.0, which advise against using M2_HOME.

Instead, you should add a link to the Apache Maven directory in the PATH environment variable. Here’s how you can do it:

  1. Open the Start menu and search for “Environment Variables.”
  2. Click on “Edit the system environment variables.”
  3. In the System Properties window, click on the “Environment Variables” button.
  4. Under the “System variables” section, find the PATH variable and click on “Edit.”
  5. Add a new entry that includes the path to the Apache Maven directory, such as “C:\apache-maven\bin”.
  6. Click “OK” to save the changes.

By adding the Apache Maven directory to the PATH environment variable, you ensure that Maven can be accessed globally from the command line, following the official recommendations.

Check: mvn -version

C:\Users\mvn -version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: D:\SATAProgramFiles\DevTools\apache-maven-3.6.3\bin\..
Java version: 1.8.0_202, vendor: Oracle Corporation, runtime: D:\SATAProgramFiles\Java\jdk1.8.0_202\jre
Default locale: ru_RU, platform encoding: Cp1251
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

As an immediate benefit, we can now utilize the newly installed versions of build tools within our preferred development environment.

File | Settings | Build, Execution, Deployment

Congratulations! You’ve successfully installed Gradle and Maven on your Windows 10 system. With these popular build tools now at your disposal, you can develop Java projects or work with JVM languages like Kotlin or Scala, as well as other languages like C# and Ruby. Enjoy the flexibility, efficiency, and reliability these build systems bring to your development workflow. Start building amazing projects with confidence and efficiency!

Related Posts