zoukankan      html  css  js  c++  java
  • maven

    maven命令分为 build phase(build lifecycle phase) 和 plugin goal 两种。

    例如命令:mvn clean dependency:copy-dependencies package,clean 和 package 是 build phase,而 dependency:copy-dependencies 是 plugin goal。

    Maven 命令手册:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

    执行 plugin goal 有如下几种方式:(https://cwiki.apache.org//confluence/display/MAVEN/LifecyclePhaseNotFoundException
    1. 通过 plugin 前缀(plugin prefix)
    例如:mvn compiler:compile
    最终,plugin prefix 会被转换成 plugin 的 group id 和 artifact id。Maven 解析 plugin prefixes 时,会去查找当前工程的 pom,然后去找到 pom 中用户指定的 plugin groups 定义。

    2. 通过无版本的 plugin 坐标
    例如:mvn org.apache.maven.plugins:maven-compiler-plugin:compile
    为了解析 plugin 的版本,Maven 将会去当前工程的 pom 中去查找用户定义的最新的 plugin 版本

    3. 通过 plugin 的全坐标
    例如:mvn org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile

    maven命令收集

    mvn tomcat:run                默认使用的是8080端口

    mvn -Dmaven.tomcat.port=8081 tomcat:run    指定端口

    mvn tomcat:run -Denv=prod            指定profile (env是maven profile里面的变量?现在工程用 disconf-env ?)

    mvnDebug tomcat7:run         调试模式启动,然后在eclipse中 Debug Configurations 中添加 Remote Java Application,填写 host 和 port,就可以进行调试了。

    mvn clean package -P local            指定 profile 打包

    mvn jetty:run

    mvn install -Dmaven.test.skip=true         忽略单元测试(或者:-DskipTests=true)

    mvn clean -U                 强制更新依赖,同 eclipse 中的 Maven > Update Project 功能相同

    mvn dependency:sources            Maven 下载源码

    mvn dependency:copy-dependencies      Maven 拷贝依赖 jar

    Maven将jar包 install 到本地库

    mvn install:install-file -Dfile=D:trace-bin-1.3.9uildtrace-agent.jar -DgroupId=com.sun.tools.btrace -DartifactId=btrace-agent -Dversion=1.3.9 -Dpackaging=jar
    mvn install:install-file -Dfile=D:trace-bin-1.3.9uildtrace-boot.jar -DgroupId=com.sun.tools.btrace -DartifactId=btrace-boot -Dversion=1.3.9 -Dpackaging=jar

    本地就可以通过下面的 dependency 来依赖这个 jar 了:

    <dependency>
        <groupId>com.sun.tools.btrace</groupId>
        <artifactId>btrace-agent</artifactId>
        <version>1.3.9</version>
    </dependency>
    <dependency>
        <groupId>com.sun.tools.btrace</groupId>
        <artifactId>btrace-boot</artifactId>
        <version>1.3.9</version>
    </dependency>
    View Code

    资料:

    maven配置:http://www.cnblogs.com/yakov/archive/2011/11/26/maven2_settings.html
    官网资料:http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
    问题资料:https://cwiki.apache.org//confluence/display/MAVEN/LifecyclePhaseNotFoundException

  • 相关阅读:
    echarts圆套圆
    两个对象深度比较,借鉴,记录
    js异步加载的方式
    elementUI使用el-card高度自适应
    如何在页面上实现一个圆形的可点击区域
    清除浮动
    水平垂直居中的几种方式
    BFC原理
    正则表达式
    Vue项目中难点问题
  • 原文地址:https://www.cnblogs.com/kevin-yuan/p/7477634.html
Copyright © 2011-2022 走看看