How to install Maven automatically in Linux continuous integration

How to install Maven automatically in Linux continuous integration

Unzip the Maven package

tar xf apache-maven-3.5.4-bin.tar.gz 

Move the unzipped Maven files to /usr/local/

mv apache-maven-3.5.4 /usr/local 

#!/bin/bash
#Maven installation directory mkdir /usr/maven
#Installation package placement directory cd /usr/src
http://mirrors.hust.edu.cn/apache/maven/maven-3/3.5.4/source/apache-maven-3.5.4-src.tar.gz
tar -xzvf apache-maven-3.5.4-bin.tar.gz
rm -f apache-maven-3.5.4-bin.tar.gz
mv apache-maven-3.5.4/* /usr/maven
#Configure environment variable PROFILE=$(cat /etc/profile)
PATH='export PATH=$PATH'
REPLACE='export PATH=$PATH:$MAVEN_HOME/bin'
#Is there already a configuration path for other environment variables if [[ $PROFILE == *$PATH* ]]
#Add variable path then echo "${PROFILE/$PATH/$REPLACE}" > /etc/profile
#Append the path to the end of the text else echo "$REPLACE" >> /etc/profile
fi
echo "export MAVEN_HOME=/usr/maven" >> /etc/profile
#Update the configuration file source /etc/profile
# View the mvn version mvn -version

Update Files

source /etc/profile

verify

mvn -v 

At this point, the Maven installation is complete.

Summarize

The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links

You may also be interested in:
  • How to modify the default Python version when installing Python on Linux
  • Summary of methods to check whether the port is open in Linux
  • MySQL 8.0.15 installation and configuration graphic tutorial and password change under Linux
  • Linux CentOS6.9 installation graphic tutorial under VMware
  • Solution to MySQL garbled code problem under Linux
  • Summary of methods for creating, listing, and deleting Docker containers on Linux
  • Solution to the problem that Linux cannot connect to the Internet in VMware after the computer shuts down unexpectedly
  • How to view available network interfaces in Linux
  • Linux system to view CPU, machine model, memory and other information
  • Solution to the failure of loading dynamic library when Linux program is running

<<:  Introduction to fuzzy query method using instr in mysql

>>:  WeChat applet implements video player sending bullet screen

Recommend

How to use Docker-compose to build an ELK cluster

All the orchestration files and configuration fil...

Zabbix3.4 method to monitor mongodb database status

Mongodb has a db.serverStatus() command, which ca...

Is the tag li a block-level element?

Why can it set the height, but unlike elements lik...

Sliding menu implemented with CSS3

Result:Implementation code: <!DOCTYPE html>...

How to use the realip module in Nginx basic learning

Preface There are two types of nginx modules, off...

CSS style reset and clear (to make different browsers display the same effect)

In order to make the page display consistent betwe...

Vue implements a shopping cart that can change the shopping quantity

This article shares with you how to use Vue to ch...

JavaScript to implement checkbox selection or cancellation

This article shares the specific code of JavaScri...

Full analysis of MySQL INT type

Preface: Integer is one of the most commonly used...

How to use sed command to efficiently delete specific lines of a file

Preface Normally, if we want to delete certain li...

React implements import and export of Excel files

Table of contents Presentation Layer Business Lay...

HTML table markup tutorial (4): border color attribute BORDERCOLOR

To beautify the table, you can set different bord...