I have java maven project in Eclipse that depends from other projects and for near 1000 library jar.
But I cannot use m2eclipse at all.
For create Eclipse project is use eclipse maven plugin like:
mvn eclipse:eclipse -Dwtpversion=1.5
It works well. But when I go to Eclipse and click on m2eclipe - update dependencies - all library jars disappear!
So for work I have disabled java projects as maven in Eclipse. I suppose that there is some problem with eclipse internal variables. Does it correct? What have I check? Does exist some log? Or this is common bug of m2eclipse plugin?
Thanks.
maven eclipse plugin (i.e. mvn eclipse:eclipse) no longer works with m2eclipse or its current version, m2e.
Assuming you have the latest Eclipse (Indigo, which comes with m2e), you should have better success opening the maven project directly (Import as Maven project).
Related
I already have a project in IntelliJ IDEA based on SBT. It works fine, compile and run. Now I want to add the Maven support as well.
How is it possible in IntelliJ IDEA having support for both build managers SBT and Maven in the same project and switch between them ?
In my experience you should have either maven or sbt enabled. Never both.
The solution:
checkout project from repository to project_sbt directory
open project in intellij as sbt project (just open project_sbt/build.sbt from disk)
checkout the same project from repository project to project_maven directory.
open project in intellij as maven project (just open project_maven/pom.xml from disk)
Disadvantages of this solution:
Changes in sbt project are not visible immediately in maven project (and vice versa)
You have to maintenance two build systems (special plugins)
In my previous pc I was working with linux, eclipse Indigo, m2e (I suppose v1.2 or v1.3) and maven 2.
I had configured m2e to use my external maven 2 installation, had projectA depend on projectB and without the need to install any of the projects to the maven local repository I could execute an Eclipse Maven Build (e.g: compile or dependency:tree) configured to use the external maven installation and to Resolve artifacts in workspace. That worked.
Now, I 'm using win7, eclipse kepler, m2e 1.4.1 and maven 3. I configured all in the same fashion (use external maven installation), create the same projects, use the same eclipse Maven build (run configuration) with workspace artifact resolution enabled and it don't work.
Right now it only works if i configure the maven build to use the internal eclipse embedded maven installation.
I 'd really like to always use my external instalation, does anyone knows if this feature was removed from m2e or should this scenario work as I expected and maybe it's a bug thats happening in my specific environment?
It's worth checking that the settings.xml for your external maven makes sense, and eclipse is configured to use it.
I 've tested in other similar environments obtaining same results but, when
upgraded to Eclipse Luna problem was solved.
If you 're facing similar problem, then upgrade to Eclipse Luna.
I have existing projects that I wrote using Eclipse Juno on another machine, on that machine I downloaded the jars I needed (selenium, jxl, sqlite etc.) from the internet manually and then edited the build path to point to them. I need to move these projects over to a different machine which has Eclipse Kepler loaded. I thought I'd use maven to link everything up (with a view to retro-fitting the machine with Juno to use maven) so that as I jump between the two machines everything will be kept in order automatically.
I installed maven from the marketplace and ran the install:install-file command, but it won't run the program as it insists the jars it's looking for aren't installed (which of course they aren't, that's what I thought maven did).
Is it not possible to use maven in this way (get it to download and link up missing jars) for an existing project? Do I need to do it manually, and if so will I have created problems that I'll have to unpick by having tried this with maven?
If you're using the m2e plugin, you can turn on Maven dependency resolution by just right-clicking on the project and choosing Configure->Convert to Maven project. Make sure your project has a valid pom.xml file and set everything up properly in Preferences->Maven (proxy, user settings, maven installation, ...)
If you're not using m2e, you can use the eclipse maven plugin like this:
mvn eclipse:eclipse
This will call the eclipse goal of the eclipse plugin, and it will generate .project and .classpath files for you with all dependencies pointing to your Maven local repository.
As a side note, the install:install-file goal doesn't have anything to do with what you want to achieve, it's used to install an artifact (a .jar file) to your local Maven repository.
What are some methods of utilising Eclipse for Dependency Management?
I really like the The Maven Integration for Eclipse (m2eclipse, Eclipse m2e). I use it purely for the dependency management feature. It's great not having to go out and download a bunch of new jars new each time I set up a project.
A simpler way to go is the Maven Eclipse plugin (as opposed to a Maven plugin for Eclipse). It's simply a maven plugin that generates the .project and .classpath file based on the contents of the pom, you just run mvn eclipse:eclipse and you're done. It uses a classpath variable in Eclipse to locate the local maven repo.
I personally prefer this approach most of the time because you have more control over when the maven plugin updates are done. It's also one less Eclipse plugin to deal with. The GUI features of the m2eclipse plugin in the latest version is pretty nice, though.
There's also an alternative to the m2eclipse plugin called Q4E, now called Eclipse IAM.
Another option is ivy. Ivy has eclipse integration as well.
A comparison of maven and ivy can be found here:
http://ant.apache.org/ivy/m2comparison.html
We recently started using maven for dependency management. Our team uses eclipse as it's IDE. Is there an easy way to get eclipse to refresh the maven dependencies without running mvn eclipse:eclipse?
The dependencies are up to date in the local maven repository, but eclipse doesn't pick up the changes until we use the eclipse:eclipse command. This regenerates a lot of eclipse configuration files.
Have you tried using the m2eclipse plugin? I use it with eclipse and it maintains the eclipse .classpath when I add dependencies. It'll also check for updated dependencies.
You generate the special eclipse files with mvn eclipse:eclipse, but once you've done that, you should let a plugin handle the dependencies while inside eclipse.
That's how we do it at my work place, and it generally works well.