wpilibsuite / gradle-jni

Gradle plugin for ease of creating JNI libraries.
14 stars 5 forks source link

Error building project in gradle 4.8 #8

Closed yujinwunz closed 6 years ago

yujinwunz commented 6 years ago

I started a project and got this:

$ ./gradlew build --stacktrace

FAILURE: Build failed with an exception.

* What went wrong:
org.gradle.api.tasks.TaskContainer.register(Ljava/lang/String;Ljava/lang/Class;)Lorg/gradle/api/tasks/TaskProvider;

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
java.lang.NoSuchMethodError: org.gradle.api.tasks.TaskContainer.register(Ljava/lang/String;Ljava/lang/Class;)Lorg/gradle/api/tasks/TaskProvider;
        at edu.wpi.first.jni.GradleJni.apply(GradleJni.java:10)
        at edu.wpi.first.jni.GradleJni.apply(GradleJni.java:7)
        at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
        at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
        at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:163)
        at org.gradle.api.internal.plugins.DefaultPluginManager.access$200(DefaultPluginManager.java:46)
        at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:251)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:317)
        at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:309)

Here's my build.gradle:

    id 'java'
    id 'edu.wpi.first.GradleJni' version '0.3.0'
}

apply plugin: 'cpp'

model {
    components {
        minesolver (JniNativeLibrarySpec) { // Use JniNativeLibrarySpec to get a JNI library
            enableCheckTask true // Set to true to enable a JNI check task. This will search all generated JNI headers, and check to ensure their symbols exist in the native library
            javaCompileTasks << compileJava // set javaCompileTasks to any java compile tasks that contain your JNI classes. It is a list of tasks
            jniCrossCompileOptions << JniCrossCompileOptions('athena')
            // See below for more JniCrossCompileOptions
        }
    }
}

version '1.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.12'
}

What's going on?

ThadHouse commented 6 years ago

It requires gradle 4.9.