hanggrian / packaging-gradle-plugin

Start making native distributions for your JAR
http://hanggrian.com/packaging-gradle-plugin/
Apache License 2.0
19 stars 1 forks source link

Gradle successfully downloads the plugin but can’t apply it. #8

Open jonathanmarvens opened 5 years ago

jonathanmarvens commented 5 years ago

The following is the error logged by Gradle:

Could not apply requested plugin [id: 'com.hendraanggrian.packr-gradle-plugin', version: '0.1', artifact: 'com.hendraanggrian:packr-gradle-plugin:0.1'] as it does not provide a plugin with id 'com.hendraanggrian.packr-gradle-plugin'. This is caused by an incorrect plugin implementation. Please contact the plugin author(s).
> Plugin with id 'com.hendraanggrian.packr-gradle-plugin' not found.

The artifact is successfully retrieved from Bintray’s JCenter repository, so it seems to be a problem with the actual plugin implementation and/or configuration.

jonathanmarvens commented 5 years ago

By the way, the following is the relevant Gradle configuration:

build.gradle:

plugins({
  id('com.hendraanggrian.packr-gradle-plugin')
    .version('0.1')
})

settings.gradle:

pluginManagement({
  repositories({
    maven({
      content({
        includeGroup('com.badlogicgames.packr')
      })
      url('https://oss.sonatype.org/content/repositories/snapshots')
    })

    jcenter({
      content({
        includeGroup('com.hendraanggrian')
      })
    })
  })

  resolutionStrategy({
    eachPlugin({
      if (requested.id.namespace == 'com.hendraanggrian') {
        useModule("${requested.id.namespace}:${requested.id.name}:${requested.version}")
      }
    })
  })
})
jonathanmarvens commented 5 years ago

I managed to get the plugin to apply and show the relevant tasks by making the following updates to the Gradle configuration:

build.gradle:

@@ -1,4 +1,4 @@
 plugins({
-  id('com.hendraanggrian.packr-gradle-plugin')
+  id('com.hendraanggrian.packr')
     .version('0.1')
 })

settings.gradle:

@@ -17,7 +17,7 @@
   resolutionStrategy({
     eachPlugin({
       if (requested.id.namespace == 'com.hendraanggrian') {
-        useModule("${requested.id.namespace}:${requested.id.name}:${requested.version}")
+        useModule("${requested.id.namespace}:packr-gradle-plugin:${requested.version}")
       }
     })
   })

While the plugin applies with these updates (I haven’t actually ran the tasks though), I’d recommend updating the plugin configuration and artifact, so that this type of manual intervention isn’t necessary. It’d also be great to publish the plugin directly to the Gradle Plugin Portal to make the usage easier and more convenient (i.e., no repository configuration would be necessary with the default Gradle configuration).

Please feel free to close this issue.

Thank you.

hanggrian commented 5 years ago

By the way, the following is the relevant Gradle configuration:

build.gradle:

plugins({
  id('com.hendraanggrian.packr-gradle-plugin')
    .version('0.1')
})

settings.gradle:

pluginManagement({
  repositories({
    maven({
      content({
        includeGroup('com.badlogicgames.packr')
      })
      url('https://oss.sonatype.org/content/repositories/snapshots')
    })

    jcenter({
      content({
        includeGroup('com.hendraanggrian')
      })
    })
  })

  resolutionStrategy({
    eachPlugin({
      if (requested.id.namespace == 'com.hendraanggrian') {
        useModule("${requested.id.namespace}:${requested.id.name}:${requested.version}")
      }
    })
  })
})

Thank you for this, it seems like it belongs in README.

I managed to get the plugin to apply and show the relevant tasks by making the following updates to the Gradle configuration:

build.gradle:

@@ -1,4 +1,4 @@
 plugins({
-  id('com.hendraanggrian.packr-gradle-plugin')
+  id('com.hendraanggrian.packr')
     .version('0.1')
 })

settings.gradle:

@@ -17,7 +17,7 @@
   resolutionStrategy({
     eachPlugin({
       if (requested.id.namespace == 'com.hendraanggrian') {
-        useModule("${requested.id.namespace}:${requested.id.name}:${requested.version}")
+        useModule("${requested.id.namespace}:packr-gradle-plugin:${requested.version}")
       }
     })
   })

While the plugin applies with these updates (I haven’t actually ran the tasks though), I’d recommend updating the plugin configuration and artifact, so that this type of manual intervention isn’t necessary. It’d also be great to publish the plugin directly to the Gradle Plugin Portal to make the usage easier and more convenient (i.e., no repository configuration would be necessary with the default Gradle configuration).

Please feel free to close this issue.

Thank you.

As I'm quite new with Gradle plugin development, I'm not familiar with your Gradle configuration, which I assume is the newer and better way to declare repositories and dependencies. It's probably my fault, when the plugin was first created, it is only tested in Gradle Kotlin DSL environment. I will have to familiarize myself with this newer Gradle format before applying the configuration updates.

jonathanmarvens commented 5 years ago

@hendraanggrian No worries! Thank you for your work. If I had the time, I’d make some of the updates for you, but unfortunately, my time is limited at the moment 😞.