robingrindrod
robingrindrod

Reputation: 472

Is it possible to run the version of Maven that is integrated into Eclipse from the command line?

I have Eclipse installed with the m2eclipse plugin. I would like to run Maven from the command line. Is it possible to do this with the version that is integrated with Eclipse or do I have to install Maven separately?

Upvotes: 4

Views: 107

Answers (2)

cahen
cahen

Reputation: 16676

While Maven is building something inside Eclipse, if you run the following command in a terminal before the build is over

sudo ps aux | grep java

you will see that this is the command Eclipse uses to run 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 for your question is "no", but if your objective is to run the exactly same Maven version (and not necessarily the same Maven), you can do like this:

First, discover the Maven version your Eclipse is using:

  • Run -> Run Configurations -> create a Maven Build
  • in "Goals:" type -version
  • choose any Base Directory (could be any Maven project in your workspace)
  • Run
  • your Eclipse's console will show the Maven version it is using

Then, all you need to do is download the same Maven version and make sure Eclipse and your separate Maven are using the same settings.xml

Upvotes: 2

Robert Munteanu
Robert Munteanu

Reputation: 68308

You have to install the CLI version. The plugin does not offer platform-specific launchers, like mvn or mvn.bat.

Upvotes: 1

Related Questions