mvn command not found in eclipse but works on terminal - eclipse

mvn command not found in eclipse but works on mac terminal.
Where do I have to setup Path to Maven for eclipse. Tried articles from google but no luck.

Eclipse includes an embedded version of maven. I suggest not to use it, but refer to the installed version in your environment. From eclipse -> windows -> preferences -> Maven -> Installations -> add: insert the path of your installed maven. Flag it. (not the embedded!).Then you can go to Maven -> User settings and enter the path to the settings.xml of your installed maven.
Then you can right click on the project -> maven -> update project or run as -> maven .. to execute tasks using the same maven installation of the terminal.

Related

Installing a Maven project in Eclipse Version: Mars.2 (4.5.2)

I want to install this samples https://github.com/danielolszewski/blog in Eclipse.
I download the repo, unzipped in my workspace dir, run mvn eclipse:eclipse and from Eclipse Import -> Existing Maven Projects ->
Everything seems to be OK, but Eclipse does not recognize the Junit classes.
Instead of see Run As -> Junit Test , I see Run As -> Configurations
It seems to me that you don't use the right view. You have to use the view "Project Explorer"? It should be available as tab. If not you can add it using menu "Window > Show View".

built and execute a maven-project in eclipse

I am trying to build and run a project using maven and under eclipse Kepler. I know that I shoud run (under linux using Terminal) the following commands to build and execute my project:
mvn clean install
mvn exec:java -Dexec.mainClass="com.example.App"
But I want to know, how to build and execute my project under eclipse.
In my eclipse, I have six commands at all: maven build, maven build..., maven clean, maven generate-sources, maven install and maven test.
How to built and execute my project on Eclipse?
well, the solution is as following:
right-click on pom.com -> you get many options-> you choose built->
enter in launch configuration: clean compile package -> click ok
After the build-process is finished, click on your application.java and click run (green button). That´s all

Maven SCM Handler for CVS in Eclipse (Juno)

I'm a longtime Eclipse and Maven user, but am just now upgrading to the more recent Eclipse builds (Luna- 4.4.1).
I've noticed that while Luna ships with m2e (1.5), the m2e marketplace no longer seems to have the 'Maven SCM Handler for CVS' as it did in the past. Has this handler been discontinued? Are there any other handlers that would allow for clean integration of Eclipse/Maven/CVS?
Without that handler, importing a Maven project from CVS is a rather painful affair; import generic cvs project, apply java project wizard, convert project to maven project. Once that's done, you then have to reconfigure other project settings such as Java source, resources, etc. All of this was automatically handled in m2e 1.0.x with the CVS handler.
For CVS SCM connector (if you want to import maven project from cvs repository):
Install new software: http://repository.tesla.io:8081/nexus/content/sites/m2e.extras/m2eclipse-cvs/0.13.0/N/0.13.0.201304101743/
More info: Maven Eclipse (m2e) SCM connector for subclipse 1.10 (svn 1.8)
(In case you're wondering, it also worked on Eclipse Mars)
First solution
How to install the SCM connector:
download zip org.sonatype.m2e.subclipse.feature-0.13.0-SNAPSHOT-site.zip or files from above repository location
unzip the file to an empty folder somewhere, remember that folder (or put the files from repository in that folder)
In Eclipse,
go to Help/Install New Software…
Click “Add…” to add a new site
In the window, click on “Local…” and choose the folder where you unzipped the site before. The result in the Location field should look like file:/C:/theUnzipFolder/
Click OK, choose all available packages to install, and continue the installation as usual
Second solution
Open Eclipse
Go to Help -> Install New Software -> Enter above repository location and hit enter
Select Maven Integration for Eclipse CVS Team Provider -> Finish
Alternative solution to SCM connector:
Checkout your project in workspace
Open cmd.exe and go to project location in that workspace. Then execute the following
mvn eclipse:eclipse
Open Eclipse with that workspace path as target
Right click in Project Explorer panel, Import -> Maven -> Existing Maven Projects -> Select project location from workspace and you should see the projects in here
Right click on your project in Project Explorer panel -> Maven -> Update project -> Select all projects -> Ok
Don't forget to:
set your corresponding JDK in Window -> Preferences -> Java -> Installed JREs
set your corresponding compiler level in Window -> Preferences -> Java -> Compiler -> Compiler compliance level
set JAVA_HOME environment variable

How to run maven project in eclipse

I have maven project on Java with TestNG. I want to run it from eclipse. I use Eclipse Kepler and have installed m2eclipse plugin. But there is no any option connected with maven in menu Run as... Could someone help me with such issue. How should I run maven project in eclipse?
To build a maven project in eclipse
In Eclipse, Run -> Run Configuration
Right click on Maven and select New
Enter Name, select base directory of your maven project
Enter Goal as "clean install"(or yours options)
Click on Apply and Run
There are some possible changes are there for build failure because of tool.jar not found and Reference here

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