简体   繁体   中英

How to import a Maven 2 project without help of IDE

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.

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

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?


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM