views:

63

answers:

3

Is it possible to export my maven Java project on Eclipse to users that do not have maven or the eclipse maven plugin? The first question that comes to my mind is how to force all the dependencies to be included with the export.

I want to make it easier for people who are not using Maven to import my project on Eclipse and use it, in other words, i want to generate a zip with the project that can be imported by eclipse for users not using maven or m2eclipse.

Any magic here?

A: 

If you like to do this as a zip the maven-dependency plugin is the correct answer and the assembly plugin. With the dependency plugin copy all dependencies and create a zip via the assembly plugin...may be it's possible without the dependency plugin...you should check the docs about it

khmarbaise
A: 

Actually there is no magic, an eclipse project is defined by its .project file, no matter if it is a Maven project or not.

You can freely distribute your project and others will be able to successfully import them in their eclipse instance without further trouble.

You can distribute a shared eclipse user library file specifying those dependencies along with your project, this of course is nowhere near the flexibility of Maven, but it might help.

StudiousJoseph
The problem is the `.classpath` file, it needs to be rewritten.
Pascal Thivent
+1  A: 

Any magic here?

No, no magic. You'll have to:

  1. get all dependencies (all scopes + transitively) and copy them into, say ./lib.
  2. rewrite the .classpath to point on the libraries inside ./lib.
  3. package the sources, the ./lib, the eclipse configuration files into some archive.

1. and 3. are doable with the Maven Assembly Plugin. For 2. the GMaven plugin might help. Or maybe do it manually. One could actually imagine extending the Maven Eclipse Plugin to provide some kind of eclipse:export goal, this would be much better.

But let me warn you, this won't be easy at all and honestly, it would be wayyyy more easy for everybody to either use Maven and eclipse:eclipse or m2eclipse.

Pascal Thivent