Java-Maven(二):Maven常用命令
Maven命令简介
Maven提供了一套命令可以用来创建java工程、编译、打包等操作。通过这些命令来处理工作变得更方便、简洁。
Maven工程结构和内容被定义在pom.xml文件中,全称project object moduel
当我们创建一个Maven工程时,Maven会创建默认的工程结构,开发者只需要合理的放置配置文件,而在pom.xml文件中无需做任何配置。
Maven创建工程命令
maven创建工程命令格式:
mvn archetype:generate -Dgroupid #公司名称 -DartifactId #项目名称 -DarchetypeArtifactId #archetypeArtifactId 模型(骨架) -DinteractiveMode #是否使用交互模式
备注:archetypeArtifactId模型(骨架):
1)指定为maven-archetype-quickstart,创建一个java project工程;
2)指定为maven-archetype-webapp ,创建一个web project工程。
1)使用maven-archetype-quickstart骨架来创建java project
在D盘下新建maven文件夹,进入d:\maven下,按着shift键同时右键,会弹出“在此处打开命令窗口(W)”
在打开的cmd窗口中输入命令:mvn archetype:generate,此时如果你是第一次执行该命令,就会下载很多插件。
当需要下载的内容下载完成后,就开始填写参数等来创建工程
。。。
1871: remote -> us.fatehi:schemacrawler-archetype-plugin-lint (-) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): 990: maven-archetype-quickstart #输入骨架名称,可以自动筛选如骨架编号 Choose archetype: 1: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetyp e which contains a sample Maven project.) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): 1: 1 #输入骨架对应的编号 Choose org.apache.maven.archetypes:maven-archetype-quickstart version: 1: 1.0-alpha-1 2: 1.0-alpha-2 3: 1.0-alpha-3 4: 1.0-alpha-4 5: 1.0 6: 1.1 Choose a number: 6: 6 #输入应用骨架的版本 Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.pom (2.0 kB at 3.9 kB /s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-bundles/4/maven-archetype-bundles-4.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-bundles/4/maven-archetype-bundles-4.pom (3.6 kB at 6.9 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/mav en-archetype/2.0-alpha-5/maven-archetype-2.0-alpha-5.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/mave n-archetype/2.0-alpha-5/maven-archetype-2.0-alpha-5.pom (8.7 kB at 17 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/ 16/maven-parent-16.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/1 6/maven-parent-16.pom (23 kB at 41 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/apache/7/apache-7.p om Downloaded: https://repo.maven.apache.org/maven2/org/apache/apache/7/apache-7.po m (14 kB at 29 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.jar Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-quickstart/1.1/maven-archetype-quickstart-1.1.jar (6.2 kB at 12 kB/ s) Define value for property 'groupId': com.dx #为公司名称 Define value for property 'artifactId': maven_demo1 #为项目名称 Define value for property 'version' 1.0-SNAPSHOT: : #项目版本,直接回车为默认1.0-SNAPSHOT Define value for property 'package' com.dx: : com.dx.maven_demo1#包名 Confirm properties configuration: groupId: com.dx artifactId: maven_demo1 version: 1.0-SNAPSHOT package: com.dx.maven_demo1 Y: : y #确认是否为以上参数 [INFO] -------------------------------------------------------------- [INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-quickstart:1.1 [INFO] -------------------------------------------------------------- [INFO] Parameter: basedir, Value: D:\maven [INFO] Parameter: package, Value: com.dx.maven_demo1 [INFO] Parameter: groupId, Value: com.dx [INFO] Parameter: artifactId, Value: maven_demo1 [INFO] Parameter: packageName, Value: com.dx.maven_demo1 [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] project created from Old (1.x) Archetype in dir: D:\maven\maven_demo1 [INFO] ------------------------------------------------------------- [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------- [INFO] Total time: 06:30 min [INFO] Finished at: 2017-06-23T18:12:18+08:00 [INFO] Final Memory: 17M/262M [INFO] ------------------------------------------------------------- D:\maven>
此时,在d:\maven\就有一个工程maven_demo1
maven_demo1 java工程的目录结构:
D:\maven\.
D:\maven\maven_demo1\.
D:\maven\maven_demo1\pom.xml
D:\maven\maven_demo1\src\.
D:\maven\maven_demo1\src\main\.
D:\maven\maven_demo1\src\main\java\.
D:\maven\maven_demo1\src\main\java\com\.
D:\maven\maven_demo1\src\main\java\com\dx\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\App.java
D:\maven\maven_demo1\src\test\.
D:\maven\maven_demo1\src\test\java\.
D:\maven\maven_demo1\src\test\java\com\.
D:\maven\maven_demo1\src\test\java\com\dx\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\AppTest.java
备注:bat来遍历d:\maven目录
@echo off set work_path=D:\maven D: cd %work_path% for /R %%s in (.,*) do ( echo %%s ) pause
2)使用maven-archetype-webapp骨架来创建web project
1871: remote -> us.fatehi:schemacrawler-archetype-plugin-lint (-) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): 990: maven-archetype-webapp Choose archetype: 1: remote -> org.apache.maven.archetypes:maven-archetype-webapp (An archetype wh ich contains a sample Maven Webapp project.) Choose a number or apply filter (format: [groupId:]artifactId, case sensitive co ntains): : 1 Choose org.apache.maven.archetypes:maven-archetype-webapp version: 1: 1.0-alpha-1 2: 1.0-alpha-2 3: 1.0-alpha-3 4: 1.0-alpha-4 5: 1.0 Choose a number: 5: 5 Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-webapp/1.0/maven-archetype-webapp-1.0.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-webapp/1.0/maven-archetype-webapp-1.0.pom (533 B at 866 B/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-bundles/2/maven-archetype-bundles-2.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-bundles/2/maven-archetype-bundles-2.pom (1.5 kB at 2.8 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/mav en-archetype-parent/1/maven-archetype-parent-1.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetype/mave n-archetype-parent/1/maven-archetype-parent-1.pom (1.3 kB at 2.5 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/ 4/maven-parent-4.pom Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/maven-parent/4 /maven-parent-4.pom (10.0 kB at 19 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.p om Downloaded: https://repo.maven.apache.org/maven2/org/apache/apache/3/apache-3.po m (3.4 kB at 6.3 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/ma ven-archetype-webapp/1.0/maven-archetype-webapp-1.0.jar Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/archetypes/mav en-archetype-webapp/1.0/maven-archetype-webapp-1.0.jar (3.9 kB at 7.8 kB/s) Define value for property 'groupId': com.dx Define value for property 'artifactId': maven_webdemo1 Define value for property 'version' 1.0-SNAPSHOT: : Define value for property 'package' com.dx: : com.dx.maven_webdemo1 Confirm properties configuration: groupId: com.dx artifactId: maven_webdemo1 version: 1.0-SNAPSHOT package: com.dx.maven_webdemo1 Y: : y [INFO] ------------------------------------------------------------------------- --- [INFO] Using following parameters for creating project from Old (1.x) Archetype: maven-archetype-webapp:1.0 [INFO] ------------------------------------------------------------------------- --- [INFO] Parameter: basedir, Value: D:\maven [INFO] Parameter: package, Value: com.dx.maven_webdemo1 [INFO] Parameter: groupId, Value: com.dx [INFO] Parameter: artifactId, Value: maven_webdemo1 [INFO] Parameter: packageName, Value: com.dx.maven_webdemo1 [INFO] Parameter: version, Value: 1.0-SNAPSHOT [INFO] project created from Old (1.x) Archetype in dir: D:\maven\maven_webdemo1 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 01:13 min [INFO] Finished at: 2017-06-23T18:37:24+08:00 [INFO] Final Memory: 16M/172M [INFO] ------------------------------------------------------------------------ D:\maven>
查看目录结构:
D:\maven\maven_webdemo1\. D:\maven\maven_webdemo1\pom.xml D:\maven\maven_webdemo1\src\. D:\maven\maven_webdemo1\src\main\. D:\maven\maven_webdemo1\src\main\resources\. D:\maven\maven_webdemo1\src\main\webapp\. D:\maven\maven_webdemo1\src\main\webapp\index.jsp D:\maven\maven_webdemo1\src\main\webapp\WEB-INF\. D:\maven\maven_webdemo1\src\main\webapp\WEB-INF\web.xml
3)maven compile
D:\maven\maven_demo1>mvn compile [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_demo 1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\main\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_demo1 --- [INFO] Nothing to compile - all classes are up to date [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.147 s [INFO] Finished at: 2017-06-23T18:53:05+08:00 [INFO] Final Memory: 9M/212M [INFO] ------------------------------------------------------------------------
产看目录结构:
D:\maven\maven_demo1\src\test\java\com\dx\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\. D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\AppTest.java D:\maven\maven_demo1\target\. D:\maven\maven_demo1\target\classes\. D:\maven\maven_demo1\target\classes\com\. D:\maven\maven_demo1\target\classes\com\dx\. D:\maven\maven_demo1\target\classes\com\dx\maven_demo1\. D:\maven\maven_demo1\target\classes\com\dx\maven_demo1\App.class D:\maven\maven_demo1\target\maven-status\. D:\maven\maven_demo1\target\maven-status\maven-compiler-plugin\. D:\maven\maven_demo1\target\maven-status\maven-compiler-plugin\compile\. D:\maven\maven_demo1\target\maven-status\maven-compiler-plugin\compile\default-c ompile\. D:\maven\maven_demo1\target\maven-status\maven-compiler-plugin\compile\default-c ompile\createdFiles.lst D:\maven\maven_demo1\target\maven-status\maven-compiler-plugin\compile\default-c ompile\inputFiles.lst
4)maven clean
D:\maven\maven_demo1>mvn clean [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven_demo1 --- Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-uti ls/3.0/plexus-utils-3.0.pom Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-util s/3.0/plexus-utils-3.0.pom (4.1 kB at 1.5 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-paren t/16/spice-parent-16.pom Downloaded: https://repo.maven.apache.org/maven2/org/sonatype/spice/spice-parent /16/spice-parent-16.pom (8.4 kB at 6.4 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-paren t/5/forge-parent-5.pom Downloaded: https://repo.maven.apache.org/maven2/org/sonatype/forge/forge-parent /5/forge-parent-5.pom (8.4 kB at 13 kB/s) Downloading: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-uti ls/3.0/plexus-utils-3.0.jar Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-util s/3.0/plexus-utils-3.0.jar (226 kB at 93 kB/s) [INFO] Deleting D:\maven\maven_demo1\target [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8.575 s [INFO] Finished at: 2017-06-24T04:32:03+08:00 [INFO] Final Memory: 9M/136M [INFO] ------------------------------------------------------------------------
查看目录结构:
D:\maven\maven_demo1\.
D:\maven\maven_demo1\pom.xml
D:\maven\maven_demo1\src\.
D:\maven\maven_demo1\src\main\.
D:\maven\maven_demo1\src\main\java\.
D:\maven\maven_demo1\src\main\java\com\.
D:\maven\maven_demo1\src\main\java\com\dx\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\App.java
D:\maven\maven_demo1\src\test\.
D:\maven\maven_demo1\src\test\java\.
D:\maven\maven_demo1\src\test\java\com\.
D:\maven\maven_demo1\src\test\java\com\dx\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\AppTest.java
5)mvn site生成站点目录
D:\maven\maven_demo1>mvn site [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-site-plugin:3.3:site (default-site) @ maven_demo1 --- [WARNING] Report plugin org.apache.maven.plugins:maven-project-info-reports-plug in has an empty version. [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten t he stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support buildin g such malformed projects. [INFO] configuring report plugin org.apache.maven.plugins:maven-project-info-rep orts-plugin:2.9 [INFO] Relativizing decoration links with respect to project URL: http://maven.a pache.org [INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 ski n. [INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin :2.9 [INFO] Generating "Dependency Convergence" report --- maven-project-info-repo rts-plugin:2.9 [INFO] Generating "Dependency Information" report --- maven-project-info-repo rts-plugin:2.9 [INFO] Generating "About" report --- maven-project-info-reports-plugin:2.9 [INFO] Generating "Plugin Management" report --- maven-project-info-reports-p lugin:2.9 [INFO] Generating "Plugins" report --- maven-project-info-reports-plugin:2.9 [INFO] Generating "Summary" report --- maven-project-info-reports-plugin:2.9 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 13.808 s [INFO] Finished at: 2017-06-24T04:48:46+08:00 [INFO] Final Memory: 21M/276M [INFO] ------------------------------------------------------------------------
查看目录结构:
D:\maven\maven_demo1\.
D:\maven\maven_demo1\pom.xml
D:\maven\maven_demo1\src\.
D:\maven\maven_demo1\src\main\.
D:\maven\maven_demo1\src\main\java\.
D:\maven\maven_demo1\src\main\java\com\.
D:\maven\maven_demo1\src\main\java\com\dx\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\main\java\com\dx\maven_demo1\App.java
D:\maven\maven_demo1\src\test\.
D:\maven\maven_demo1\src\test\java\.
D:\maven\maven_demo1\src\test\java\com\.
D:\maven\maven_demo1\src\test\java\com\dx\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\.
D:\maven\maven_demo1\src\test\java\com\dx\maven_demo1\AppTest.java
D:\maven\maven_demo1\target\.
D:\maven\maven_demo1\target\site\.
D:\maven\maven_demo1\target\site\dependencies.html
D:\maven\maven_demo1\target\site\dependency-convergence.html
D:\maven\maven_demo1\target\site\dependency-info.html
D:\maven\maven_demo1\target\site\index.html
D:\maven\maven_demo1\target\site\plugin-management.html
D:\maven\maven_demo1\target\site\plugins.html
D:\maven\maven_demo1\target\site\project-info.html
D:\maven\maven_demo1\target\site\project-summary.html
D:\maven\maven_demo1\target\site\css\.
D:\maven\maven_demo1\target\site\css\maven-base.css
D:\maven\maven_demo1\target\site\css\maven-theme.css
D:\maven\maven_demo1\target\site\css\print.css
D:\maven\maven_demo1\target\site\css\site.css
D:\maven\maven_demo1\target\site\images\.
D:\maven\maven_demo1\target\site\images\close.gif
D:\maven\maven_demo1\target\site\images\collapsed.gif
D:\maven\maven_demo1\target\site\images\expanded.gif
D:\maven\maven_demo1\target\site\images\external.png
D:\maven\maven_demo1\target\site\images\icon_error_sml.gif
D:\maven\maven_demo1\target\site\images\icon_info_sml.gif
D:\maven\maven_demo1\target\site\images\icon_success_sml.gif
D:\maven\maven_demo1\target\site\images\icon_warning_sml.gif
D:\maven\maven_demo1\target\site\images\newwindow.png
D:\maven\maven_demo1\target\site\images\logos\.
D:\maven\maven_demo1\target\site\images\logos\build-by-maven-black.png
D:\maven\maven_demo1\target\site\images\logos\build-by-maven-white.png
D:\maven\maven_demo1\target\site\images\logos\maven-feather.png
其中可以访问D:\maven\maven_demo1\target\site\index.html,页面结果为:
6)mvn install(把当前工程生成war或者jar包到本地仓库中)
maven本地仓库:C:\Users\Administrator\.m2\repository
D:\maven\maven_demo1>mvn install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven -surefire-plugin/2.12.4/maven-surefire-plugin-2.12.4.jar [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\main\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_demo1 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to D:\maven\maven_demo1\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ma ven_demo1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory 。。。 Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/suref ire-junit3/2.12.4/surefire-junit3-2.12.4.jar (26 kB at 24 kB/s) ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.dx.maven_demo1.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven_demo1 --- 。。。 [INFO] Installing D:\maven\maven_demo1\pom.xml to C:\Users\Administrator\.m2\rep ository\com\dx\maven_demo1\1.0-SNAPSHOT\maven_demo1-1.0-SNAPSHOT.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 38.062 s [INFO] Finished at: 2017-06-24T04:54:57+08:00 [INFO] Final Memory: 19M/171M [INFO] ------------------------------------------------------------------------ D:\maven\maven_demo1>
生成的jar包在maven仓库的位置为:C:\Users\Administrator\.m2\repository\com\dx\maven_demo1\1.0-SNAPSHOT
7)mvn package(打包)
D:\maven\maven_demo1>mvn package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_demo 1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\main\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_demo1 --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ma ven_demo1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\test\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven_d emo1 --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven_demo1 --- [INFO] Surefire report directory: D:\maven\maven_demo1\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.dx.maven_demo1.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven_demo1 --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.694 s [INFO] Finished at: 2017-06-24T04:59:57+08:00 [INFO] Final Memory: 11M/150M [INFO] ------------------------------------------------------------------------ D:\maven\maven_demo1>
打包文件位置:D:\maven\maven_demo1\target\maven_demo1-1.0-SNAPSHOT.jar
在web工程中,会生成*.war包。
8)mvn clean package(先清理再打包)
D:\maven\maven_demo1>mvn clean package [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ maven_demo1 --- [INFO] Deleting D:\maven\maven_demo1\target [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ maven_demo 1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\main\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ maven_demo1 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to D:\maven\maven_demo1\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ ma ven_demo1 --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory D:\maven\maven_demo1\src\test\resourc es [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ maven_d emo1 --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to D:\maven\maven_demo1\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ maven_demo1 --- [INFO] Surefire report directory: D:\maven\maven_demo1\target\surefire-reports ------------------------------------------------------- T E S T S ------------------------------------------------------- Running com.dx.maven_demo1.AppTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.005 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ maven_demo1 --- [INFO] Building jar: D:\maven\maven_demo1\target\maven_demo1-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.643 s [INFO] Finished at: 2017-06-24T05:03:50+08:00 [INFO] Final Memory: 17M/167M [INFO] ------------------------------------------------------------------------ D:\maven\maven_demo1>
9)mvn jar:jar(打包为jar)
D:\maven\maven_demo1>mvn jar:jar [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building maven_demo1 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-cli) @ maven_demo1 --- [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: D:\maven\maven_demo1\target\maven_demo1-1.0-SNAPSHOT.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.305 s [INFO] Finished at: 2017-06-24T05:06:19+08:00 [INFO] Final Memory: 10M/150M [INFO] ------------------------------------------------------------------------ D:\maven\maven_demo1>
基础才是编程人员应该深入研究的问题,比如:
1)List/Set/Map内部组成原理|区别
2)mysql索引存储结构&如何调优/b-tree特点、计算复杂度及影响复杂度的因素。。。
3)JVM运行组成与原理及调优
4)Java类加载器运行原理
5)Java中GC过程原理|使用的回收算法原理
6)Redis中hash一致性实现及与hash其他区别
7)Java多线程、线程池开发、管理Lock与Synchroined区别
8)Spring IOC/AOP 原理;加载过程的。。。
【+加关注】。