0

I'm trying to use snapcraft to build a snap of a Java based gradle project, but coming up short whenever any Gradle plugins are used - whenever it tries to access them, I get something akin to the following error:

* What went wrong:
Error resolving plugin [id: 'com.gradle.build-scan', version: '1.14']
> Could not GET     'https://plugins.gradle.org/api/gradle/2.10/plugin/use/com.gradle.build-scan/1.14'.
   > plugins.gradle.org: Name or service not known

It seems like plugins.gradle.org is somehow being blocked, so my initial reaction was that it probably needed to be whitelisted - but I can't see any options for doing so.

Relevant section of the snapcraft yaml file is as follows:

parts:
  quelea:
      after: [desktop-glib-only]
      plugin: gradle
      source: .
      build: |
    export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64"
    gradle -Dnightly=true -Dversionsuffix=CI-UNSTABLE clean dist
  install: |
    unzip dist/quelea-snap.zip -d $SNAPCRAFT_PART_INSTALL/
  build-packages:
    - unzip
    - openjdk-8-jdk
Michael Berry
  • 70,193
  • 21
  • 157
  • 216

1 Answers1

0

For self-reference and for anyone else having the issue, it turns out I was following an incorrect example - changing the above to use the "proper" syntax for the gradle plugin (as below) seems to work just fine:

parts:
  quelea:
    after: [desktop-glib-only]
    plugin: gradle
    source: .
    stage-packages: [default-jre]
    gradle-options: [-Dnightly=true, -Dversionsuffix=CI-UNSTABLE, clean, jar]
    gradle-output-dir: 'build'

It turns out I was following an incorrect guide previously.

Michael Berry
  • 70,193
  • 21
  • 157
  • 216