Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't import AppSync gradle plugin, classpath issue #425

Closed
Odaym opened this issue Feb 2, 2024 · 1 comment
Closed

Can't import AppSync gradle plugin, classpath issue #425

Odaym opened this issue Feb 2, 2024 · 1 comment
Labels
good first issue Good for newcomers question General question

Comments

@Odaym
Copy link

Odaym commented Feb 2, 2024

State your question
So the way to import this plugin is explained using the old way with Gradle and classpath. Doing it the new way (Kotlin DSL and the plugins DSL) I cannot figure out how to get this plugin imported correctly.

I can however of course import the appsync sdk just fine com.amazonaws:aws-android-sdk-appsync:3.4.1 but just not the plugin.

Why? because I couldn't figure out what to do with the classpath step, I know that classpath is no longer used in the new gradle plugins system but what do I do with it do I just not use the plugin or what?

Provide code snippets (if applicable)

project's build.gradle.kts

plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
    ....
    alias(libs.plugins.appsync.gradle) apply false
}

app module's build.gradle.kts

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.google.kasp)
    alias(libs.plugins.hilt)
    ...
    alias(libs.plugins.appsync.gradle)
}

android {
    namespace = .............

dependencies {
    testImplementation(libs.junit)
    testImplementation(libs.coroutines.test)
    ....
    implementation(libs.appsync.client)

libs.versions.toml

[plugins]
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlinAndroid" }
......
appsync-gradle = { id = "com.amazonaws", version.ref = "3.4.1" }

settings.gradle.kts

pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
}

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
}

When I attempt to gradle sync and find this plugin, I get this result referring to my project's build.gradle.kts file:

Plugin [id: 'com.amazonaws', version: '3.4.1', apply: false] was not found in any of the following sources:

* Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'com.amazonaws', version: '3.4.1', apply: false] was not found in any of the following sources:

- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'com.amazonaws:com.amazonaws.gradle.plugin:3.4.1')
  Searched in the following repositories:
    Google
    MavenRepo
    Gradle Central Plugin Repository
    maven(https://plugins.gradle.org/m2/)

Now of course the README of this project does not say that the plugin is called com.amazonaws:com.amazonaws.gradle.plugin, but instead it's called com.amazonaws:aws-android-sdk-appsync-gradle-plugin, but then how do I get it to be named that way if with this new system I cannot use the group name (aws-android-sdk-appsync-gradle-plugin) for plugins and just use the group id (com.amazonaws)?

I've also searched through https://plugins.gradle.org/m2/ and through Gradle Plugin Portal and I couldn't find any packages starting with com and then amazonaws... so what do I do?

Thanks!

@Odaym
Copy link
Author

Odaym commented Feb 2, 2024

well, what I did was the following:

app module's build.gradle.kts

plugins {
    alias(libs.plugins.android.application)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.google.kasp)
    alias(libs.plugins.hilt)
    id("com.amazonaws.appsync")
}

project's build.gradle.kts

buildscript {
    dependencies {
        classpath("com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.4.1")
    }
}

plugins {
    alias(libs.plugins.android.application) apply false
    alias(libs.plugins.kotlin.android) apply false
    alias(libs.plugins.hilt) apply false
    alias(libs.plugins.detekt)
    alias(libs.plugins.serialization)
    alias(libs.plugins.google.kasp) apply false
}

and yea, that imported it correctly...sadge fix

@ankpshah ankpshah added question General question good first issue Good for newcomers labels Feb 5, 2024
@ankpshah ankpshah closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers question General question
Projects
None yet
Development

No branches or pull requests

2 participants