zoukankan      html  css  js  c++  java
  • Maven

    1.解决IntelliJ IDEA 创建Maven项目速度慢问题 DarchetypeCatalog

    原因

    IDEA根据maven archetype的本质,其实是执行mvn archetype:generate命令,该命令执行时,需要指定一个archetype-catalog.xml文件。

    该命令的参数-DarchetypeCatalog,可选值为:remote,internal  ,local等,用来指定archetype-catalog.xml文件从哪里获取。

    默认为remote,即从 http://repo1.maven.org/maven2/archetype-catalog.xml路径下载archetype-catalog.xml文件。

    http://repo1.maven.org/maven2/archetype-catalog.xml 文件约为3-4M,下载速度很慢,导致创建过程卡住。

    解决方法:设置属性:archetypeCatalog = internal

     2.maven依赖范围

    依赖范围 对于编译classpath有效 对于测试classpath有效 对于运行时classpath有效 例子
    compile Y Y Y spring-core
    test   Y   Junit
    provided Y Y   sevlet-api
    runtime   Y Y JDBC驱动
    system Y Y   本地maven仓库之外的类库

    3.解决jar冲突

      1)第一声明优先原则

      2)路径近者优先原则

      3)直接排除法<exclusions>

    4.<dependencyManagement>锁定jar包依赖,防止作为其他项目jar时冲突,导致无法使用

    5.上传jar包到私服

    配置maven中settings.xml文件                                                                            项目中具体maven

     6.从私服下载jar包

    7.安装第三方jar包到本地仓库

    进入jar包所在目录 :mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37-SNAPSHOT -Dfile=fastjson-1.1.37-SNAPSHOT.jar   -Dpackaging=jar

    不进入jar包所在目录 :mvn install:install-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37-SNAPSHOT  -Dpackaging=jar -Dfile=C:fastjson-1.1.37-SNAPSHOT.jar   

    8.安装第三方jar包到私服

    进入jar包所在目录 :mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37-SNAPSHOT -Dpackaging=jar -Dfile=fastjson-1.1.37-SNAPSHOT.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

    不进入jar包所在目录 :mvn deploy:deploy-file -DgroupId=com.alibaba -DartifactId=fastjson -Dversion=1.1.37-SNAPSHOT  -Dpackaging=jar -Dfile=C:fastjson-1.1.37-SNAPSHOT.jar -Durl=http://localhost:8081/nexus/content/repositories/thirdparty/ -DrepositoryId=thirdparty

  • 相关阅读:
    知识图谱应急安全场景应用规划
    DataxWeb 设置运行错误
    Datax mysql 8.x elasticsearch 7.x 测试成功json样例
    testmysqltoelasticsearch76.json 未测试,仅参考
    testmysqltoelasticsearch75.json 未测试,仅参考
    testorcletoelasticsearch73.json 微测试,仅参考
    testmysqltoelasticsearch74.json 未测试,仅参考
    testmysqltoelasticsearch72.json 微测试,仅参考
    go可变参数
    Java 8 终于支持 Docker !
  • 原文地址:https://www.cnblogs.com/god-monk/p/10819313.html
Copyright © 2011-2022 走看看