jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Make 4.+ use the latest 4.x release?

Open sixcorners opened this issue 10 months ago • 1 comments

Is your feature request related to a problem? Please describe. I would be nice if I could specify the version as 4.+ and have it not go to 5. Maybe 4+ could still go to 5. Same for 4.12.+ using 4.12.x versions but not anything 5.x.

Describe the solution you'd like The version that DEPS find when using + is tweaked slightly.

Describe alternatives you've considered I currently just specify the full version

Additional context Here is an example of a program that breaks if the version is switched to 4.+. 5.0.0 gets used which is old.

///usr/bin/env jbang --enable-preview "$0" "$@" ; exit $?
//DEPS org.web3j:core:4.12.3
//DEPS org.slf4j:slf4j-jdk14:2.+

import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.DefaultBlockParameter;
import org.web3j.protocol.core.DefaultBlockParameterName;
import org.web3j.protocol.http.HttpService;

import java.math.BigInteger;

void main(String... args) throws Exception {
    DefaultBlockParameter block = DefaultBlockParameterName.LATEST;
    if (args.length == 1) block = DefaultBlockParameter.valueOf(new BigInteger(args[0]));
    // https://chainlist.org/chain/1
    try (var web3 = Web3j.build(new HttpService("https://rpc.mevblocker.io", true))) {
        var resp = web3.ethGetBlockByNumber(block, true).send();
        System.out.printf("%s%n", resp.getRawResponse());
    }
}

see https://github.com/hyperledger-web3j/web3j/issues/1976

sixcorners avatar Jan 28 '25 16:01 sixcorners

For some reason org.slf4j:slf4j-jdk14:1.+ goes to org.slf4j:slf4j-jdk14:jar:1.1.0-RC0 when I think it should be 1.7.36 at least.

sixcorners avatar Jan 30 '25 14:01 sixcorners