使用 maven 编译 netbeans Web 服务项目时出错

Posted

技术标签:

【中文标题】使用 maven 编译 netbeans Web 服务项目时出错【英文标题】:error while compiling net beans web servicee project with maven 【发布时间】:2014-08-13 08:22:49 【问题描述】:

我首先描述我尝试过的内容。我在 net 中创建了一个 Web 服务 豆子。它工作正常。我想在我的项目中使用 GeoIP [链接][1] 所以 [tutorial][2] 说我用 maven 安装。所以我有 下载了 [maven][3]。然后我提取了整个文件夹并跟随 添加环境变量的指令,我已经通过 在 cmd 中运行“mvn -version”。到目前为止,一切似乎都很好。 然后我想我必须将一个名为“pom”的xml文件添加到根目录 由于这个 [documenttions][4],我的项目(Web 服务)的目录。 现在它说我必须运行这个:“mvn build”。我在cmd中试过了。但 它告诉我目录不正确。我改变了cmd的 目录到“Web 服务”项目的根文件夹。和运行 mvn 构建。但我仍然有错误。

错误信息:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building geo-maven 1.0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.116 s
[INFO] Finished at: 2014-08-13T12:48:00+04:30
[INFO] Final Memory: 5M/90M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "build". You must specify a valid lifecycle phas
e or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-ar
tifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate,
initialize, generate-sources, process-sources, generate-resources, process-resou
rces, compile, process-classes, generate-test-sources, process-test-sources, gen
erate-test-resources, process-test-resources, test-compile, process-test-classes
, test, prepare-package, package, pre-integration-test, integration-test, post-i
ntegration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site
, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhase
NotFoundException

now my mind is blowing.

please help me!


  [1]: http://dev.maxmind.com/geoip/geoip2/geolite2/
  [2]: http://maxmind.github.io/GeoIP2-java/
  [3]: http://maven.apache.org/download.cgi
  [4]: http://spring.io/guides/gs/maven/

【问题讨论】:

【参考方案1】:

你有:未知的生命周期阶段“构建”。 这意味着你给 mvn build 的命令几乎没有意义。

您可能已经阅读过 Maven 文档,例如introduction-to-the-lifecycle,您将了解 Maven 阶段和发出正确命令的目标。

现在,试试最常见的mvn clean install

【讨论】:

我不明白这一点。我试过干净安装。我仍然无法理解maven的工作。完成此过程后,我可以在我的项目中使用 geoIP 的类吗?有什么方法可以更轻松地使用 geoIP?我的意思是不使用Maven。就像一个从 mmdb 文件中获取数据的简单库。 如果您的目标只是避免使用 Maven,您可以下载GeoIP2 zip file with dependencies。

以上是关于使用 maven 编译 netbeans Web 服务项目时出错的主要内容,如果未能解决你的问题,请参考以下文章