zoukankan      html  css  js  c++  java
  • maven 常用命令

    1. 编译源代码:

    mvn compile

    2. 测试:

    mvn test-compile                     #编译测试
    mvn test                             #运行测试
    mvn [param] -Dmaven.test.skip=true   #跳过执行该param的测试

    3. 打包:

    mvn package

    4. 在本地Repository中安装jar:

    mvn install
    例:installing D:xxxxx.jar to D:xxxxxx

        mvn compile与mvn install、mvn deploy的区别

    1. mvn compile,编译类文件
    2. mvn install,包含mvn compile,mvn package,然后上传到本地仓库
    3. mvn deploy,包含mvn install,然后,上传到私服

    5. 清除产生的项目:

    mvn clean

    6. 只打jar包:

    mvn jar:jar

    7.查看当前项目已被解析的依赖:

    mvn dependency:list

    8.上传到私服:

    mvn deploy

    9. 强制检查更新,由于快照版本的更新策略(一天更新几次、隔段时间更新一次)存在,如果想强制更新就会用到此命令: 

    mvn clean install-U

    10. 源码打包:

    mvn source:jar
    或
    mvn source:jar-no-fork

    11. 显示版本信息 :

    mvn -version/-v

    12. 显示详细错误 信息:

    mvn -e

    13. 验证工程是否正确,所有需要的资源是否可用:

    mvn validate

    14. 在集成测试可以运行的环境中处理和发布包:

    mvn integration-test

    15. 运行任何检查,验证包是否有效且达到质量标准:

    mvn verify

    16 使用 help 插件的  describe 目标来输出 Maven Help 插件的信息:

    mvn help:describe -Dplugin=help
    mvn help:describe -Dplugin=help -Dfull

    17. 列出所有 Maven Exec 插件可用的目标:

    mvn help:describe -Dplugin=exec -Dfull

    18. 看这个“有效的 (effective)”POM,它暴露了 Maven的默认设置 :

    mvn help:effective-pom

    19. 想要查看完整的依赖踪迹,包含那些因为冲突或者其它原因而被拒绝引入的构件,打开 Maven 的调试标记运行 :

    mvn install -X

    20. mvn exec命令可以执行项目中的main函数 :

    首先需要编译java工程:mvn compile
    不存在参数的情况下:mvn exec:java -Dexec.mainClass="***.Main"
    存在参数:mvn exec:java -Dexec.mainClass="***.Main" -Dexec.args="arg0 arg1 arg2"
    指定运行时库:mvn exec:java -Dexec.mainClass="***.Main" -Dexec.classpathScope=runtime

    21. 打印出已解决依赖的列表 :

    mvn dependency:resolve

    22. 打印整个依赖树 :

    mvn dependency:tree

    23.发布第三方Jar到本地库中

    mvn install:install-file -DgroupId=com -DartifactId=client -Dversion=0.1.0 -Dpackaging=jar -Dfile=d:client-0.1.0.jar
    
    
    -DdownloadSources=true
    
    -DdownloadJavadocs=true

    24.在应用程序用使用多个存储库 

    <!-- 设定主仓库,按设定顺序进行查找。 -->
    <repositories>
    <repository>
    <id>aliyun</id>
    <name>aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </repository>
    <repository>
    <id>maven</id>
    <name>maven</name>
    <url>http://central.maven.org/maven2/</url>
    </repository>
    </repositories>

    <!-- 设定插件仓库 -->
    <pluginRepositories>
     <repository>
    <id>aliyun</id>
    <name>aliyun</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public</url>
    </repository>
    <repository>
    <id>maven</id>
    <name>maven</name>
    <url>http://central.maven.org/maven2/</url>
    </repository>
    </pluginRepositories>
  • 相关阅读:
    WSP部署错误—SharePoint管理框架中的对象“SPSolutionLanguagePack Name=0”依赖其他不存在的对象
    Elevate Permissions To Modify User Profile
    Error with Stsadm CommandObject reference not set to an instance of an object
    ASP.NET MVC3添加Controller时没有Scaffolding options
    测试使用Windows Live Writer写日志
    配置TFS 2010出现错误—SQL Server 登录的安全标识符(SID)与某个指定的域或工作组帐户冲突
    使用ADO.NET DbContext Generator出现错误—Unable to locate file
    CSS
    HTML DIV标签
    数据库
  • 原文地址:https://www.cnblogs.com/wangfeixiong/p/7051274.html
Copyright © 2011-2022 走看看