Kotlin Capsule Gradle Error

Jonathan Beaudoin

I'm getting an error when trying to create a capsule using Gradle.

Failed to find Premain-Class manifest attribute in 

E:\Dropbox\Projects\Kotlin\Games\CSGO\Charlatano\build\libs\capsule.jar
Error occurred during initialization of VM
agent library failed to init: instrument
CAPSULE: Client connection failed.
CAPSULE EXCEPTION: Accept timed out while processing null null: null (for stack trace, run with -Dcapsule.log=verbose)
Press any key to continue . . .

Here is my build.script

buildscript {
    ext.kotlin_version = '1.1-M01'
    ext.jna_version = '4.3.0-SNAPSHOT'
    ext.quasar_version = '0.7.6'
    ext.gdxVersion = '1.9.4'

    repositories {
        mavenCentral()
        maven { url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' }
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'

group 'com.charlatano'
version '0.4.3'

mainClassName = 'com.charlatano.Charlatano'

sourceCompatibility = JavaVersion.VERSION_1_8

repositories {
    mavenCentral()
    maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
    maven { url 'https://dl.bintray.com/kotlin/kotlin-eap-1.1' }
}

configurations {
    quasar
    capsule
}

dependencies {
    compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlin_version

    compile group: 'net.java.dev.jna', name: 'jna', version: jna_version
    compile group: 'net.java.dev.jna', name: 'jna-platform', version: jna_version

    compile group: 'org.jire.arrowhead', name: 'arrowhead', version: '1.2.1'

    capsule group: 'co.paralleluniverse', name: 'capsule', version: '1.0.3'
    quasar group: 'co.paralleluniverse', name: 'quasar-core', version: quasar_version

    compile group: 'co.paralleluniverse', name: 'quasar-core', version: quasar_version
    compile group: 'co.paralleluniverse', name: 'quasar-actors', version: quasar_version
    compile group: 'co.paralleluniverse', name: 'quasar-kotlin', version: quasar_version

    compile "com.badlogicgames.gdx:gdx:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"

    compile "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
    compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
    compile "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-desktop"
}

task capsule(type: Jar, dependsOn: jar) {
    archiveName = "capsule.jar"
    from jar // embed our application jar
    from { configurations.runtime } // embed dependencies

    from(configurations.capsule.collect { zipTree(it) }) { include 'Capsule.class' } // we just need the single Capsule class

    manifest {
        attributes(
                'Main-Class'  :    'Capsule',
                'Application-Class'   : mainClassName,
                'Extract-Capsule' : 'false', // no need to extract the capsule
                'Min-Java-Version' : '1.8.0',
                'JVM-Args' : run.jvmArgs.join(' '),
                'System-Properties' : run.systemProperties.collect { k,v -> "$k=$v" }.join(' '),
                'Java-Agents' : configurations.quasar.iterator().next().getName()
        )
    }
}

run {
    jvmArgs "-javaagent:${configurations.quasar.iterator().next()}"
}

Here are the jar files it generates. https://dl.dropboxusercontent.com/u/91292881/ShareX/2016/09/libs.zip

Please tell me what is wrong, thanks!

piotrek1543

It seems that MANIFEST.md in capsule is broken and it misses a Premain-Class attribute like below:

Premain-Class: org.eclipse.package.ObjectSizeFetcher

Your's capsule manifest file should look like:

Manifest-Version: 1.0
Created-By: 1.5.0_18 (Sun Microsystems Inc.)
Premain-Class: org.eclipse.package.ObjectSizeFetcher

Check similar issue to find more: "Failed to load Premain-Class manifest attribute" while trying to get the size of an object using java agent

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Gradle Compilation Error with Kotlin DSL configuring Java Spec

From Dev

Fatal error: Class 'Illuminate\Database\Capsule\Manager' not found

From Dev

Parse error when run illuminate/database/capsule with bootEloquent() in PHP

From Java

Kotlin compile "ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher." but no kotlin_version in build.gradle?

From Java

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher

From Dev

ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher

From Dev

Capsule Exception

From Dev

Kotlin: Incremental compilation with Gradle

From Dev

Setup kotlin project with gradle

From Dev

Kotlin Gradle issue

From Dev

Configuring Gradle with Kotlin

From Dev

Kotlin Gradle issue

From Dev

Error in gradle

From Dev

I am facing this error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

From Dev

I am facing this error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

From Dev

python/cython compiling pyx: fatal error: capsule.h: No such file or directory

From Dev

TreeWalker checks not working with Kotlin/Gradle?

From Dev

Include scripts with Gradle Kotlin DSL

From Dev

TreeWalker checks not working with Kotlin/Gradle?

From Dev

Corda template kotlin gradle subproject

From Dev

Error running gradle build

From Dev

Gradle Artifactory plugin error

From Dev

Strange Gradle IntelliJ error

From Dev

gradle dependency error in android

From Dev

Gradle build finished with error

From Dev

Android Gradle Build Error

From Dev

build apk with gradle error

From Dev

Migrate project to gradle error

From Dev

schemagen gradle build error

Related Related

  1. 1

    Gradle Compilation Error with Kotlin DSL configuring Java Spec

  2. 2

    Fatal error: Class 'Illuminate\Database\Capsule\Manager' not found

  3. 3

    Parse error when run illuminate/database/capsule with bootEloquent() in PHP

  4. 4

    Kotlin compile "ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher." but no kotlin_version in build.gradle?

  5. 5

    ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher

  6. 6

    ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher

  7. 7

    Capsule Exception

  8. 8

    Kotlin: Incremental compilation with Gradle

  9. 9

    Setup kotlin project with gradle

  10. 10

    Kotlin Gradle issue

  11. 11

    Configuring Gradle with Kotlin

  12. 12

    Kotlin Gradle issue

  13. 13

    Error in gradle

  14. 14

    I am facing this error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

  15. 15

    I am facing this error A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution

  16. 16

    python/cython compiling pyx: fatal error: capsule.h: No such file or directory

  17. 17

    TreeWalker checks not working with Kotlin/Gradle?

  18. 18

    Include scripts with Gradle Kotlin DSL

  19. 19

    TreeWalker checks not working with Kotlin/Gradle?

  20. 20

    Corda template kotlin gradle subproject

  21. 21

    Error running gradle build

  22. 22

    Gradle Artifactory plugin error

  23. 23

    Strange Gradle IntelliJ error

  24. 24

    gradle dependency error in android

  25. 25

    Gradle build finished with error

  26. 26

    Android Gradle Build Error

  27. 27

    build apk with gradle error

  28. 28

    Migrate project to gradle error

  29. 29

    schemagen gradle build error

HotTag

Archive