current position:Home>Maven build local warehouse

Maven build local warehouse

2022-01-27 01:52:50 Green shirt undress

Official website :

 ​https://maven.apache.org/download.cgi​

maven install :

       
       
tar zxf apache-maven-3.6.3-bin.tar.gz
  • 1.

Configure environment variables :

       
       
vim /etc/profile
export mvn_home=/usr/local/maven
export PATH=$PATH:/usr/local/maven/bin
  • 1.
  • 2.
  • 3.

Maven command :

Mvn clean: clear mvn Built under the project target Directory and compiled class file .

Mvn compile: compile , In the project .java The file is compiled as .cleass file .

Mvn test: unit testing ./src/test/java Unit tests under the project will be executed .( Perform both compilation and testing 2 A step )

Mvn Package: Package the project . Talk about how to package the project into the root directory target Catalog .( Perform both compilation and testing 、 pack 3 A step )

Why? mvn package What comes out of the package is war The bag is not jar package ?

This is determined by the project ,web project mvn package Packing is war package ;java Project packaging is jar package , You don't need to specify it manually .

Mvn install: install . Pack and store locally mvn Warehouse .( Perform both compilation and testing 、 pack 3 A step )

mvn Test code :

Code cloud : ​ ​https://gitee.com/Apache-ShenYu/incubator-shenyu.git​​​

 ​ ​https://gitee.com/mr-xiaoyu/gt06-gps-java.git​​​

 ​ ​https://github.com/mengerwei/java.git​​​

Mvn Configure alicloud warehouse :

Default to apache-mvn download , Foreign sites .

<mirrors> Configure under the label :

       
       
<mirrors>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.

maven Build a local warehouse _maven Build a local warehouse

perform mvn pack :

Switch to java Execute under directory mvn package, The first time is quite long , The follow-up will be short .

maven Build a local warehouse _maven Build a local warehouse _02

see mvn Local repository :

The catalog can be found in m2.conf Modification in file , The default is in the user's home directory .

maven Build a local warehouse _maven Build a local warehouse _03

copyright notice
author[Green shirt undress],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/01/202201270152475678.html

Random recommended