Using version range for an extension and tests

I am writing an extension for AsciidoctorJ and I am wondering what is the dependency relation to the core.

Because AsciidoctorJ follows semantic versioning, my extension should work with all 2.x.x version of AsciidoctorJ (unless I start using a method introduced with 2.5.0 in that case this would be my lower bound for the version range).

Should I declare a dependency to [2.0.0, 3.0.0[ ?

dependencies {
    implementation "org.asciidoctor:asciidoctorj:[2.0.0, 3.0.0["
    // ...
}

Is this correct?


When I run ./gradlew dependencies, we see that the range is resolved to the newest version (2.5.1 by time of writing)

compileClasspath - Compile classpath for source set 'main'.
+--- org.asciidoctor:asciidoctorj:[2.0.0, 3.0.0[ -> 2.5.1
|    +--- org.asciidoctor:asciidoctorj-api:2.5.1
|    \--- org.jruby:jruby:9.2.17.0
...

This is fine, but makes the build none reproducible. (when I run this later, it might resolve to a different version).

I can add dependency locking to the mix:
https://docs.gradle.org/current/userguide/dependency_locking.html


Now when it comes to testing, what is the best practice?

On the CI server I would like to do multiple run for the AsciidoctorJ versions that are supported.
(e.g testing with AsciidoctorJ version 2.0.0, 2.1.0, 2.2.0…)

It would be like a updating the lock to a specific version from the outside:

./gradlew check --update-locks org.asciidoctor:asciidoctorj:2.2.0

This is currently failing with:

   > Update lock format must be <group>:<artifact> but 'org.asciidoctor:asciidoctorj:2.2.0' is invalid.

What are my options to run tests with several asciidoctor versions defined by the range?

Add a prefer version that can be specified with a parameter from the outside?