You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/02/18 00:05:23 UTC

[GitHub] [cordova-android] PayBas opened a new issue #1165: `cordova build` fails since `9.0.0` due to non-overridable jcenter dependency in script plugin

PayBas opened a new issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165


   # Bug Report
   
   ## Problem
   Since cordova-android `9.0.0` it is impossible for us to build our projects without having to edit the output of the `cordova create` stage. This is due to newly introduced dependencies in the `CordovaLib/cordova.gradle` script plugin, which cannot be overwritten using regular means (such as an `init.gradle` script). This means that dependency resolution will _always_ default to `jcenter()`, which requires an internet connection, which we don't have for good reason.
   
   ### What is expected to happen?
   `cordova build` should be possible without an open internet connection.
   
   ### What does actually happen?
   ```
   FAILURE: Build failed with an exception.
   
   * Where:
   Build file '/home/jenkins/workspace/master-b21920/frontend/dist/mobile/platforms/android/app/build.gradle' line: 28
   
   * What went wrong:
   A problem occurred evaluating project ':app'.
   > Could not resolve all artifacts for configuration 'classpath'.
      > Could not resolve com.g00fy2:versioncompare:1.3.4.
        Required by:
            unspecified:unspecified:unspecified
         > Could not resolve com.g00fy2:versioncompare:1.3.4.
            > Could not get resource 'https://jcenter.bintray.com/com/g00fy2/versioncompare/1.3.4/versioncompare-1.3.4.pom'.
               > Could not GET 'https://jcenter.bintray.com/com/g00fy2/versioncompare/1.3.4/versioncompare-1.3.4.pom'.
                  > jcenter.bintray.com: Name or service not known
   ```
   
   ## Information
   The `CordovaLib/cordova.gradle` script plugin is called here: https://github.com/apache/cordova-android/blob/9.0.0/bin/templates/project/app/build.gradle#L28
   
   Since cordova-android `9.0.0` this script plugin contains newly introduced dependencies (and repository definitions). See https://github.com/apache/cordova-android/blob/9.0.0/framework/cordova.gradle#L197-L205
   
   I'm not a Gralde expert, but after about 2 days of reading and experimenting, I am convinced that "script plugins" do _not_ receive the same treatment as projects. They can _not_ be affected by regular means (from an `init.gradle` script for instance), such as:
   ```
   allprojects {
       buildscript.repositories ...
       repositories ...
   }
   ```
   Probably related to:
   - https://github.com/gradle/gradle/issues/1038
   - https://discuss.gradle.org/t/gradle-properties-are-not-available-when-applying-external-script-in-buildscript/8678
   - https://stackoverflow.com/questions/37285413/how-can-the-gradle-plugin-repository-be-changed#comment100408703_53269116
   
   We rely on this _heavily_, due to our workstations and build-servers _not_ having any direct internet-connections.
   
   To give you some idea. This is the `/home/jenkins/.gradle/init.gradle` file we use on our build servers:
   ```
   apply plugin: CorpGradleRepositoryPlugin
   
   class CorpGradleRepositoryPlugin implements Plugin<Gradle> {
   
       final Closure RemoveUnapprovedRepos = { thing ->
           // Remove all repositories not pointing to *.internal.corp urls
           all { ArtifactRepository repo ->
               if (repo instanceof MavenArtifactRepository
                       && !repo.url.toString().contains("internal.corp")
                       && !repo.url.toString().contains("m2repository")) {
                   remove repo
               }
           }
       }
   
       final Closure ApprovedRepos = {
           maven {
               url "https://nexus.internal.corp/nexus/repository/maven-public"
           }
           jcenter {
               url "https://nexus.internal.corp/nexus/repository/jcenter"
           }
       }
   
       void apply(Gradle gradle) {
           gradle.allprojects { project ->
               project.buildscript.repositories RemoveUnapprovedRepos
               project.buildscript.repositories ApprovedRepos
               project.repositories RemoveUnapprovedRepos
               project.repositories ApprovedRepos
           }
           gradle.settingsEvaluated { settings ->
               settings.pluginManagement {
                   repositories RemoveUnapprovedRepos
                   repositories ApprovedRepos
               }
           }
       }
   }
   ```
   
   ### Command or Code
   `cordova build` + but using your own repositories + no internet = fail
   
   ### Environment, Platform, Device
   Fedora 33, RHEL 8 and MacOS
   
   ### Version information
   Cordova CLI 9.0.0
   Cordova Android 9.0.0
   Android SDK 29
   
   ## Checklist
   - [x] I searched for existing GitHub issues
   - [x] I updated all Cordova tooling to most recent version
   - [x] I included all the necessary information above
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] mattdsteele commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
mattdsteele commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-804438824


   As info, `version-compare@1.4.0` is now available in Maven Central, which would let us move away from jcenter. The GAV has changed, see the notes here https://github.com/G00fY2/version-compare/releases/tag/1.4.0
   
   I can open a separate ticket if you'd like.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-802393331


   I'm not all that familiar with Gradle, but it seems like "script plugins" aren't processed by Gradle in the traditional manner (hence the need for my workaround).
   
   Since the plugin is included via `apply from: '../CordovaLib/cordova.gradle'`, isn't it possible to simply omit the entire `repositories { jcenter() }` block from `../CordovaLib/cordova.gradle`?
   
   Won't it simply fall back to using the repository settings from the parent/caller (which _is_ processed in the traditional manner)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-800685143


   > @PayBas - Does your internal nexus proxy jcenter entirely, or did you just upload `versioncompare` specifically into your internal Nexus?
   It's a proxy.
   > Also, is your workaround in a Cordova hook?
   Technically no. It's in a wrapper script which does various preparation steps before calling the various `cordova xxx` commands.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-781191115


   Our current workaround is to perform an extra step in our scripting _after_ `cordova create` but _before_ `cordova build`:
   ```
   shelljs.sed('-i', 'jcenter\\(\\)', 'jcenter { url "https://nexus.internal.corp/repository/jcenter" }', `path/to/platforms/android/CordovaLib/cordova.gradle`);
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] mattdsteele edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
mattdsteele edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-804438824


   As info, `versioncompare@1.4.0` is now available in Maven Central, which would let us move away from jcenter.
   
   The GAV has changed, see the notes here https://github.com/G00fY2/version-compare/releases/tag/1.4.0
   
   I can open a separate ticket (or a Pull Request) if you'd like.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] mattdsteele commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
mattdsteele commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-796356905


   Also related, as jcenter will be shutting down: https://github.com/apache/cordova-android/issues/1160
   
   @PayBas - Does your internal nexus proxy jcenter entirely, or did you just upload `versioncompare` specifically into your internal Nexus?
   Also, is your workaround in a Cordova hook?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-800685143


   > @PayBas - Does your internal nexus proxy jcenter entirely, or did you just upload `versioncompare` specifically into your internal Nexus?
   
   It's a proxy.
   
   > Also, is your workaround in a Cordova hook?
   
   Technically no. It's in a wrapper script which does various preparation steps before calling the various `cordova xxx` commands.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-781191115


   Our current workaround is to perform an extra step in our scripting _after_ `cordova create` but _before_ `cordova build`:
   ```
   shelljs.sed('-i', 'jcenter\\(\\)', 'jcenter { url "https://nexus.internal.corp/repository/jcenter" }', 'path/to/platforms/android/CordovaLib/cordova.gradle');
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-800685143


   @mattdsteele
   
   > @PayBas - Does your internal nexus proxy jcenter entirely, or did you just upload `versioncompare` specifically into your internal Nexus?
   
   It's a proxy.
   
   > Also, is your workaround in a Cordova hook?
   
   Technically no. It's in a wrapper script which does various preparation steps before calling the various `cordova xxx` commands.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-802393331


   I'm not all that familiar with Gradle, but it seems like "script plugins" aren't processed by Gradle in the traditional manner (hence the need for my workaround).
   
   Since the plugin is included via `apply from: '../CordovaLib/cordova.gradle'`, isn't it possible to simply omit the entire `repositories { jcenter() }` block from `../CordovaLib/cordova.gradle`?
   Won't it simply fall back to using the repository settings from the parent (which _is_ processed in the traditional manner)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] mattdsteele commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
