mvn archetype:generate and import

71 views
Skip to first unread message

gesamt_kunstwerk

unread,
Dec 5, 2009, 9:59:15 PM12/5/09
to eclim-user
hello all, i'm trying to develop a java project using maven, eclimd,
and vim from the command line on ubuntu. i've been digging around for
days, and it seems like there's no easy way to get an eclimd java
project and maven to really work together without firing up graphical
eclipse. using eclimd, is it possible to either 1.) generate a maven
pom from the java project that will build the project in maven or 2.)
import a java project made from mvn archetype:generate?

i've poked around in the mailing list archives a bit - [1] says that
as of Mar 2009, there is a :ProjectCreate but no :ProjectImport
function in eclim. is this right, still? [2] says that as of Dec 2008,
you must use ant, maven, or javac when using eclimd; building regular
eclipse projects doesn't work. so in eclimd you can create a new java
eclipse project you can't build in eclimd, and you can build a project
you can't import in eclimd? to use maven project in eclimd, are you
supposed to do archetype:generate, then fire up graphical eclipse and
use it's import function to get it in your workspace, then close
graphical eclipse and fire up eclimd and open it in vim?

does anybody have a link to a tutorial on doing java development with
eclimd?

Thanks,
Myer

[1] http://groups.google.com/group/eclim-user/browse_thread/thread/4c3fddfe27794c8b/16632f8e372a1d7e?lnk=gst&q=maven#16632f8e372a1d7e

[2] http://groups.google.com/group/eclim-user/browse_thread/thread/4539d95c10a44530/f7b3aea681fe8c3a?lnk=gst&q=maven#f7b3aea681fe8c3a

Eric Van Dewoestine

unread,
Dec 6, 2009, 1:59:45 AM12/6/09
to eclim...@googlegroups.com
On Sat, Dec 05, 2009 at 06:59:15PM -0800, gesamt_kunstwerk wrote:
> hello all, i'm trying to develop a java project using maven, eclimd,
> and vim from the command line on ubuntu. i've been digging around for
> days, and it seems like there's no easy way to get an eclimd java
> project and maven to really work together without firing up graphical
> eclipse.

> using eclimd, is it possible to either 1.) generate a maven
> pom from the java project that will build the project in maven or

There currently is not a feature which generates a pom for you. If
such a feature exists in eclipse, then I'm open to investigating the
feasibility of exposing that feature in eclim.

> 2.) import a java project made from mvn archetype:generate?
>
> i've poked around in the mailing list archives a bit - [1] says that
> as of Mar 2009, there is a :ProjectCreate but no :ProjectImport
> function in eclim. is this right, still?

:ProjectImport[1] does exist as of eclim 1.4.8[2].

> [2] says that as of Dec 2008,
> you must use ant, maven, or javac when using eclimd; building regular
> eclipse projects doesn't work. so in eclimd you can create a new java
> eclipse project you can't build in eclimd, and you can build a project
> you can't import in eclimd?

> to use maven project in eclimd, are you
> supposed to do archetype:generate, then fire up graphical eclipse and
> use it's import function to get it in your workspace, then close
> graphical eclipse and fire up eclimd and open it in vim?

I'm not a maven user myself and I'm not familiar with
archetype:generate, but it sounds like the process would be:

- run archetype:generate (does this create the eclipse project
artifacts?)
- if archetype:generate created the eclipse project artifacts
(.project, .classpath), then you can run :ProjectImport to register
the project with eclipse, otherwise you would just run
:ProjectCreate
- then continue to use maven as you normally would (:Mvn, or $ mvn)

Note, I do have a small guide[3] on maintaining eclipse's .classpath
file for maven users. Admittedly, it's been a while since I've used
it, but it should still function correctly (let me know if that is not
the case).

> does anybody have a link to a tutorial on doing java development with
> eclimd?

