无法解决工件:缺少,使用Eclipse和Robolectric

时间:2014-10-22 19:55:41

标签: java eclipse maven proxy robolectric

我和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:

1 个答案:

答案 0 :(得分: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的兴趣。