[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16981721#comment-16981721 ] Ross Bender commented on CB-9704: - I agree that it's unfortunate there's no built-in way to do this. Building on an [existing SO answer|https://stackoverflow.com/a/36210134], we're using a hook that will add a custom repository to any app/plugin gradle files: {code} const fs = require("fs"); const path = require("path"); const async = require("async"); module.exports = context => { "use strict"; const repoUrl = "http://nexus.corp.aal.au/content/groups/public-ad;; const gradleRepo = 'maven { url "' + repoUrl + '" }'; return new Promise((resolve, reject) => { const platformRoot = path.join(context.opts.projectRoot, "platforms/android"); const gradleFiles = findGradleFiles(platformRoot); async.each( gradleFiles, function(file, callback) { let fileContents = fs.readFileSync(file, "utf8"); let insertLocations = []; const myRegexp = /\brepositories\s*{(.*)$/gm; let match = myRegexp.exec(fileContents); while (match != null) { if (match[1].indexOf(repoUrl) < 0) { insertLocations.push(match.index + match[0].length); } match = myRegexp.exec(fileContents); } if (insertLocations.length > 0) { insertLocations.reverse(); // process locations end -> beginning to preserve indices insertLocations.forEach(location => { fileContents = fileContents.substr(0, location) + gradleRepo + fileContents.substr(location); }); fs.writeFileSync(file, fileContents, "utf8"); console.log("updated " + file + " to include repo " + repoUrl); } callback(); }, function(err) { if (err) { console.error("unable to update gradle files", err); reject(); } else { resolve(); } }, ); }); function findGradleFiles(dir) { let results = []; const list = fs.readdirSync(dir); list.forEach(fileName => { const filePath = path.join(dir, fileName); const stat = fs.statSync(filePath); if (stat && stat.isDirectory()) { // recurse into subdirectory results = results.concat(findGradleFiles(filePath)); } else if (path.extname(filePath) === ".gradle") { results.push(filePath); } }); return results; } }; {code} We then use this as a hook for our Android platform: {code} {code} Hopefully this will help others, or be a starting point for getting this built into Cordova natively. > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Ionic >Reporter: Ajay Gupta >Priority: Major > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16897532#comment-16897532 ] Lee Meador commented on CB-9704: Its a shame this issue has been sitting here for almost 4 years as it makes it difficult for Enterprise teams to use Cordova for their apps. Many Enterprises want to build their apps inside their data centers (using CI tools) or the desktop/laptop networks are limited as to where they can access. If a way was made to specify the alternative repositories (perhaps by URL) that would be used when building the build.gradle files, the various workarounds would not have to be reworked periodically when a new version comes out that needs another repo or a different repo. No init scripts that change per version. And no prebuild hook scripts to alter the build.gradle files that change per version. This sort of thing can be done with a magic environment variable (say CORDOVA_MAVEN_REPO_LIST) that contains a list of the repo or repos that should be used. Specify some URL like https://artifacts.mycompany.com/cordova-repo-group and set up a Nexus or Artifactory repo group to proxy out to the desired repos. Or specify multiple repo URLs with commas or spaces to delimit. Perhaps two environment variable should be used for the buildscript.repositories and the project repositories as they can be different. > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Ionic >Reporter: Ajay Gupta >Priority: Major > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v7.6.14#76016) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16865553#comment-16865553 ] Dario Telese commented on CB-9704: -- Hello, have you find a solution? > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Ionic >Reporter: Ajay Gupta >Priority: Major > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16326488#comment-16326488 ] Matt Steele commented on CB-9704: - [~ajaygupta0512] I'm running into a similar issue; are you still doing this? Newer versions of cordova-android moved away from mavenCentral() so my regex no longer works. Before I start making it more complex I want to see if there's any better options. I also published a question on StackOverflow: https://stackoverflow.com/questions/48267650/how-do-i-configure-cordova-android-to-use-an-internal-maven-registry-in-its-grad > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Ionic >Reporter: Ajay Gupta >Priority: Major > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v7.6.3#76005) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15853279#comment-15853279 ] Ajay Gupta commented on CB-9704: Can I get some progress on this issue? I don't yet see a fix version. This JIRA has been open for almost 18 months. > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Android, CordovaLib >Reporter: Ajay Gupta > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v6.3.15#6346) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15837770#comment-15837770 ] Julio commented on CB-9704: --- Hello, This feature request is in the roadmap to be develop? > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Android, CordovaLib >Reporter: Ajay Gupta > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15139751#comment-15139751 ] Joe Bowser commented on CB-9704: This is a feature request, since we don't currently support using a custom nexus repository for Android builds. > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: New Feature > Components: Android >Reporter: Ajay Gupta > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org
[jira] [Commented] (CB-9704) Apache Cordova 5 does not support using a custom nexus repository for android builds
[ https://issues.apache.org/jira/browse/CB-9704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=14936417#comment-14936417 ] Ajay Gupta commented on CB-9704: Is there any progress on this issue? > Apache Cordova 5 does not support using a custom nexus repository for android > builds > > > Key: CB-9704 > URL: https://issues.apache.org/jira/browse/CB-9704 > Project: Apache Cordova > Issue Type: Bug > Components: CLI >Reporter: Ajay Gupta > > We are using AngularJS and Ionic for writing a mobile application supported > both on IOS and Android. When we do "ionic build android --release", it > creates a build.gradle file in both platforms/android directory and > platforms/android/CordovaLib directory. Both of these files point to > mavenCentral() as the repository which tries to download artifacts directly > from the maven central repo (http://repo1.maven.org/maven2). We are trying > to build our mobile apps as part of a Jenkins build behind company proxy and > would like to have gradle reach out to our internal Maven nexus repository > instead of reaching out to the central maven repository directly. Our > internal Neux repository would then proxy everything to the maven central > repository. > We cannot hand edit the build.gradle file as it is a generated file and so > any custom changes made to it would be lost in the next build. Cordova 5 > supports adding custom extensions using build-extras.gradle file but it does > not support overriding repositories. > As a workaround, we have defined a pre-build Cordova hook to search replace > mavenCentral() references to our local maven repository before doing an > android build. It works but is a unnecessary workaround and not a very clean > solution. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org