If I know the coordinates of the artifact and the class name inside this artifact, can I make Maven run the class, including all its dependencies on the Java classpath?
For example, suppose an employee told me about a tool that I can run that is published in our internal Nexus with the coordinates of the artifact example:cool-tools:1.0.0 . I used this answer to download an artifact. Now I know that the main class name is example.Main . But if I just go to the download location of the artifact and run java -cp cool-tools-1.0.0.jar example.Main , I get NoClassDefFoundError for any cool-tools dependencies.
I know maven-exec-plugin , but as far as I can tell, only for projects where you have the source. Suppose I donβt have access to the source, only with Nexus containing the tool (and all its dependencies). Ideally, I would do something like mvn exec:exec -DmainArtifact='example:cool-tools:1.0.0' -DmainClass='example.Main' , but I donβt think that the exec plugin is really capable of this.
ETA: To be clear, I don't have a local project / POM. I want to do this using only the command line, not writing POM, if possible.
source share