Eclipse Maven Terminal - eclipse

I have changed my javaproject via Project-> Configure-> Convert to Maven Project.
I've tried several things to include 2 jar files, which are selfprogrammed, but without any success.
Now i want to install them with the terminal in eclipse but I get the error
The command "mvn" is either misspelled or could not be found.
Can someone explain to me how I can setup my terminal for executing mvn commands.

Related

Eclipse - open an existing project and import projects on to it through command line

I want to run eclipse on a certain workspace and have some projects already imported to it.
I've tried eclipse's -import command line option, but it hasn't imported anything.
Is there a way to do that, without plugins, through the command line?

Run "mvn clean install" in Eclipse

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.
I use eclipse STS, so the maven plugin comes pre-installed. However, if you aren't using STS (Springsource Tool Suite), you can still install the m2Eclipse plugin. Here is the link:
http://www.eclipse.org/m2e/
Once you have this installed, you should be able to run all the maven commands. To do so, from the package explorer, you would right click on either the maven project or the pom.xml in the maven project, highlight Run As, then click Maven Install.
Hope this helped.
Run a custom maven command in Eclipse as follows:
Right-click the maven project or pom.xml
Expand Run As
Select Maven Build...
Set Goals to the command, such as: clean install -X
Note: Eclipse prefixes the command with mvn automatically.
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.
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
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
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.

How repair/recreate Eclipse workspace and/or Maven caches/repositories?

I was creating some Maven project under Eclipse with using spring-osgi-bundle-archetype and this causes some plugins etc to download, which have frozen. After I killed Eclipse, many things related to Maven started to cause errors (Unable to download source code, Unable to find artifacts etc, without any apparent reason).
Looks like something was damaged in Eclipse cache or something.
How to clean and rebuild ALL which is possible in the situation?
Deletion of core.eclipse.m2e.* folders from workspace's .metadata folder didn't help.
IF RECREATING PROJECT
IN POM FILE EDITOR
Try the following:
rm -rf ~/.m2/repository
restart Eclipse with the -clean option
You can delete .project and .classpath and execute command below in console to recreate eclipse project:
mvn eclipse:eclipse
This will generate eclipse required files for you.
reference: http://maven.apache.org/plugins/maven-eclipse-plugin/eclipse-mojo.html
If you have some trouble with downloading the dependent libraries, try mvn install in console and see the error message.
Above is based on the assumption that you can run mvn in console.

Find the command and options used by NetBeans IDE

I am using a the NetBeans 7.x IDE. I have a Netbeans Application module. I use the Build and the Run buttons from the IDE. The module runs just fine when I press Run Project or F6 button. I like to run
this from the command line. Since everything was build automatically for
me I have no idea where things are or how to run it. There are several jar files in the project/build/public-package-jars. Is there a way to see what command and options the Run Project is using ?
Go to the root of the application (or wherever there is a build.xml file) on the command line and run ant -p. That will list all of the available options for building and running the application.

How do you run the maven-gae-plugin "mvn gae:run" command from inside Eclipse?

From the command line, the maven-gae-plugin can be run by calling:
mvn gae:run
I am working in a Maven project with a POM file that declares the use of the maven-gae-plugin.
I can run this maven command from the command-line in Windows. But, after setting up the source code as a project inside Eclipse, I don't know how to run this command from inside the Eclipse IDE. Is this possible?
Assuming you're using m2eclipse, right-click on your Maven project, go to Run As → Maven Build… and create your Run Configuration for a Maven Build. Here is an example:
This configuration would run the gae:run goal on the selected project.
To access it later, right-click on a Maven project and go to Run As → Maven Build (without the …), then select the launch configuration.