Unable to import package org.objectweb.asm

I am trying to compile other developer’s open source custom library.
I have compiled or find dependencies but it fails to build in gradle
which was failing to import java’s internal library package org.objectweb.asm
it’s a java internal library so it must be in tools.jar but build.properties it’s aleady importing java’s tools.jar and aleady applying plugin java so i have no idea

here it’s build.properties ( main part)

allprojects {
apply plugin: 'java'

group 'com.nemosw.spigot'
version '1.2.21'

sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
javadoc.options.encoding = 'UTF-8'

repositories {
    // junit
    mavenCentral()
    // nms spigot & mox
    mavenLocal()
}
}


project(':core') {
processResources {
    filesMatching('**/*.yml') {
        expand project.properties
    }
}

repositories {
    maven { url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
    maven { url = 'https://oss.sonatype.org/content/repositories/snapshots/' }
    flatDir { dirs 'libs' }
}

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT'
    compileOnly files(Jvm.current().toolsJar)
    compile 'com.nemosw.mox:mox-collections:1.0'
    compile 'com.nemosw.mox:mox-task:1.0'
    compile 'com.nemosw.mox:mox-math:1.0.2'
    compile 'com.nemosw.mox:mox-tools:1.1'
}
}

other part’s are can be found in here:
https://github.com/nemosrc/tap

also you need to fix some dependencies and compile he’s mox library(all of them)

https://github.com/nemosrc/mox-math

https://github.com/nemosrc/mox-tools

https://github.com/nemosrc/mox-collections

https://github.com/nemosrc/mox-task

and tons of error because of the failed library.

C:tapcoresrcmainjavacomnemoswspigottapeventASMEntityEventExecutor.java:6:
error: package org.objectweb.asm does not exist import
org.objectweb.asm.ClassWriter;
^

C:tapcoresrcmainjavacomnemoswspigottapeventASMEntityEventExecutor.java:7:
error: package org.objectweb.asm does not exist import
org.objectweb.asm.MethodVisitor;
^

C:tapcoresrcmainjavacomnemoswspigottapeventASMEntityEventExecutor.java:8:
error: package org.objectweb.asm does not exist import
org.objectweb.asm.Type;
^

C:tapcoresrcmainjavacomnemoswspigottapeventASMEntityEventExecutor.java:15:
error: package org.objectweb.asm does not exist import static
org.objectweb.asm.Opcodes.*;
^

C:tapcoresrcmainjavacomnemoswspigottapeventASMEventExecutor.java:9:
error: package org.objectweb.asm does not exist import
org.objectweb.asm.ClassWriter;

2
Leave a Reply

avatar
2 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
Jason
Guest

Why would you think that it’s a Java internal library?

The org.objectweb.asm package is part of the ASM library: https://asm.ow2.io/

You might want to add this to your Gradle build:
compile group: 'org.ow2.asm', name: 'asm', version: '7.1'

Jason
Guest

You can add dependency in dependencies block –

dependencies {
    compileOnly 'org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT'
    compileOnly files(Jvm.current().toolsJar)
    compile 'com.nemosw.mox:mox-collections:1.0'
    compile 'com.nemosw.mox:mox-task:1.0'
    compile 'com.nemosw.mox:mox-math:1.0.2'
    compile 'com.nemosw.mox:mox-tools:1.1'
    compile 'org.ow2.asm:asm:'7.1'
}

You can find more dependency from this site
https://mvnrepository.com/