开发者

How to import a Maven 2 project without help of IDE

I have开发者_Go百科 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?


0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