当前位置: 动力学知识库 > 问答 > 编程问答 >

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?

网友答案:

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

网友答案:

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

分享给朋友:
您可能感兴趣的文章:
随机阅读: