jbang icon indicating copy to clipboard operation
jbang copied to clipboard

jbang unable to find artifact org.graalvm.polyglot:js-community:jar:24.1.2 in maven central

Open 0mega28 opened this issue 9 months ago • 1 comments

Describe the bug jbang is unable to download the js-community jar from maven central.

To Reproduce Here is the code, just do jbang Script.java

///usr/bin/env jbang "$0" "$@" ; exit $?

//DEPS org.graalvm.polyglot:polyglot:24.1.2
//DEPS org.graalvm.polyglot:js-community:24.1.2

import org.graalvm.polyglot.Context;

public class Script {
    public static void main(String[] args) {
        System.out.println(Context.newBuilder("js").build());
    }
}

Expected behavior Jbang should be able to run the code

JBang version [jbang] [0:179] jbang version 0.124.0 Cache: /Users/sakgugup/.jbang/cache Config: /Users/sakgugup/.jbang Repository: /Users/sakgugup/.m2/repository Java: /Library/Java/JavaVirtualMachines/graalvm-jdk-21/Contents/Home [21.0.6] OS: mac Arch: aarch64 Shell: bash 0.124.0

Additional context Getting the following error

[jbang] Resolving dependencies...
[jbang]    org.graalvm.polyglot:polyglot:24.1.2
[jbang]    org.graalvm.polyglot:js-community:24.1.2
[jbang] [ERROR] Could not resolve dependencies: The following artifacts could not be resolved: org.graalvm.polyglot:js-community:jar:24.1.2 (absent): Could not find artifact org.graalvm.polyglot:js-community:jar:24.1.2 in central (https://repo1.maven.org/maven2/)
[jbang] Run with --verbose for more details. The --verbose must be placed before the jbang command. I.e. jbang --verbose run [...]

0mega28 avatar Mar 06 '25 05:03 0mega28

duplicate of #1683 - this should be fixed for but for now jbang doesn't support direct pom dependencies. work around is to not use the pom import but use the jars that pom directly has.

i.e. this seem to work:

///usr/bin/env jbang "$0" "$@" ; exit $?

//DEPS org.graalvm.polyglot:polyglot:24.1.2
///DEPS org.graalvm.polyglot:js-community:24.1.2
//DEPS org.graalvm.js:js-language:24.1.2
//DEPS org.graalvm.truffle:truffle-runtime:24.1.2

import org.graalvm.polyglot.Context;

public class Script {
    public static void main(String[] args) {
        System.out.println(Context.newBuilder("js").build());
    }
}

maxandersen avatar Mar 13 '25 22:03 maxandersen