Linux-- configuration maven

Foreword

Maven is a project management tool which encompasses a project object model (Project Object Model), a set of standards, a project life cycle (Project Lifecycle), a dependency management system (Dependency Management System), is defined and used to run in life-cycle stage (phase) logic plug (plugin) target (goal) is. When you use the Maven project object model you are using a well-defined to describe your project, Maven can then apply cross-cutting logic, and this logic from a set of shared (or custom) plugins.

step

官网 | https://maven.apache.org/

download

# wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.1/binaries/apache-maven-3.6.1-bin.tar.gz

Create a directory

# mkdir /usr/local/maven

Decompression

tar -zxvf apache-maven-3.6.1-bin.tar.gz  -C /usr/local/maven/

Configuration environment variable

# vi /etc/profile

export PATH=$PATH:/usr/local/maven/apache-maven-3.6.1/bin

# source /etc/profile

Replacement Profilesettings.xml

将项目配置好的`settings.xml `替换`/usr/local/maven/apache-maven-3.6.1/conf`中的xml文件

Common Commands

mvn archetype:generate 创建Maven项目
mvn compile 编译源代码
mvn deploy 发布项目
mvn test-compile 编译测试源代码
mvn test 运行应用程序中的单元测试
mvn site 生成项目相关信息的网站
mvn clean 清除项目目录中的生成结果
mvn package 根据项目生成的jar
mvn install 在本地Repository中安装jar
mvn eclipse:eclipse 生成eclipse项目文件
mvnjetty:run 启动jetty服务
mvntomcat:run 启动tomcat服务
mvn clean package -Dmaven.test.skip=true:清除以前的包后重新打包,跳过测试类

Guess you like

Origin www.cnblogs.com/wangyang0210/p/11398915.html