mac的使用

1.查看环境变量的命令:spring

vim ~/.bash_profile

2.查看包含隐藏文件的文件列表apache

ls -al

3.更改mvn路径vim

export M3_HOME=/Users/guanguan/apache-maven-3.3.9
export PATH=$PATH:$M3_HOME/bin

source .bash_profile

而后执行mvn -version查看环境变量是否生效bash

➜  ~ mvn -version
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-11T00:41:47+08:00)
Maven home: /Users/guanguan/apache-maven-3.3.9
Java version: 1.8.0_92, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
➜  ~

4.执行mvn clean package命令maven

➜  springCloud mvn clean package
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for com.test.springCloud:springCloud:jar:1.0-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.test.springCloud:springCloud:1.0-SNAPSHOT (/Users/guanguan/study/springCloud/pom.xml) points at com.test:myShiro instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 11, column 13
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building springCloud 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ springCloud ---
[INFO] Deleting /Users/guanguan/study/springCloud/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ springCloud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ springCloud ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /Users/guanguan/study/springCloud/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ springCloud ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/guanguan/study/springCloud/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ springCloud ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) @ springCloud ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ springCloud ---
[INFO] Building jar: /Users/guanguan/study/springCloud/target/springCloud-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.080 s
[INFO] Finished at: 2017-10-23T15:02:22+08:00
[INFO] Final Memory: 33M/282M
[INFO] ------------------------------------------------------------------------
➜  springCloud

执行顺序以下:spring-boot

一、使用清理插件:maven-clean-plugin:2.5执行清理删除已有target目录(版本2.5);测试

二、使用资源插件:maven-resources-plugin:2.6执行资源文件的处理(版本2.6);ui

三、使用编译插件:maven-compiler-plugin:3.1编译全部源文件生成class文件至target\classes目录下(版本3.1);this

四、使用资源插件:maven-resources-plugin:2.6执行测试资源文件的处理(版本2.6);插件

五、使用编译插件:maven-compiler-plugin:3.1编译测试目录下的全部源代码(版本3.1);

六、使用插件:maven-surefire-plugin:2.12运行测试用例(版本2.12);

七、使用插件:maven-jar-plugin:2.4对编译后生成的文件进行打包,包名称默认为:artifactId-version,好比本例生成的jar文件:springCloud-1.0-SNAPSHOT,包文件保存在target目录下(这个生成的包不能在命令行中直接执行,由于咱们尚未入口类配置到Manifest资源配置文件中去,后续会阐述)。

备注:

无论是compile、package仍是install等前三个步骤都是必不可少的。

相关文章
相关标签/搜索