payu-intrepos / payu-non-seamless-react

Non-Seamless SDK for React Native
5 stars 9 forks source link

A problem occurred evaluating project ':payu-non-seam-less-react'. > Plugin with id 'maven' not found. #19

Closed rajkumargaur91 closed 1 year ago

rajkumargaur91 commented 2 years ago

I am facing this issue with payu non seam less package from npm react native.

here is the code

// android/build.gradle

// based on:
//
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle
//   original location:
//   - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/build.gradle
//
// * https://github.com/facebook/react-native/blob/0.60-stable/template/android/app/build.gradle
//   original location:
//   - https://github.com/facebook/react-native/blob/0.58-stable/local-cli/templates/HelloWorld/android/app/build.gradle

def DEFAULT_COMPILE_SDK_VERSION = 29
def DEFAULT_BUILD_TOOLS_VERSION = '29.0.2'
def DEFAULT_MIN_SDK_VERSION = 21
def DEFAULT_TARGET_SDK_VERSION = 29

def safeExtGet(prop, fallback) {
    rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

apply plugin: 'com.android.library'
apply plugin: 'maven'

buildscript {

    // The Android Gradle plugin is only required when opening the android folder stand-alone.
    // This avoids unnecessary downloads and potential conflicts when the library is included as a
    // module dependency in an application project.
    // ref: https://docs.gradle.org/current/userguide/tutorial_using_tasks.html#sec:build_script_external_dependencies
    if (project == rootProject) {
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:7.0.0-alpha12'
        }
    }
}

apply plugin: 'com.android.library'
apply plugin: 'maven'

def getVersionFromPackageJson() {
    //  Read and parse package.json file from project root
    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

    // Return the version, you can get any value this way
    return packageJson.version
}

android {
    compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
    buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
    defaultConfig {
        minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
        targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
        versionCode 1
        versionName getVersionFromPackageJson()
        buildConfigField "String", "VERSION_NAME", "\"$versionName\""
    }
    lintOptions {
        abortOnError false
    }
}

repositories {
    // ref: https://www.baeldung.com/maven-local-repository
    mavenLocal()
    mavenCentral()
    maven {
        // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
        url "$rootDir/../node_modules/react-native/android"
    }
    maven { url "https://phonepe.bintray.com/PhonePeIntentSDK" }
    maven {
        // Android JSC is installed from npm
        url "$rootDir/../node_modules/jsc-android/dist"
    }
    flatDir {
        dirs 'libs'
    }
    google()
    jcenter()
}

dependencies {
    //noinspection GradleDynamicVersion
    implementation 'com.facebook.react:react-native:+'  // From node_modules
    implementation fileTree(include: ['*.aar'], dir: 'libs')
    implementation 'in.payu:payu-checkout-pro:1.3.2'
    implementation 'in.payu:payu-sdk:5.1.1'
    implementation 'in.payu:olamoney:1.0.1'
    implementation 'in.payu:payu-gpay:1.4.0'
    implementation 'in.payu:phonepe-intent:1.6.0'
    implementation 'org.jetbrains:annotations:16.0.2'
}

def configureReactNativePom(def pom) {
    def packageJson = new groovy.json.JsonSlurper().parseText(file('../package.json').text)

    pom.project {
        name packageJson.title
        artifactId packageJson.name
        version = packageJson.version
        group = "com.payubiz"
        description packageJson.description
//        url packageJson.repository.baseUrl

        licenses {
            license {
                name packageJson.license
                url packageJson.repository.baseUrl + '/blob/master/' + packageJson.licenseFilename
                distribution 'repo'
            }
        }

        developers {
            developer {
                id packageJson.author.username
                name packageJson.author.name
            }
        }
    }
}

afterEvaluate { project ->
    // some Gradle build hooks ref:
    // https://www.oreilly.com/library/view/gradle-beyond-the/9781449373801/ch03.html
    task androidJavadoc(type: Javadoc) {
        source = android.sourceSets.main.java.srcDirs
        classpath += files(android.bootClasspath)
        classpath += files(project.getConfigurations().getByName('compile').asList())
        include '**/*.java'
    }

    task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
        classifier = 'javadoc'
        from androidJavadoc.destinationDir
    }

    task androidSourcesJar(type: Jar) {
        classifier = 'sources'
        from android.sourceSets.main.java.srcDirs
        include '**/*.java'
    }

    android.libraryVariants.all { variant ->
        def name = variant.name.capitalize()
        def javaCompileTask = variant.getJavaCompile()

        task "jar${name}"(type: Jar, dependsOn: javaCompileTask) {
            from javaCompileTask.destinationDir
        }
    }

    artifacts {
        archives androidSourcesJar
        archives androidJavadocJar
    }

    task installArchives(type: Upload) {
        configuration = configurations.archives
        repositories.mavenDeployer {
            // Deploy to react-native-event-bridge/maven, ready to publish to npm
            repository url: "file://${projectDir}/../android/maven"
            configureReactNativePom pom
        }
    }
}

Build file 'D:\react-native\ctreact\node_modules\payu-non-seam-less-react\android\build.gradle' line: 23

A problem occurred evaluating project ':payu-non-seam-less-react'.

Plugin with id 'maven' not found.

rvuyyuru1 commented 2 years ago

same issues

rvuyyuru1 commented 2 years ago

any update ?

we are using latest react native 0.67.3 and react 17

Jananijann commented 2 years ago

Replace "apply plugin: 'maven'" with "apply plugin: 'maven-publish'"

faisalKhan-99 commented 2 years ago

after that @Jananijann , the error changed to --- A problem occurred configuring project ':payu-non-seam-less-react'. > Could not find method mavenDeployer() for arguments [build_6we3b62p0cp6z0cfepp01mbjj$_run_closure4$_closure17$_closure19@61e6fcc3] on repository container of type org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler. still not resolved.

mohitgargai commented 1 year ago

@AmitPayU @shahfaizalpayu we are facing this exact issue. How can we go about resolving it?

shahfaizalc commented 1 year ago

@mohitgargai this issue due to the gradle properties distribution url and buildtools version.

our current supported version is 6.5 and build tools version 4.1.3.

please write us to mobile.integration@payu.in . we will help you on resolving this issue.

shahfaizalc commented 1 year ago

@mohitgargai thanks for contacting us. Hope your issues are resolved

iamrohitagg commented 1 month ago

What is the solution for this error? I am getting the same at my end too.

shahfaizalc commented 1 month ago

@mohitgargai this issue due to the gradle properties distribution url and buildtools version.

our current supported version is 6.5 and build tools version 4.1.3.

please write us to mobile.integration@payu.in . we will help you on resolving this issue.

@iamrohitagg this issue due to the gradle properties distribution url and buildtools version.

our current supported version is 6.5 and build tools version 4.1.3.

please write us to mobile.integration@payu.in . we will help you on resolving this issue.