Title says it all.
I want to run the console command mvn clean install
on my project in question directly in Eclipse, not from the command line.
It would just be more convenient for me to do this, as I already have the project open in Eclipse. It would save me time if I would not have to navigate to the folder in Windows Explorer.
Not a big deal if I can't do this... but can I? And if so, how?
It would be great if I could just right click my project, then click "mvn clean install" from the context menu.
Just found a convenient workaround:
Package Explorer > Context Menu (for specific project) > StartExplorer > Start Shell Here
This opens the cmd line for my project.
Unless someone can provide me a better answer, I will accept my own for now.
Run a custom maven command in Eclipse as follows:
clean install -X
Note: Eclipse prefixes the command with mvn
automatically.
If you want to open command prompt inside your eclipse, this can be a useful approach to link cmd with eclipse.
You can follow this link to get the steps in detail with screenshots. How to use cmd prompt inside Eclipse ?
I'm quoting the steps here:
Step 1: Setup a new External Configuration Tool
In the Eclipse tool go to Run -> External Tools -> External Tools Configurations option.
Step 2: Click New Launch Configuration option in Create, manage and run configuration screen
Step 3: New Configuration screen for configuring the command prompt
Step 4: Provide configuration details of the Command Prompt in the Main tab
Name: Give any name to your configuration (Here it is Command_Prompt)
Location: Location of the CMD.exe in your Windows
Working Directory: Any directory where you want to point the Command prompt
Step 5: Tick the check box Allocate console This will ensure the eclipse console is being used as the command prompt for any input or output.
Step 6: Click Run and you are there!! You will land up in the C: directory as a working directory
Right click on pom.xml, Run As, you should see the list of m2 options if you have Maven installed, you can select Maven Clean from there
You can create external command Run -> External Tools -> External Tools Configuration...
It will be available under Run -> External Tools and can be run using shortcuts.
Source: Stackoverflow.com