如何从maven pom文件构建项目 [英] How to build project from maven pom file

查看:767
本文介绍了如何从maven pom文件构建项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个开源项目的maven pom文件。这个pom文件有所有信息,如它依赖的其他罐子等。我安装了maven。创建了一个dir samprj并将pom文件复制到该目录中。 cd进入那个目录并运行mvn命令没有任何参数,但我收到了一堆错误。我对maven来说绝对是新手,所以我觉得我错过了一些东西。我也试过Eclipse(导入项目 - exisitng maven项目),但除了eclipse创建一个只有该文件pom.xml的项目之外,它也无法工作。我希望首先它会为项目下载jar,然后下载所有相关的jar和配置文件,但没有任何东西。
所以给定一个pom文件如何从中构建项目?

I have a maven pom file for an open source project. This pom file has all the info like what other jars it depends on etc. I installed maven. Created a dir samprj and copied the pom file into that dir. Cd into that dir and ran mvn command without any arguments but I got bunch of errors. I am absolutely new to maven so I think I am missing something. I tried also from Eclipse ( Import project -- exisitng maven project) but that also does not work except eclipse creates a project that has just that file pom.xml. I expect something that first it will download the jar for the project and then download all dependent jars and config files but nothing there. So given a pom file how do I build the project from it?

推荐答案

如果你想打开它Eclipse,你需要安装m2eclipse:

If you want to open this within Eclipse, you need to install m2eclipse:

  • http://www.eclipse.org/m2e/

然后将项目导入为如下所述的Maven项目:

and then import the project as a Maven project as described here:

  • http://books.sonatype.com/m2eclipse-book/reference/creating-sect-importing-projects.html

这篇关于如何从maven pom文件构建项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