zoukankan      html  css  js  c++  java
  • Maven命令行使用:mvn clean package(打包)

     

    Maven命令行使用:mvn clean compile(编译)

    先把命令行切换到Maven项目的根目录,比如:/d/xxxwork/java/maven-test,然后执行命令:

     mvn clean compile

    执行结果如下:

    复制代码
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building rtp-front 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rtp-front ---
    [INFO] Deleting D:xxxworkJavamaven-test	arget
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rtp-front ---
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rtp-front ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
    [INFO] Compiling 13 source files to D:CtripWorkJavamaven-test	argetclasses
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 某些输入文件使用了未经检查或不安全的操作。
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 11.500 s
    [INFO] Finished at: 2016-11-14T15:15:13+08:00
    [INFO] Final Memory: 13M/76M
    [INFO] ------------------------------------------------------------------------
    复制代码

     执行顺序:

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

    2、使用资源插件:maven-resources-plugin:2.6执行资源文件的复制等(版本2.6);

    3、使用编译插件:maven-compiler-plugin:3.1编译所有源文件生成class文件至targetclasses目录下(版本3.1);

    4、整个编译过程完成。

    Maven命令行使用:mvn clean package(打包)

    先把命令行切换到Maven项目的根目录,比如:/d/xxxwork/java/maven-test,然后执行命令:

     mvn clean package

    执行结果如下:

    复制代码
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building rtp-front 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rtp-front ---
    [INFO] Deleting D:xxxworkJavamaven-test	arget
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rtp-front ---
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rtp-front ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
    [INFO] Compiling 13 source files to D:CtripWorkJavamaven-test	argetclasses
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 某些输入文件使用了未经检查或不安全的操作。
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rtp-front ---
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory D:xxxworkJavamaven-testsrc	est
    esources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rtp-front ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rtp-front ---
    [INFO] No tests to run.
    [INFO]
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ rtp-front ---
    [INFO] Building jar: D:xxxworkJavamaven-testtargetrtp-front-1.0-SNAPSHOT.jar
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.284 s
    [INFO] Finished at: 2016-11-14T15:36:55+08:00
    [INFO] Final Memory: 15M/77M
    [INFO] ------------------------------------------------------------------------
    复制代码

     执行顺序:

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

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

    3、使用编译插件:maven-compiler-plugin:3.1编译所有源文件生成class文件至targetclasses目录下(版本3.1);

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

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

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

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

    备注:

    不管是compile、package还是install等前三个步骤都是必不可少的。

    Maven命令行使用:mvn clean install(安装)

    先把命令行切换到Maven项目的根目录,比如:/d/xxxwork/java/maven-test,然后执行命令:

    $ mvn clean install

    执行结果如下:

    复制代码
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building rtp-front 1.0-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ rtp-front ---
    [INFO] Deleting D:xxxworkJavamaven-test	arget
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ rtp-front ---
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] Copying 0 resource
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ rtp-front ---
    [INFO] Changes detected - recompiling the module!
    [WARNING] File encoding has not been set, using platform encoding GBK, i.e. build is platform dependent!
    [INFO] Compiling 13 source files to D:xxxworkJavamaven-test	argetclasses
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 某些输入文件使用了未经检查或不安全的操作。
    [WARNING] /D:/xxxwork/Java/maven-test/src/main/java/ReadOnly.java: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
    [INFO]
    [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ rtp-front ---
    [WARNING] Using platform encoding (GBK actually) to copy filtered resources, i.e. build is platform dependent!
    [INFO] skip non existing resourceDirectory D:xxxworkJavamaven-testsrc	est
    esources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ rtp-front ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ rtp-front ---
    [INFO] No tests to run.
    [INFO]
    [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ rtp-front ---
    [INFO] Building jar: D:xxxworkJavamaven-test	arget
    tp-front-1.0-SNAPSHOT.jar
    [INFO]
    [INFO] --- maven-install-plugin:2.4:install (default-install) @ rtp-front ---
    [INFO] Installing D:xxxworkJavamaven-test	arget
    tp-front-1.0-SNAPSHOT.jar to d:Usersxyz.m2
    epositorycomxyzfinance
    tp
    tp-front1.0-SNAPSHOT
    tp-front-1.0-SNAPSHOT.jar
    [INFO] Installing D:xxxworkJavamaven-testpom.xml to d:Usersxyz.m2
    epositorycomxyzfinance
    tp
    tp-front1.0-SNAPSHOT
    tp-front-1.0-SNAPSHOT.pom
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.892 s
    [INFO] Finished at: 2016-11-14T16:10:35+08:00
    [INFO] Final Memory: 15M/76M
    [INFO] ------------------------------------------------------------------------
    复制代码

     执行顺序:

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

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

    3、使用编译插件:maven-compiler-plugin:3.1编译所有源文件生成class文件至targetclasses目录下(版本3.1);

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

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

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

    7、使用插件:maven-jar-plugin:2.4对编译后生成的文件进行打包,包名称默认为:artifactId-version,比如本例生成的jar文件:rtp-front-1.0-SNAPSHOT,包文件保存在target目录下;

    8、使用maven-install-plugin:2.4把上述打包生成的jar包和pom文件安装到本地的仓库中(一般默认的路径为:%HOMEPATH%.m2 epositorypom中groupId按.分隔的目录层次pom中的artifactIdpom中的versionjar包的名称)。

    //       或者 mvn clean -Dmaven.test.skip=true package 打包

  • 相关阅读:
    HLG 1522 子序列的和【队列的应用】
    POJ 3273 Monthly Expense【二分】
    HDU 4004 The Frog's Games 【二分】
    POJ 2001 Shortest Prefixes【第一棵字典树】
    POJ 2823 Sliding Window【单调对列经典题目】
    HDU 1969 Pie 【二分】
    POJ 3125 Printer Queue【暴力模拟】
    POJ 3250 Bad Hair Day【单调栈】
    字典树【模板】
    验证码 Code
  • 原文地址:https://www.cnblogs.com/xianz666/p/14229003.html
Copyright © 2011-2022 走看看