[JIRA] (JENKINS-48398) [Ionic + Cordova + Gradle + Android + Jenkins on Windows] Build failed with the pipe is being closed

4 views
Skip to first unread message

dariotelese@hotmail.it (JIRA)

unread,
Jun 17, 2019, 11:47:02 AM6/17/19
to jenkinsc...@googlegroups.com
Dario Telese commented on Bug JENKINS-48398
 
Re: [Ionic + Cordova + Gradle + Android + Jenkins on Windows] Build failed with the pipe is being closed

Hello,

this solution is great!! 

Look:
 https://stackoverflow.com/questions/51934907/gradlew-change-jcenter-url-for-react-native-build

 
In .gradle Jenkins directory, create init.gradle file and insert this code:

 

 

apply plugin: EnterpriseRepositoryPlugin


class EnterpriseRepositoryPlugin implements Plugin<Gradle> {


private static String NEXUS_REPO = "https://mynexus/repository/mymavenrepo/"
private static String GOOGLE_REPOSITORY_URL = "https://dl.google.com/dl/android/maven2/"
private static String JCENTER_REPOSITORY_URL = "https://jcenter.bintray.com/"
private static String MAVEN_REPOSITORY_URL = "https://repo.maven.apache.org/maven2/"


void apply(Gradle gradle) {
// ONLY USE NEXUS REPO FOR DEPENDENCIES
    gradle.allprojects { project ->
           project.repositories {
           // Remove all repositories not pointing to the NEXUS repository url
                  all { ArtifactRepository repo ->
                      if ((repo instanceof MavenArtifactRepository)){
                           if ((repo.url.toString() == GOOGLE_REPOSITORY_URL) ||                  (repo.url.toString() == JCENTER_REPOSITORY_URL) || (repo.url.toString() == MAVEN_REPOSITORY_URL) ) {
project.logger.lifecycle "Repository ${repo.name} removed. Only NEXUS REPOSITORY is allowed"
remove repo
}
}
}
// add the NEXUS repository
maven {
name "NEXUS_REPO"
url NEXUS_REPO
}
}
}
}
}

 

Customize for your case and enjoy!!

Bye

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

dariotelese@hotmail.it (JIRA)

unread,
Jun 20, 2019, 3:44:01 AM6/20/19
to jenkinsc...@googlegroups.com
Dario Telese edited a comment on Bug JENKINS-48398
In .gradle Jenkins directory, create *init.gradle* file and insert this code:

 

 
{code:java}
gradle.projectsLoaded {
rootProject.allprojects {
repositories {
maven { url "https://mycompany/nexus/repository/..." }
}
buildscript {
repositories {
maven { url "https://mycompany/nexus/repository/..." }
}
}
}
}


apply plugin: EnterpriseRepositoryPlugin


class EnterpriseRepositoryPlugin implements Plugin<Gradle> {


private static String NEXUS_REPO = "https:// mynexus mycompany / nexus/ repository/ mymavenrepo/ .... "

private static String GOOGLE_REPOSITORY_URL = "https://dl.google.com/dl/android/maven2/"
private static String JCENTER_REPOSITORY_URL = "https://jcenter.bintray.com/"
private static String MAVEN_REPOSITORY_URL = "https://repo.maven.apache.org/maven2/"


void apply(Gradle gradle) {
// ONLY USE NEXUS REPO FOR DEPENDENCIES
    gradle.allprojects { project ->
           project.repositories {
           // Remove all repositories not pointing to the NEXUS repository url
                  all { ArtifactRepository repo ->
                     if ((repo instanceof MavenArtifactRepository) && repo.url.toString( ) != NEXUS_REPO) {
                     if ((repo.url.toString() == GOOGLE_REPOSITORY_URL) ||

                  (repo.url.toString() == JCENTER_REPOSITORY_URL) ||
(repo.url.toString() == MAVEN_REPOSITORY_URL) )
{
project.logger.lifecycle "Repository ${repo.name} removed. Only NEXUS REPOSITORY is allowed"
remove repo
}
}
}
// add the NEXUS repository
maven {
name "NEXUS_REPO"
url NEXUS_REPO
}
}
}
}
}
{code}

 

Customize for your case and enjoy!!

Bye
Reply all
Reply to author
Forward
0 new messages