gradle init --type pom
gradle/wrapper/gradle-wrapper.properties
in the project:# Tencent Cloud MirrordistributionUrl=https\\://mirrors.cloud.tencent.com/gradle/gradle-6.8.1-bin.zip# Default outside China# distributionUrl=https\\://services.gradle.org/distributions/gradle-6.8.1-bin.zip
~/.gradle/init.gradle
as follows:def repoConfig = {all { ArtifactRepository repo ->if (repo instanceof MavenArtifactRepository) {def url = repo.url.toString()if (url.contains('repo1.maven.org/maven2')|| url.contains('jcenter.bintray.com')|| url.contains('maven.google.com')|| url.contains('plugins.gradle.org/m2')|| url.contains('repo.spring.io/libs-milestone')|| url.contains('repo.spring.io/plugins-release')|| url.contains('repo.grails.org/grails/core')|| url.contains('repository.apache.org/snapshots')) {println "gradle init: [buildscript.repositories] (${repo.name}: ${repo.url}) removed"remove repo}}}// Tencent Cloud aggregate maven mirror: central, jcenter, google, and gradle-pluginmaven { url 'https://mirrors.cloud.tencent.com/nexus/repository/maven-public/' }maven { url 'https://maven.aliyun.com/repository/central' }maven { url 'https://maven.aliyun.com/repository/jcenter' }maven { url 'https://maven.aliyun.com/repository/google' }maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }maven { url 'https://maven.aliyun.com/repository/spring' }maven { url 'https://maven.aliyun.com/repository/spring-plugin' }maven { url 'https://maven.aliyun.com/repository/grails-core' }maven { url 'https://maven.aliyun.com/repository/apache-snapshots' }}allprojects {buildscript {repositories repoConfig}repositories repoConfig}
gradle.properties
file in the same directory as build.gradle
:codingArtifactsMavenUrl=https://codes-farm-maven.pkg.coding.net/repository/share/build/codingArtifactsUsername=Not requiredcodingArtifactsPassword=Not required
repositories {maven {url codingArtifactsMavenUrlcredentials {username = codingArtifactsUsernamepassword = codingArtifactsPassword}}}dependencies {implementation 'com.tencent:cloudpay:1.6'implementation '[GROUP_ID]:[ARTIFACT_ID]:[VERSION]'}
./gradlew build -Dorg.gradle.project.codingArtifactsUsername=foo -Dorg.gradle.project.codingArtifactsPassword=bar
pipeline {agent anystages {stage('Check out') {steps {checkout([$class: 'GitSCM', branches: [[name: env.GIT_BUILD_REF]],userRemoteConfigs: [[url: env.GIT_REPO_URL, credentialsId: env.CREDENTIALS_ID]]])}}stage('Compile') {steps {sh "./gradlew build -Dorg.gradle.project.codingArtifactsUsername=$CODING_ARTIFACTS_USERNAME -Dorg.gradle.project.codingArtifactsPassword=$CODING_ARTIFACTS_PASSWORD"}}}}
Was this page helpful?