


In-depth explanation of Maven setup and installation to help you quickly start project construction
Maven is a Java project management tool that can help developers build, deploy and manage projects more easily. This article will explain the installation and configuration of Maven in detail to help readers quickly get started and use Maven to build projects.
1. Maven installation
- First of all, you need to ensure that the Java development environment (JDK) has been installed on your computer;
- Go to the Maven official website (https: //maven.apache.org/download.cgi) Download the latest version of the Maven compressed package;
- Extract the downloaded compressed package to the directory of your choice, for example
C: pache-maven-3.6 .3
; -
Configure system environment variables:
- Create a new system variable named
MAVEN_HOME
, the value is the Maven installation path (For exampleC: pache-maven-3.6.3
); - Edit the system’s
Path
variable and add%MAVEN_HOME% in# at the end ##;
To verify whether the Maven installation is successful, enter - mvn -version
in the command line. If the Maven version information is displayed, the installation is successful.
- Create a new system variable named
- Open the Maven configuration file
- settings.xml
, located in the Maven installation directory
conffolder;
- Configure the local warehouse path:
<localRepository>D:maven-repo</localRepository>
Copy after login - Configure the mirror source (can speed up downloading):
<mirrors> <mirror> <id>nexus</id> <mirrorOf>central</mirrorOf> <url>http://your.nexus.repo/content/groups/public</url> </mirror> </mirrors>
Copy after login - Configure proxy server (if necessary):
<proxies> <proxy> <id>example-proxy</id> <active>true</active> <protocol>http</protocol> <host>proxy.example.com</host> <port>8080</port> <username>proxyuser</username> <password>somepassword</password> <nonProxyHosts>www.google.com|*.example.com</nonProxyHosts> </proxy> </proxies>
Copy after login
- Create A simple Maven project:
Enter the following command on the command line:
mvn archetype:generate -DgroupId=com.example -DartifactId=my-project -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Copy after login - Build the project:
Enter the directory where the project is located and enter the following command to build the project:
mvn clean install
Copy after login - Add dependencies:
Add the required dependencies to the
pom.xmlfile of the project, for example:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-core</artifactId> <version>5.2.8.RELEASE</version> </dependency>
Copy after login - Run the project:
mvn exec:java -Dexec.mainClass="com.example.MyApp"
Copy after login
The above is the detailed content of In-depth explanation of Maven setup and installation to help you quickly start project construction. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple

While studying in high school, some students take very clear and accurate notes, taking more notes than others in the same class. For some, note-taking is a hobby, while for others, it is a necessity when they easily forget small information about anything important. Microsoft's NTFS application is particularly useful for students who wish to save important notes beyond regular lectures. In this article, we will describe the installation of Ubuntu applications on Ubuntu24. Updating the Ubuntu System Before installing the Ubuntu installer, on Ubuntu24 we need to ensure that the newly configured system has been updated. We can use the most famous "a" in Ubuntu system

Optimize Maven build tools: Optimize compilation speed: Take advantage of parallel compilation and incremental compilation. Optimize dependencies: Analyze dependency trees and use BOM (bill of materials) to manage transitive dependencies. Practical case: illustrate optimizing compilation speed and dependency management through examples.

Detailed steps to install Go language on Win7 computer Go (also known as Golang) is an open source programming language developed by Google. It is simple, efficient and has excellent concurrency performance. It is suitable for the development of cloud services, network applications and back-end systems. . Installing the Go language on a Win7 computer allows you to quickly get started with the language and start writing Go programs. The following will introduce in detail the steps to install the Go language on a Win7 computer, and attach specific code examples. Step 1: Download the Go language installation package and visit the Go official website

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Specific steps for Git to pull remote code to the local warehouse: Open Git Bash or a terminal window. Navigate to the local repository directory where you want to pull the code. Run command: git pull
