【问题标题】:Unable to resolve artifact: Missing, using Eclipse and Robolectric无法解决工件:丢失,使用 Eclipse 和 Robolectric
【发布时间】:2014-10-22 19:55:40
【问题描述】:

我在 Robolectric 上玩得很不愉快。我在 Eclipse 中使用 Robolectric。首先安装,现在运行我的测试。我收到以下错误。我知道这与我的代理问题有关,但我想知道是否有人可以解决。我需要在 Eclipse 中配置代理吗?还是手动安装?如果我进行手动安装,我如何运行 mvn 命令行?

有什么建议吗?

已编辑。

Unable to resolve artifact: Missing:
----------
1) org.robolectric:android-all:jar:4.3_r2-robolectric-0

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.robolectric -DartifactId=android-all -Dversion=4.3_r2-robolectric-0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:pom:2.0
        2) org.robolectric:android-all:jar:4.3_r2-robolectric-0

2) org.json:json:jar:20080701

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.json -DartifactId=json -Dversion=20080701 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:pom:2.0
        2) org.json:json:jar:20080701

3) org.ccil.cowan.tagsoup:tagsoup:jar:1.2

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=org.ccil.cowan.tagsoup -DartifactId=tagsoup -Dversion=1.2 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.apache.maven:super-pom:pom:2.0
        2) org.ccil.cowan.tagsoup:tagsoup:jar:1.2

----------
3 required artifacts are missing.

for artifact:
  org.apache.maven:super-pom:pom:2.0

from the specified remote repositories:
  sonatype (https://oss.sonatype.org/content/groups/public/),
  central (http://repo1.maven.org/maven2)


        at org.apache.maven.artifact.ant.DependenciesTask.doExecuteResolution(DependenciesTask.java:268)
        at org.apache.maven.artifact.ant.DependenciesTask.doExecute(DependenciesTask.java:168)
        at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:751)
        at org.robolectric.MavenCentral.getLocalArtifactUrls(MavenCentral.java:35)
        at org.robolectric.RobolectricTestRunner.createRobolectricClassLoader(RobolectricTestRunner.java:145)
        at org.robolectric.RobolectricTestRunner.createSdkEnvironment(RobolectricTestRunner.java:115)
        at org.robolectric.RobolectricTestRunner$3.create(RobolectricTestRunner.java:307)
        at org.robolectric.EnvHolder.getSdkEnvironment(EnvHolder.java:21)
        at org.robolectric.RobolectricTestRunner.getEnvironment(RobolectricTestRunner.java:305)
        at org.robolectric.RobolectricTestRunner.access$300(RobolectricTestRunner.java:61)
        at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:202)
        at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
        at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:

【问题讨论】:

  • 请在此处粘贴您的堆栈跟踪,而不是在其他网站上...
  • 你能不能也分享一下你的pom。
  • @wrongAnswer,其实我没有。我正在使用带有 m2e 插件的 ADT Eclipse。但是我的项目没有maven结构。我认为,这是一个代理问题,而不是一个 Maven 问题。

标签: java eclipse maven proxy robolectric


【解决方案1】:

它现在正在工作:)。结果使用 m2e 插件(Eclipse 的 Maven 插件),Maven 正在C:\Users\<USER>\.m2\settings.xml 中寻找一个 settings.xml 文件。该文件有类似这样的内容:

<settings>
  .
  .
  <proxies>
   <proxy>
      <active>true</active>
      <protocol>http</protocol>
      <host>proxy.somewhere.com</host>
      <port>8080</port>
      <username>proxyuser</username>
      <password>somepassword</password>
      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    </proxy>
  </proxies>
  .
  .
</settings>

我认为,之前没有工作,因为settings 标签丢失了。感谢@wrongAnswer 的关注。

【讨论】:

    猜你喜欢
    • 2010-12-29
    • 2013-12-22
    • 2014-01-30
    • 1970-01-01
    • 1970-01-01
    • 2015-12-25
    • 2016-10-17
    • 2019-04-12
    • 1970-01-01
    相关资源
    最近更新 更多