How to use Eclipse embedded Maven installation from the command line?

17,578

Solution 1

To my knowledge, the Maven runtime that is embedded in m2 (the plug-in that provides Maven support in Eclipse) is not suited to be used outside the IDE.

You will have to install regular Maven (available from https://maven.apache.org/download.cgi) to be able to use it from the command line. From my experience, using both in parallel works well.

Alternatively, you can use Maven wrapper in your project - thus avoiding the need to install Maven for you and your team mates.

Solution 2

It is possible to use Embedded Maven (at least in Windows)

Add de installation-path\bin in variable PATH

Define M2_HOME=installation-path

Define JAVA_HOME

Installation path could be something like

C:\Users\juans\.m2\wrapper\dists\apache-maven-3.6.3-bin\1iopthnavndlasol9gbrbg6bf2\apache-maven-3.6.3\bin

Note: juans is the user

Share:
17,578
AndreaNobili
Author by

AndreaNobili

Updated on July 12, 2022

Comments

  • AndreaNobili
    AndreaNobili almost 2 years

    I am using STS (the Eclipse version for Spring) and it use the Maven plugin. It works fine but this Maven version is embedded into Eclipse.

    Now I have to use it from the shell (the DOS prompt). If I try to perfrom thje mvn clean statment I obtain this error message:

    C:\Users\Andrea\Documents\workspaces\Real-Time\ud381\lesson1\stage1>mvn
    "mvn" non è riconosciuto come comando interno o esterno,
     un programma eseguibile o un file batch.
    

    This is in Italian languange and it simply say that it can't find an internal or external mvn command.

    So I think that I have to add it to the PATH environment Windows variable so I will can use it inside the command prompt.

    The problem is that I can't find where is this embedded Maven installation.

    Where can I find it?