zoukankan      html  css  js  c++  java
  • gradle配置maven仓库

    Maven配置

    • 在gradle(kts)中配置maven:

      build.gradle.kts

    //仓库配置
    repositories {
        //mavenLocal { setUrl("file://${project.rootDir}/lib") }
        //首先去本地仓库找
        mavenLocal()
        //然后去阿里仓库找
        // build.gradle:
        // maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
    
        // build.gradle.kts:
        maven { url = uri("https://repo.spring.io/release") }
        maven {
            isAllowInsecureProtocol = true
            setUrl("http://maven.aliyun.com/nexus/content/groups/public/")
        }
        maven {
            isAllowInsecureProtocol = true
            url = uri("https://maven.aliyun.com/repository/public") }
        maven {
            isAllowInsecureProtocol = true
            url = uri("https://maven.aliyun.com/repository/google") }
        maven {
            isAllowInsecureProtocol = true
            url = uri("https://maven.aliyun.com/repository/gradle-plugin") }
        maven {
            isAllowInsecureProtocol = true
            url = uri("https://maven.aliyun.com/repository/spring-plugin") }
        maven {
            isAllowInsecureProtocol = true
            url = uri("https://maven.aliyun.com/repository/apache-snapshots") }
        maven {
            isAllowInsecureProtocol = true
            url = uri("http://oss.jfrog.org/artifactory/oss-snapshot-local/") }
        google()
        jcenter()
        //最后从maven中央仓库找
        mavenCentral()
    }
    
    • 在gradle(groovy)中配置maven:

      build.gradle

    //仓库配置
    repositories {
        //mavenLocal { setUrl("file://${project.rootDir}/lib") }
        //首先去本地仓库找
        mavenLocal()
        //然后去阿里仓库找
        // build.gradle.kts:
        //maven {
        //    isAllowInsecureProtocol = true
        //    setUrl("http://maven.aliyun.com/nexus/content/groups/public/")
        //}
    
        // build.gradle:
        maven { 
            setAllowInsecureProtocol(true)
            url "https://repo.spring.io/release" 
        }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "http://maven.aliyun.com/nexus/content/groups/public/"
        }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "https://maven.aliyun.com/repository/public"
        }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "https://maven.aliyun.com/repository/google" }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "https://maven.aliyun.com/repository/gradle-plugin" }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "https://maven.aliyun.com/repository/spring-plugin" }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "https://maven.aliyun.com/repository/apache-snapshots" }
        maven {
            //isAllowInsecureProtocol = true
            setAllowInsecureProtocol(true)
            url "http://oss.jfrog.org/artifactory/oss-snapshot-local/" }
        google()
        jcenter()
        //最后从maven中央仓库找
        mavenCentral()
    }
    

    IDEA配置代码模板

    1. 打开配置(settigs/preference)

    2. 搜索live(找到live template)

    3. 找到kotlin、gradle,分别做如下配置
      maven代码模板

    4. 配置完毕后,在编辑器中输入“mreps”,弹出提示,回车(Enter)。
      使用示例

  • 相关阅读:
    Mybatis 学习过程中出现空指针异常的错误【已解决】
    IntelliJ IDEA的常用设置及快捷键
    The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone错误的解决办法【已解决】
    IntelliJ IDEA安装教程及使用方法
    OA项目笔记
    Linux常用命令大全(四)
    Linux常用命令大全(三)
    Linux常用命令大全(二)
    Linux常用命令大全(一)
    Apache配置默认首页
  • 原文地址:https://www.cnblogs.com/langkyeSir/p/15174846.html
Copyright © 2011-2022 走看看