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
Related
I am trying to run maven goal: validation and keep getting: [WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
In my org.eclipse.m2e.core.prefs:
activeProfiles=pom.xml
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
What did I do wrong?
Right click on your project
Go to "Run as"
Go to "Run configurations... "
When the screen opens, please delete the word "pom.xml" from the "Profiles:" line and then click "Run".
The project will now run.
Your activeProfiles is set to pom.xml. But your Maven profile should be defined inside your pom.xml with an id. You have to set this id as the active profile or remove this line to use the default profile of your maven project.
Right click on the project:
maven -> disable maven nature
configure -> Convert to maven project
run As -> Maven clean
run As -> Maven install
You just have to:
delete .m2 repository.
execute mvn clean install.
That solved my problem
Right click on the project
Select menu Properties
Click on Maven item in the list of left side
Look at the right side and removing pom.xml from the box
Apply & Close
In the Eclipse IDE, you can find the profile ID listed in two places. The two apparently aren't kept in the same place as I found the profile listed in one place and not the other.
Project-> Run As -> Run Configurations -> Maven Build
If your project is not listed here, then there is no maven profile set. Before making any changes, make sure the name at the top of the right hand window reads your project name! The main tab has a box labeled Profiles:
Project->Properties->Maven
Active Maven Profiles appear in the right hand pane. Simple delete and click apply. This cleared my problem.
Check the target Java version matches the installed Java version in the pom.xml. Even if you have the java version installed. Check if eclipse project facet has correct java version.
<properties>
<java.version>1.8</java.version>
</properties>
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.
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.
Is it possible to clean and build a java project in Eclipse with one click? I don't want to go to Project -> clean -> OK and than to project menu 'Build project'
In Project->Clean I select "Clean projects selected below", select my project(s) and check "Start a build immediately" with "Build only selected projects".
Then go to Window->Preferences->General->Keys, search "Build clean" and enter my own binding for this command. For example, Ctrl + D.
Then, when I press Ctrl + D and Enter I have clean and build.
When you have
Project --> Build Automatically
checked, it will be automatically rebuilt after cleaning it.
If you need something more powerful than clean and deploy, I suggest to learn Ant build tool.
http://ant.apache.org/
Just configure it for your project and prepare the build script, than configure the build script for the clean and build target. If you need, also to deploy it on your server (glassfish, weblogic or whatever you want). With Ant you can configure more situation (test, production..)
Select your project and goto menu bar:Select Windows then->Select Preferences then ->Select Keys then ->Select Build and Clean
Just need to Ctrl + S then Build, it will be as good as new!
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.