Skip to content

Conversation

@tbrugz
Copy link

@tbrugz tbrugz commented Dec 4, 2020

Issue #187

This PR adds a new goal (exec:anyjava - class ExecAnyJavaMojo) that extends ExecJavaMojo. It basically adds the capability of resolving artifacts, as in dependency:get (grabbing much code from there). The basic mechanism would be to call the goal exec:anyjava from any directory, informing required artifacts (artifacts parameter) and mainclass (exec.mainClass parameter) from the command line.

Example (running sqlline with h2 driver on classpath):

mvn org.codehaus.mojo:exec-maven-plugin:3.0.1-SNAPSHOT:anyjava -Dartifacts=sqlline:sqlline:1.9.0,com.h2database:h2:1.4.200 -Dexec.mainClass=sqlline.SqlLine

Another option would be to change the ExecJavaMojo itself. If this seems preferable I can create a new PR.

PS: I created the NopTransformableFilter class because without it there would be an "IllegalArgumentException: The parameter filter is not allowed to be null" at org.apache.maven.shared.transfer.dependencies.resolve.internal.DefaultDependencyResolver.validateParameters, which does not seems to occur on GetMojo (I don't know why).

@slachiewicz slachiewicz marked this pull request as draft December 22, 2024 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants