Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
无法在存储库中心中找到资源(http://repo1.maven.org/maven2)_Maven - Fatal编程技术网

无法在存储库中心中找到资源(http://repo1.maven.org/maven2)

无法在存储库中心中找到资源(http://repo1.maven.org/maven2),maven,Maven,一般来说,我该如何解决maven repo中找不到的资源,是否还有其他repo列表可以添加到pom.xml中?我尝试了列为命令行的解决方案,但没有成功,尽管maven报告它成功了 I tried to build test-analytics, but got error: [INFO] task-segment: [install] [INFO] ----------------------------------------------------------------------

一般来说,我该如何解决maven repo中找不到的资源,是否还有其他repo列表可以添加到pom.xml中?我尝试了列为命令行的解决方案,但没有成功,尽管maven报告它成功了

I tried to build test-analytics, but got error:

[INFO]    task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
Downloading: http://repo1.maven.org/maven2/com/google/code/gwt-dnd/gwt-dnd/3.1.1/gwt-dnd-3.1.1.pom
[INFO] Unable to find resource 'com.google.code.gwt-dnd:gwt-dnd:pom:3.1.1' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/com/google/code/gwt-dnd/gwt-dnd/3.1.1/gwt-dnd-3.1.1.jar
[INFO] Unable to find resource 'com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1

  Try downloading the file manually from the project website.

  Then, install it using the command: 
      mvn install:install-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there: 
      mvn deploy:deploy-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency: 
    1) com.google.testing.testify.risk.frontend:test-analytics:war:1.0-SNAPSHOT
    2) com.google.code.gwt-dnd:gwt-dnd:jar:3.1.1

----------
1 required artifact is missing.

for artifact: 
  com.google.testing.testify.risk.frontend:test-analytics:war:1.0-SNAPSHOT

from the specified remote repositories:
  central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Sun Nov 18 21:24:23 EST 2012
[INFO] Final Memory: 16M/238M
[INFO] ------------------------------------------------------------------------
以下是命令和错误:

 mvn deploy:deploy-file -DgroupId=com.google.code.gwt-dnd -DartifactId=gwt-dnd -Dversion=3.1.1 -Dpackaging=jar -Dfile=gwt-dnd-3.1.1.jar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'deploy'.
[INFO] ------------------------------------------------------------------------
[INFO] Building test-analytics
[INFO]    task-segment: [deploy:deploy-file] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] One or more required plugin parameters are invalid/missing for 'deploy:deploy-file'

[0] Inside the definition for plugin 'maven-deploy-plugin' specify the following:

<configuration>
  ...
  <url>VALUE</url>
</configuration>

-OR-

on the command line, specify: '-Durl=VALUE'

[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Tue Nov 20 14:10:37 EST 2012
[INFO] Final Memory: 14M/238M
[INFO] ------------------------------------------------------------------------
mvn部署:部署文件-DgroupId=com.google.code.gwt-dnd-DartifactId=gwt-dnd-Dversion=3.1.1-dpackage=jar-Dfile=gwt-dnd-3.1.1.jar
[信息]正在扫描项目。。。
[信息]正在存储库中搜索前缀为“deploy”的插件。
[信息]------------------------------------------------------------------------
[信息]构建测试分析
[信息]任务段:[部署:部署文件](聚合器样式)
[信息]------------------------------------------------------------------------
[信息]------------------------------------------------------------------------
[错误]生成错误
[信息]------------------------------------------------------------------------
[信息]一个或多个必需的插件参数对于“部署:部署文件”无效/缺失
[0]在插件“maven deploy plugin”的定义中指定以下内容:
...
价值
-或-
在命令行上,指定:'-Durl=VALUE'
[信息]------------------------------------------------------------------------
[信息]有关更多信息,请使用-e开关运行Maven
[信息]------------------------------------------------------------------------
[信息]总时间:1秒
[信息]完成时间:美国东部时间2012年11月20日星期二14:10:37
[信息]最终内存:14M/238M
[信息]------------------------------------------------------------------------

您需要了解如何在POM文件中配置节


最好还是考虑建立一个Maven知识库管理器(比如Nexus)来缓存和聚合你的构建所需要的第三方存储库。

你缺乏对Maven世界的一些基本理解。因此,简单总结一下回购协议应该会对你有所帮助

对于初学者,当您“开箱即用”地运行maven时,有两个可用的存储库,这就是您所做的。您有1)maven central和2)本地回购协议,即~/.m2/存储库。本地存储库是一种缓存,您在本地构建的工件将通过“mvn install”命令“安装”到该位置。注意,“mvndeploy”命令“deploy”一个工件,类似于安装,但它意味着将工件放入“远程存储库”。Maven Central是一个远程存储库,除了您的单个本地repo之外,所有repo都是远程存储库,但您不会随意部署到它。它是为经过审查的、发布质量的人工制品而设计的

因此,您的构建无法找到google工件。这意味着它们不在Maven Central,不过您可以检查一下

如果他们不在那里,你有几个选择

1) 在本地repo中“安装”工件(这应该是您的第一步,因为它非常轻量级)

2) 运行您自己的存储库服务器,如nexus。这是你自己的“远程存储库”,你可以“部署”谷歌的东西

3) 看看google的东西是否在另一个公开可用的远程存储库中——有几个重要的存储库不在现成的maven repo定义中,但您可以添加它们


请注意,这三个选项与其说是备选方案,不如说是针对不同情况的解决方案。如果你只是在扣球或打麻子,我肯定会选择1号。如果您正在建立一个认真的开发工作来使用这些工件,那么您必须至少做#3,甚至可能做#2#如果你真的打算大量使用maven,那么2对于让你的生活更轻松是至关重要的。这也是一次很好的教育经历,因为大多数maven的东西都假设,从概念上讲,您有自己的repo服务器。

我就是这么做的。下载gwt-dnd-3.1.1.jar并将其置于pom.xml的同一级别,然后运行命令:sudo mvn install:install file-DgroupId=com.google.code.gwt-dnd-DartifactId=gwt-dnd-Dversion=3.1.1-dpackage=jar-Dfile=gwt-dnd-3.1.1.jar result=BUILD SUCCESSFUL现在我该怎么办?我仍然没有war文件,也没有任何可执行文件在../targetI中实际运行应用程序。我认为它不需要位于pom.xml旁边。此外,请验证它是否已安装到您的本地存储库中;您只需在.m2/repository/my/maven/groupId/As/Directory/Structure/myArtifact+1中查找maven中关键概念的简明说明,就可以做到这一点。