Where is mvn.exe when using embedded maven 3 in eclipse indigo? - eclipse

I'm using the Indigo Release of eclipse. When I check Window -> Preferences, Maven -> Installations, it confirms that it's using the Embedded (3.0.2/...) installation of Maven.
I want to be able to run maven commands from the command line (Windows Powershell), but when I type, e.g.,
PS C:\> mvn
no executable is found. I did a search for "mvn.exe" and found no results.
I suppose I could install a stand-alone version of Maven 3 and add that to my PATH, but I'd prefer to be using the same Maven installation for command line tasks as well as IDE (eclipse) tasks.
So, where is the embedded maven's mvn.exe hiding?

The simple answer is, cause it's embedded in Eclipse so you can't call it from console. If you like to do this you have to install Maven yourself.

There is no mvn.exe at all. The Maven distro comes with batch or shell scripts. Eclipse runs an embedded version which is called through an API.

remember, embedded maven is not configured to work out of eclipse environment (and terminal usage is out of STS usage).
we have to install maven.
and also note, there is no "mvn.exe"
follow the following to setup maven to work from terminal.
maven download link is here
download latest maven from here
extract it where ever you want.
i extracted as below (see the bin,boot,conf,... folders are shown below as in the image):
as this maven download is extracted from zip file (it is not setup), you will have to add this extracted path to "PATH" variable in windows environment.
follow this to set environment path:
now "mvn" command must work.
in my case, i use STS (spring tool suite)
and i had to restart STS for "mvn" to work in terminal in sts.
check it out with eclipse.

Related

how can I configure Jenkins to use maven that's pre-installed on eclipse

I have installed Eclipse Neon, it comes with maven pre-built in it. While configuring jenkins, I would need to set values for Maven_HOME. Since I have maven integrated with eclipse, I am not sure where to find the maven installation path
The embedded Maven Runtime of m2e is located in the org.eclipse.m2e.maven.runtime_<version> folder in the plugins folder of your eclipse installation. Yet it is unusable for using it as a local maven installation under Jenkins as it does not contain the expected folder structure.
A better solution would be to let Jenkins install a Maven Runtime for you as shown below in the Global Tools section of the Jenkins configuration.
Simply untick the Install Automatically option to manually define the MAVEN_HOME environment variable to point to the custom location

Where maven is installed (eclipse plugin)

I have M2Eclipse plugin installed on my eclipse, and now I am reading a book that says to use the mvn command, I think that I could use eclipse IDE to follow the book, but I want to know a little more about maven. Of course, the command "mvn" is not recognized, I need to edit my PATH variable.
I googled where is maven installed, and the answer is that it is an apache tool and the path is where you want to unzip the package.
BUT, what if I don´t want to install the apache project?? Is there any other option, because how I say at the beginning, I have M2Eclipse plugin installed, so I image that the executable file must to be in some folder into the plugin eclipse path... or does it use only java jar libraries without a binary??
Thank you very much.
M2E is a plugin in Eclipse and not Maven. You are using an embedded Maven version which is part of Ecilpse. You should always install Maven to be useable via command line cause there are difference between M2E/Eclipse and command line.
You can run any mvn goal by clicking on a maven project, than right click and select Run As -> Maven Build... and type any goal you want.

Where does Eclipse install maven?

As far as I know eclipse ships with maven already installed. But in order to set up my M2_HOME in order to work with maven from the command line I need to know where eclipse stores it?
I don't want to download maven separate and have 2 instances of that on my PC. That can only create headaches.
In Eclipse there is only installed a maven-embedder which is a part of Maven which means you have to install maven for the command line separately.
Maven plugin, uses java implementation for calling maven.
What you can do is download and unzip/untar maven for mvn command-line scripts and bin, later you can configure eclipse to point to your created maven home.
Eclipse Embedded Maven is installed into:
\plugins\org.eclipse.m2e.maven.runtime_XXX
Where XXX - version and timestamp

How to get access to (embedded in) Maven console in Eclipse?

Is possible to access Maven (embedded) console in Eclipse like in shell (linux shell, windows cmd.exe) to run custom maven commands (mvn archetype:create.... etc) ? I'm using m2e, but can run Maven commands only by GUI.
You can run custom maven commands directly from Eclipse by doing:
Run -> Run Configurations... -> Maven Build
You'll need just some Maven plugin for Eclipse like m2e.
maybe you can use "external tools" function to do it.
see:
In Eclipse, choose “Run -> External Tools -> External Tools Configurations
In "Program", click “New Launch Configuration”
Config your console name, location, working directory
"run"
sorry for no images, because my reputation is below 10.
I highly recommend shell plugin for Eclipse: Wicked shell (http://www.wickedshell.net/)
Sadly I don't know about any Eclipse plugin to do that :(
A long time ago (in the Maven 1 era) there was a Maven goal called "console" that allowed you to execute goals in a pre-loaded maven instance. But that feature was discontinued in Maven 2.
For new versions of Maven (Maven 3), the folks at Sonatype made a Maven Shell which I think will do what you want: http://shell.sonatype.org/index.html

Does Eclipse ship ant with its own distribution?

First time using Apache Ant (I'm excited and overwhelmed at the same time!) for automating a Java app.
I did not go to the ant website and download ant directly. Rather, I'm using the standard plugin that ships with Eclipse. From Eclipse, I can run test build.xml projects perfectly. But when I go to run ant directly off the command-line, Windows doesn't recognize it as a recognized command.
This leads me to believe that I either do not have ant installed, or I have not configured it properly (at all). If it's not installed, then why do these build.xml scripts work when I fire them inside of Eclipse? Does Eclipse ship with its own distrib of ant that isn't accessible from the cmd line?
And if it's just a config issue, what do I need to do in order to get ant to run a buildscript of my own flavor?
I want to start using Apache Ivy and in order to run the demos I first need ant up and running from the command line.
Thanks for any help or insight :-)
Does Eclipse ship with its own distrib of ant that isn't accessible from the cmd line?
Essentially, yes. Eclipse bundles the core Ant runtime plus its own extensions and integration, but it's private to the Eclipse installation.
If you want to run the builds from outside of Eclipse, you need to download and install the full distribution of Ant.