Is it possible to run the Maven version built into Eclipse from the command line?

I have Eclipse installed with the m2eclipse plugin. I would like to start Maven from the command line. Is it possible to do this with a version integrated with Eclipse, or do I need to install Maven separately?

+4
source share
2 answers

You need to install the CLI version. The plugin does not offer platform platforms such as mvn or mvn.bat .

+1
source

So far, Maven is creating something inside Eclipse if you run the following command in a terminal before the build is complete

 sudo ps aux | grep java 

you will see that this is the command that Eclipse uses to start Maven:

 /usr/lib/jvm/java-7-oracle/bin/java -Dmaven.home=EMBEDDED -Dclassworlds.conf=/home/a/dev/workspace/.metadata/.plugins/org.eclipse.m2e.core/launches/m2conf4172661110787200776.tmp -Dfile.encoding=UTF-8 -classpath /home/a/dev/eclipse_indigo/configuration/org.eclipse.osgi/bundles/870/1/.cp/jars/plexus-classworlds-2.4.jar org.codehaus.plexus.classworlds.launcher.Launcher -B install 

Then basically the answer to your question is โ€œno,โ€ but if your goal is to run exactly the same version of Maven (and not necessarily the same Maven), you can do it like this:

First find the version of Maven that Eclipse uses:

  • Run -> Run Configurations -> create Maven Build
  • in type "Objectives:" - version
  • select any base directory (there can be any Maven project in your workspace)
  • Run
  • Eclipse Console Will Show Maven Version Using

Then all you have to do is download the same version of Maven and make sure that Eclipse and your separate Maven use the same settings.xml

+2
source

All Articles