Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/179.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
Java 导入Unirest,依赖关系问题_Java_Android_Maven_Unirest - Fatal编程技术网

Java 导入Unirest,依赖关系问题

Java 导入Unirest,依赖关系问题,java,android,maven,unirest,Java,Android,Maven,Unirest,因此,我尝试导入以生成简单的http请求。 现在我遇到了有关Apache依赖项的重复依赖项的警告。我首先想到的解决方法是将其添加到build.grandle中: packagingOptions { exclude 'META-INF/DEPENDENCIES' exclude 'META-INF/NOTICE' exclude 'META-INF/LICENSE' exclude 'META-INF/LICENSE.txt' exclude 'META-

因此,我尝试导入以生成简单的http请求。 现在我遇到了有关Apache依赖项的重复依赖项的警告。我首先想到的解决方法是将其添加到build.grandle中:

packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
}
这确实使它运行起来,但在我使用任何Unirest功能时,它仍然崩溃。 所以回到谷歌来。我决定遵循的方向。所以我下载了mvn。首先,JAVA_HOME出现了一些问题,但设置正确。然后我像他一样:编辑pom.xml后,在github目录的主文件夹中执行
mvncleansassembly:assembly

然而,对我来说,它不像他那样生成.jar文件

我做错了什么?你能帮我做一个吗:)

我确实得到了一个
target
文件夹,在
cmd
中,它正在下载一堆文件,但没有.jar文件

在目标文件夹中,我有4个子文件夹:类、maven状态、surefire报告、测试类

一些堆栈跟踪:在cmd中

Failed tests:   testPostRawBody(com.mashape.unirest.test.http.UnirestTest): expe
cted:<'"@[?????]-test-123-0.01090655...> but was:<'"@[?????]-test-123-0.01090655
...>

Tests run: 36, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.502 s
[INFO] Finished at: 2015-05-17T21:46:52+02:00
[INFO] Final Memory: 21M/178M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project unirest-java: There are test failures.
[ERROR]
[ERROR] Please refer to C:\Users\Ruud\Downloads\unirest-java-master\unirest-java
-master\target\surefire-reports for the individual test results.
[ERROR] -> [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/MojoFailureExc
eption
失败的测试:testPostRawBody(com.mashape.unirest.test.http.UnirestTest):exp

反恐执行官:但是是:我在尝试用依赖项构建jar文件时遇到了同样的问题。尝试运行修改后的mvn命令,但跳过测试

mvn清理程序集:程序集-Dmaven.test.skip=true

这对我有用。也请查看

-------------------------------------------------------------------------------
Test set: com.mashape.unirest.test.http.UnirestTest
-------------------------------------------------------------------------------
Tests run: 36, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 17.855 sec <<< FAILURE!
testPostRawBody(com.mashape.unirest.test.http.UnirestTest)  Time elapsed: 0.122 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<'"@[?????]-test-123-0.01090655...> but was:<'"@[?????]-test-123-0.01090655...>
    at org.junit.Assert.assertEquals(Assert.java:115)
    at org.junit.Assert.assertEquals(Assert.java:144)
    at com.mashape.unirest.test.http.UnirestTest.testPostRawBody(UnirestTest.java:151)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)