Mac OS下安装mvn,大包

一、安装mvn

(1)在apache官方网站可以下载:http://maven.apache.org/download.cgi

(2)建立文件 touch ~/.bash_profile

(3)添加写权限 chmod a+w ~/.bash_profile

(4)添加环境变量 vim ~/.bash_profile

M2_HOME=/Users/xxxx/Documents/apache-maven-3.6.0

PATH=$PATH:$M2_HOME/bin

(5)启用环境变量 source ~/.bash_profile

(6)找到本地在maven安装目录conf 下的 settings.xml 配置文件,我的是在/Users/xxxx/Documents/apache-maven-3.6.0/conf/settings.xml,找到配置路径的localRepository标签,将maven安装的路径配上

(7)下载仓库所需的jar包等资源

      在控制台输入:mvn help:system

Mac OS下安装mvn,大包

至此,Maven安装完成。

 

二、mvn大包

打包命令:mvn -f pom.xml clean package

注意:META-INF下MAMIFEST.MF添加Class-Path和Main-Classe

Manifest-Version: 1.0
Class-Path: com.kingwolf.demo
Main-Class: com.kingwolf.demo.KwBootApp

pom.xml中添加

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>