3

I have not dealt with Maven 2 but am learning. I am going though Spring 3 in Action book and the source code has pom.xml for each project. I can import these projects in Netbeans seamlessly, however, at home I use VIM.

How do I get started with Maven 2? I want to be able to just download the source code, run some maven stuff and have the project set up with correct libraries (dependencies) downloaded.

I am looking at the Maven Complete Reference but the TOC does not show how to do what I want except installing it on linux.

MatBanik
  • 26,356
  • 39
  • 116
  • 178
Omnipresent
  • 29,434
  • 47
  • 142
  • 186
  • 1
    ...all I was trying to say was that I'd like to get started on the edit-build-run cycle w/out help of IDE not that X is better than Y. – Omnipresent Jul 07 '11 at 21:45
  • I don't understand - all you need to build or run the code is the `mvn` command, provided the `pom.xml`. What exactly are you trying to import into vim? – matt b Jul 08 '11 at 02:48

2 Answers2

6

In the folder containing pom.xml (usually the topmost folder of the project) run mvn clean install. This will compile all the code, unit tests, and run the tests. It will download any necessary dependencies along the way. The resulting jar (or war, etc) will end up in the target directory.


EDIT As pointed out only package is needed. The difference between package and install is that install adds the JARs to your local repository where other projects (on your local machine) can depend on it. More information here

Jeremy W
  • 1,889
  • 6
  • 29
  • 37
Sled
  • 18,541
  • 27
  • 119
  • 168
2

If you are a beginner in the Maven world you should consider the use of Eclipse / Spring Tool Suite (which is Eclipse-based) as a better alternative to Vim. But if you persist on Vim for major reasons then take a look to Tips for using Vim as a Java IDE?


Community
  • 1
  • 1