download dependencies and ouput build classpath

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

download dependencies and ouput build classpath

Jon Harper
Hi list,

Is there a way to tell maven to download all dependencies and output a
classpath for a given artifact (or a list of artifacts) without having to
create a project and its pom ?

The use case is to prototype or check classes with jshell. I would ideally
want something like https://stackoverflow.com/a/47715029/2748664 but
without a pom:

Something like:
jshell --class-path $( mvn dependency:build-classpath -DincludeTypes=jar \
    -Dartifacts=\
com.fasterxml.jackson.core:jackson-databind:2.9.4,\
org.apache.commons:commons-lang3:3.7\
    -q -Dmdep.outputFile=/dev/stdout
)

I've seen try-artifact or the maven-jshell-plugin but I want to use
something simpler (and more composable)

Thanks in advance,
Jon

ps: it would also be useful to be able to display the dependency:tree of a
given artifact without a pom. I suspect many more commands could be
usefull. I'm mentioning this since it's the same maven-dependency-plugin..