0

I have been able to run an Eclipse Java Maven project from a Windows shell. However, I am able to do so only by invoking mvn from the parent directory of the Maven project.

Is it possible to invoke mvn from any directory? In other words, are there any command line arguments mvn supports that would allow invocation from any directory? I am not able to gather this from the mvn manual page.

Sandeep
  • 1,245
  • 1
  • 13
  • 33
  • First the page for the plugin is this: https://www.mojohaus.org/exec-maven-plugin/ apart from that both goals like [exec](https://www.mojohaus.org/exec-maven-plugin/exec-mojo.html) as well as [java](https://www.mojohaus.org/exec-maven-plugin/java-mojo.html) require a maven project. The question is why would like to do that? and more interesting for what purpose? – khmarbaise Nov 07 '19 at 07:53
  • @khmarbaise Now that I have learned how to use `mvn exec:java -Dexec.mainClass="»Nested Package Name«.»Class Name«" -Dexec.args="»Command Line Arguments«"` as the command to execute Java code outside of the Eclipse IDE, the question naturally arises whether `mvn` can be executed from any directory, with the directory housing the project provided as a command line argument. That will obviate the need for multiple **cd** commands if the Java programs are executed in a batch mode. – Sandeep Nov 07 '19 at 08:30
  • If you want to execute java programms I would suggest to create self running artifacts instead of using maven to execute a program... – khmarbaise Nov 07 '19 at 11:33
  • Could you kindly provide pointers for creating **self running artifacts** from the Eclipse IDE? – Sandeep Nov 07 '19 at 18:18

0 Answers0