Maven Build in Eclipse without using Command prompt - java

I created the maven-spring project using the m2e plugin of eclipse. The project is working fine. I want to do a Maven build in Eclipse the project without using any commands in command prompt i.e. using the eclipse IDE only. But I am not able to find the option for Maven build from Eclipse IDE.
Below are the options I am getting when I right click on my project:
Kindly advise.

you can follow this link, right click maven project -> run as -> maven build..
http://www.tutorialspoint.com/maven/maven_eclispe_ide.htm

Right-click on pom.xml, then go to the "Run As" menu (not the "maven" menu). The various plug-in goals (and lifecycle targets) are documented here.

Related

Eclipse: Add Maven configuration to quick links

If I define a maven config in "run as->run configurations" and then set one up, how can I then make it appear in the right-click -> 'run as' options?
Or failing that, where can I make the run configuration appear where it's not so buried in mouse clicks?
The moment you convert your project into Maven through rightClick-->configure and then update maven project you can automatically see maven clean in Run as option. From there you can build your project

How to integrate Maven 1.0 in Java eclipse

i have to rebuilt a maven 1.0 webapplication in Java. However i can not get the application to run in Eclipse IDE.
I already installed Eclipse Luna 4.4 EE including JDK 1.7.
Maven 1.0 was installed succesfully via cmd .bat file.
As Server for the application Tomcat 7 is used.
What do i have to do to migrate the project properly into eclipse.
Any help woulde be much appreciated.
The Problem occured to me is when i tried to import the project as existing maven project it doesnot regconize it as a maven project. And the import stays dead.
Maven Eclipse plugin installation step by step:
Open Eclipse IDE
Click Help -> Install New Software...
Click Add button at top right corner
At pop up: fill up Name as "M2Eclipse" and Location as "http://download.eclipse.org/technology/m2e/releases" or http://download.eclipse.org/technology/m2e/milestones/1.0
Now click OK
After that installation would be started.
Another way to install Maven plug-in for Eclipse:
Open Eclipse
Go to Help -> Eclipse Marketplace
Search by Maven
Click "Install" button at "Maven Integration for Eclipse" section
Follow the instruction step by step
After successful installation do the followings in Eclipse:
Go to Window --> Preferences
Observe, Maven is enlisted at left panel
Finally,
Click on an existing project
Select Configure -> Convert to Maven Project
Now you can import project.
From command line if you have maven in your system variables, you can do
mvn eclipse:eclipse in your project path.
If not works, you can follow this guide:
https://www.mkyong.com/maven/no-more-mvn-eclipseeclipse-whats-next/

Compilation unit is not on the build path of a Java project

I joined an SVN server and checked out the source files a project from that server. In the Eclipse editors, when I hit Ctrl + Space, I got the following error message:
This compilation unit is not on the build path of a Java project
What should I do to solve this problem?
Read this guide on how to use maven projects with eclipse
http://maven.apache.org/guides/mini/guide-ide-eclipse.html
Taken from the above link :
Reason why you get that notice :
Eclipse needs to know the path to the local maven repository. Therefore the classpath variable M2_REPO has to be set.
Solution
Execute the following command:
mvn -Declipse.workspace=<path-to-eclipse-workspace> eclipse:add-maven-repo
Restart your Eclipse IDE (if you already have it open) for this change to take effect.
You can also define a new classpath variable inside eclipse: From the menu bar, select Window > Preferences. Select the Java > Build Path > Classpath Variables page
For Simple Projects :
If you have a simple java project which is made up of only one module, using eclipse is very simple. To generate the eclipse project files from your POM you execute the following command:
mvn eclipse:eclipse
If you have created or checked out the project with eclipse, you only have to refresh the project in your workspace. Otherwise you have to import the project into your eclipse workspace (From the menu bar, select File >Import >Existing Projects into Workspace). In the latter case the project (directory) should not be located in your workspace, because eclipse might come into trouble, especially if you want to use eclipse as the scm client.
For a more detailed explanation refer the above link.
Import project as maven project.
File-> import-> Maven-> Exiting Maven Project-> Next-> Root Directory-> Browse your project from Disk
Follow these steps:
Right click project in Eclipse. Select to Run As → Maven build...
In Goals add eclipse:eclipse
Select Run
Wait for build to finish
Right click project in Eclipse. Select Refresh
This is due to the issue in build path .
If you had imported the project as Existing Maven project, do the following to resolve the issue.
Right click in the Package Explorer -> Maven -> Update project.
Or select the project in package explorer and perform Alt+F5 which is the shortcut for the maven project update.
Execute mvn eclipse:eclipse on command line and once the build is successful, refresh your project in eclipse. This resolve the issue.

How to run a downloaded Java and Maven Project

I'm new in Maven,Java and Eclipse. I just download a project that uses Maven. I want to know how can import and run this project by Eclipse. I install m2eclipse and work with it but i don't know how can I import a existing project.
You need a maven plugin for Eclipse. m2eclipse or Apache Maven Plugin
This links will help you to import the project. M2eclipse Guideline and Importing maven project into eclipse
Use the Maven Eclipse Plugin. It generates the necessary files for the Eclipse IDE.
For running maven project you will need to install maven plugin in eclipse and than right click on it and select run as maven install
Here is an alternate way without using m2Eclipse plugin.
Install Maven and add the bat file to the path. Once this is done open a command prompt and go to the directory where the pom.xml file of your project exists. At this directory level do a:
mvn eclipse:eclipse
This will make your project Eclipse friendly. Once this is completed, import the project by using File Menu in Eclipse. File->Import. In dialog select Existng Projects into Workspace. Click Next. Then select the root directory as the directory from which you ran the mvn command. Click Finish.
You project should now be in your Eclipse IDE

How to execute maven tasks in eclipse (Sonatype plugin)

I know it must be something simple, but I just can't figure it out..
I'm using the Sonatype maven plugin on eclipse. When I want to build a war file for a webapp project, the only way I know to do it is to use the command line and type mvn package.
I've looked all through the right click menu and I can't find any way to do it from eclipse.
There's a maven submenu that seems to have no options to do with building, and there's a run menu that doesn't seem right - I don't want to run my project - I just want to build it. There is a maven build option in the run menu, but if I run it, a configuration window pops up for me to enter goals in..
How I do I just do a simple mvn package, but through gui? What am I missing?
Thanks!
Thanks guys!
Both responses answer my question..
Now I have new problems that the build doesn't work, but I'll post that in a new question.
Take a look into the menu under that "Run As" there you find "Maven build" with a dialog where you can define different goals etc.
If your project is a Maven project, right-click on your project and select Run As > Maven Build to create your own configuration (goals, profiles, etc) or use one of the preexisting configuration.
http://www.imagebanana.com/img/ja7wh7m0/screenshot_008.png
Once you've run a Maven Build Run Configuration, it will also be listed under the "Run As..." green arrow:
alt text http://img8.imageshack.us/img8/8510/screenshotrun.png
You could add it as favorite if you want.

Categories

Resources