Reading a maven settings.xml when building with gradle?

前端 未结 6 2056
孤独总比滥情好
孤独总比滥情好 2021-01-30 18:21

I have a maven settings.xml located in:

 /home/u123/.m2/settings.xml

where I specify a remote maven repository:



        
6条回答
  •  日久生厌
    2021-01-30 18:37

    gradle-maven-settings-plugin works for me (at least in my Windows environment)

    One should add

    buildscript {
        repositories {
            maven {
                url "https://plugins.gradle.org/m2/"
            }
        }
    }
    
    plugins {
        id 'net.linguica.maven-settings' version '0.5'
    }
    

    to the build.gradle and then can add repository like this:

    repositories {
        maven {
            name = 'myRepo' // should match myRepo of appropriate  in Maven's settings.xml
            url = 'https://intranet.foo.org/repo'
        }
    }
    

    which will use myRepo credentials from the Maven's settings.xml to access the https://intranet.foo.org/repo repository

提交回复
热议问题