mattdsteele commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-796765925


   I've also pinged the `versioncompare` maintainers to publish somewhere besides jcenter: https://github.com/G00fY2/version-compare/issues/11


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] erisu commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
erisu commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-883843955


   This should have been resolved in Cordova-Android 10.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] erisu closed issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
erisu closed issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] mattdsteele edited a comment on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
mattdsteele edited a comment on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-804438824


   As info, `version-compare@1.4.0` is now available in Maven Central, which would let us move away from jcenter. The GAV has changed, see the notes here https://github.com/G00fY2/version-compare/releases/tag/1.4.0
   
   I can open a separate ticket (or a Pull Request) if you'd like.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] brodybits commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
brodybits commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-800688802


   I think removing jcenter from cordova-android would be a breaking change
   and would have to wait until the next major release.
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] PayBas commented on issue #1165: `cordova build` fails since 9.0.0 due to non-overridable jcenter dependency in script plugin

Posted by GitBox <gi...@apache.org>.
PayBas commented on issue #1165:
URL: https://github.com/apache/cordova-android/issues/1165#issuecomment-802393331


   I'm not all that familiar with Gradle, but it seems like "script plugins" aren't processed by Gradle in the traditional manner (hence the need for my workaround).
   
   Since the plugin is included via `apply from: '../CordovaLib/cordova.gradle'`, isn't it possible to simply omit the entire `repositories { jcenter() }` block from '../CordovaLib/cordova.gradle'?
   Won't it simply fall back to using the repository settings from the parent (which _is_ processed in the traditional manner)?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org