I'm using m2e 1.0.0.20110607-2117 bundled with Eclipse Indigo. I'm referencing external maven installation from Preferences -> Maven -> Installations. External maven installation version is 3.0.4.
I'm experiencing locale problems because my locale is Turkish. So I've modified MAVEN_OPTS in mvn.bat file in this external installation. When I run mvn from command line, maven sees this maven_opts but Indigo doesn't. How can I pass maven_opts to m2e? Is there any way to set a property that all predefined maven run configurations in eclipse like "Maven build", "Maven clean", "Maven install" etc. use?
EDIT:
Also setting MAVEN_OPTS in system path doesn't help.
This is the wrong way. You can create a file called mavenrc_pre.bat on windows or .mavenrc in your home folder on linux or windows. Currently i'm not sure if m2e honours the settgins in the mavenrc file ...you have to check that.
Related
I have installed Eclipse Neon, it comes with maven pre-built in it. While configuring jenkins, I would need to set values for Maven_HOME. Since I have maven integrated with eclipse, I am not sure where to find the maven installation path
The embedded Maven Runtime of m2e is located in the org.eclipse.m2e.maven.runtime_<version> folder in the plugins folder of your eclipse installation. Yet it is unusable for using it as a local maven installation under Jenkins as it does not contain the expected folder structure.
A better solution would be to let Jenkins install a Maven Runtime for you as shown below in the Global Tools section of the Jenkins configuration.
Simply untick the Install Automatically option to manually define the MAVEN_HOME environment variable to point to the custom location
I have M2Eclipse plugin installed on my eclipse, and now I am reading a book that says to use the mvn command, I think that I could use eclipse IDE to follow the book, but I want to know a little more about maven. Of course, the command "mvn" is not recognized, I need to edit my PATH variable.
I googled where is maven installed, and the answer is that it is an apache tool and the path is where you want to unzip the package.
BUT, what if I don´t want to install the apache project?? Is there any other option, because how I say at the beginning, I have M2Eclipse plugin installed, so I image that the executable file must to be in some folder into the plugin eclipse path... or does it use only java jar libraries without a binary??
Thank you very much.
M2E is a plugin in Eclipse and not Maven. You are using an embedded Maven version which is part of Ecilpse. You should always install Maven to be useable via command line cause there are difference between M2E/Eclipse and command line.
You can run any mvn goal by clicking on a maven project, than right click and select Run As -> Maven Build... and type any goal you want.
As far as I know eclipse ships with maven already installed. But in order to set up my M2_HOME in order to work with maven from the command line I need to know where eclipse stores it?
I don't want to download maven separate and have 2 instances of that on my PC. That can only create headaches.
In Eclipse there is only installed a maven-embedder which is a part of Maven which means you have to install maven for the command line separately.
Maven plugin, uses java implementation for calling maven.
What you can do is download and unzip/untar maven for mvn command-line scripts and bin, later you can configure eclipse to point to your created maven home.
Eclipse Embedded Maven is installed into:
\plugins\org.eclipse.m2e.maven.runtime_XXX
Where XXX - version and timestamp
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
I basically have 2 questions:
Is there a way to invoke maven console from eclipse? (where I could write eclipse:eclipse, and it started building eclipse project)
Where does STS unpack it's maven? I'd like to add that path to env variables, so that I could use it from my windows console.
Is there a way to invoke maven console from eclipse? (where I could write eclipse:eclipse, and it started building eclipse project)
You could open a shell inside eclipse , cd into the right directory and run the maven console from there. But, when using M2Eclipse (see next point), you're not supposed to run eclipse:eclipse.
Where does STS unpack it's maven? I'd like to add that path to env variables, so that I could use it from my windows console.
STS bundles M2Eclipse which comes with an embedded version of Maven (so it doesn't "unpack" Maven). But you can Configure M2Eclipse to use an external version. Go to window > Preference > Maven > Installations and Add... your external install:
Try the m2eclipse plugin from sonatype and you can eliminate use of 'mvn eclipse:eclipse' altogether. After installing m2eclipse and restarting eclipse, select File->Import->Maven->Existing Maven project. Browse to your maven project and select it. The m2eclipse plugin reads the pom and creates an eclipse project (this is the step that 'mvn eclipse:eclipse' gives). There are other useful features of the m2eclipse plugin including pom editor.
m2eclipse project is moving out of sonatype into the eclipse foundation project page and will be released on the Indigo train.
See this page for more info on m2eclipse: http://m2eclipse.sonatype.org/