44

I'm following these instructions, but having problems with running commands like mvn eclipse:eclipse.

How and where shall I run the command?

My setup:

  • Windows 7 32bit
  • Eclipse Java EE IDE for Web Developers.
  • Version: Juno Service Release 2
  • Build id: 20130225-0426
  • m2e - maven integration for eclipse v 1.3.0

I installed the m2e via the plugin installation in Eclipse.

sean
  • 3,909
  • 19
  • 28
ulkas
  • 5,253
  • 3
  • 29
  • 46

4 Answers4

93

Right click on the project

->Run As --> Run configurations.

Then select Maven Build

Then click new button to create a configuration of the selected type. Click on Browse workspace (now is Workspace...) then select your project and in goals specify eclipse:eclipse

Manuel Jordan
  • 11,959
  • 15
  • 69
  • 111
PSR
  • 36,137
  • 33
  • 104
  • 147
  • 6
    This is the correct answer. The accepted answer also works but requires the installation of a local maven repo. – JPCF Oct 25 '13 at 03:44
  • @JPCF: agreed. You do not _need to have [Maven] installed as a standalone application_ as the accepted answer suggests. Exactly what I was looking for, thanks. – Amos M. Carpenter Feb 16 '15 at 04:54
  • what happend if I actually want is execute a goal like: [[mvn deploy:deploy-file -DgroupId= \ -DartifactId= \ -Dversion= \ -Dpackaging= \ -Dfile= \ -DrepositoryId= \ -Durl=]] – jaundavid Feb 27 '15 at 12:32
49

The m2e plugin uses it's own distribution of Maven, packaged with the plugin.

In order to use Maven from command line, you need to have it installed as a standalone application. Here is an instruction explaining how to do it in Windows

Once Maven is properly installed (i.e. be sure that MAVEN_HOME, JAVA_HOME and PATH variables are set correctly): you must run mvn eclipse:eclipse from the directory containing the pom.xml.

BuZZ-dEE
  • 3,875
  • 7
  • 48
  • 76
kostja
  • 56,537
  • 45
  • 164
  • 213
4

I don't think one needs it any more. The latest versions of Eclipse have Maven plugin enabled. So you will just need to import a Maven project into Eclipse and no more as an existing project. Eclipse will create the needed .project, .settings, .classpath files based on your pom.xml and environment settings (installed Java version, etc.) . The earlier versions of Eclipse needed to have run the command mvn eclipse:eclipse which produced the same result.

belgoros
  • 2,671
  • 3
  • 19
  • 49
  • 1
    The problem is that Eclipse tends to import a project as a "Maven" project w/o identifying its Java facet. So once we import the project, we have to point-n-click to get that going. Using `mvn eclipse:eclipse` before importing the projects set the appropriate facet (most of the time... caveat emptor.) – luis.espinal Feb 20 '19 at 19:56
2

Besides the powerful options on the "Run Configurations.." on a well configured project you'll see the maven tasks on the Run As as well.

enter image description here

Pablo Thiele
  • 323
  • 4
  • 12