It's somewhat difficult to create a tutorial for java development
since there are so many different ways to go about the development
process, though perhaps this conversation can serve as the start of
such a tutorial.

As an ant user, my process is usually as follows:
1. create a project (:ProjectCreate)
2. create an ant build.xml. I do this manually since I'm a bit picky
as to the layout of my build files. I usually just copy and paste
snippets from a previous project and make the necessary changes.
3. from there I then end up in the day to day flow of
- code
- :Ant
- test
- code
- :Ant
- ...

This same flow could be applied to maven as well, just replacing calls
to :Ant with :Mvn.

Let me know if this clears things up or if you still have questions.
I doubt I've addressed all your questions/concerns so please let me
know where the docs or my explanations fall short.

[1] http://eclim.org/vim/common/project.html#projectimport
[2] http://eclim.org/changes.html#may-30-2009
[3] http://eclim.org/guides/java/maven/mvn/classpath.html

--
eric

myernore extended

unread,
Dec 8, 2009, 1:18:53 AM12/8/09
to eclim...@googlegroups.com
eric -

thanks for the thoughtful response. i think i have the maven/eclimd process down now. i used

mvn archetype:generate

to create the project directories and source code samples. then changed directory to the project folder and executed

mvn eclipse:eclipse

to generate the eclipse files. then fired up eclimd and vim, and executed

:ProjectImport path/to/the/folder/that/contains/pom.xml/

which imported the project with the eclipse resources intact. at this point i was editing the files just fine, and all functionality seemed to be there. for good measure, i opened up the project's pom.xml and executed

:MvnRepo

as per the instructions you linked to [1]. i'm not sure what would have eventually broken if i hadn't done that, though.

thanks!  when i'm more comfortable with eclim, perhaps i'll write a tutorial to cover a basic java project!
myer

[1] http://eclim.org/guides/java/maven/mvn/classpath.html


--

You received this message because you are subscribed to the Google Groups "eclim-user" group.
To post to this group, send email to eclim...@googlegroups.com.
To unsubscribe from this group, send email to eclim-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/eclim-user?hl=en.





--
"to dwell is to garden" - martin heidegger
http://www.myernore.com

Eric Van Dewoestine

unread,
Dec 8, 2009, 10:58:58 AM12/8/09
to eclim...@googlegroups.com
On Tue, Dec 08, 2009 at 01:18:53AM -0500, myernore extended wrote:
> eric -
>
> thanks for the thoughtful response. i think i have the maven/eclimd process
> down now. i used
>
> mvn archetype:generate
>
> to create the project directories and source code samples. then changed
> directory to the project folder and executed
>
> mvn eclipse:eclipse
>
> to generate the eclipse files. then fired up eclimd and vim, and executed
>
> :ProjectImport path/to/the/folder/that/contains/pom.xml/
>
> which imported the project with the eclipse resources intact. at this point
> i was editing the files just fine, and all functionality seemed to be there.
> for good measure, i opened up the project's pom.xml and executed
>
> :MvnRepo
>
> as per the instructions you linked to [1]. i'm not sure what would have
> eventually broken if i hadn't done that, though.

:MvnRepo is just a shorthand to set the necessary classpath variable
in eclipse (as described in the maven docs[1]), so that eclipse knows
where your third party jar files are located. Without it, eclipse
wouldn't be able to locate those jar files and you'd see validation
errors in your code where you've referenced classes from those jar
files, as well as validation errors in your project's .classpath file.

> thanks! when i'm more comfortable with eclim, perhaps i'll write a tutorial
> to cover a basic java project!

That would certainly be welcome. I think I'm going to reorganize the
guide section of the docs and probably extend the java project guide
with a section on getting started with maven using the steps you've
provided, but I'd love to see a tutorial from a maven user.


[1] http://maven.apache.org/guides/mini/guide-ide-eclipse.html#Maven_2_repository

--
eric
Reply all
Reply to author
Forward
0 new messages