我下载了一个项目并运行mvn clean package
,然后它会自动下载文件,但会失败。这是我第一次使用Maven。我在Internet上搜索了错误日志,但是仍然不知道如何处理它。请帮助我,谢谢。
Running cc.shanruifeng.functions.udfs.scalar.string.ChineseToPinYinFunctionsTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec
Running cc.shanruifeng.functions.udfs.scalar.string.HashFunctionsTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.063 sec
Results :
Failed tests: testGetIdCardProvince(cc.shanruifeng.functions.udfs.scalar.strin
g.ChinaIdCardFunctionsTest): expected:<[???]> but was:<[å??京å??]>
testGetIdCardArea(cc.shanruifeng.functions.udfs.scalar.string.ChinaIdCardFunct
ionsTest): expected:<[???]> but was:<[ä??å??å?º]>
testGetIdCardCity(cc.shanruifeng.functions.udfs.scalar.string.ChinaIdCardFunct
ionsTest): expected:<[???]> but was:<[å??京å??]>
Tests run: 41, Failures: 3, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.916 s
[INFO] Finished at: 2018-06-21T12:13:16-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
12.4:test (default-test) on project presto-third-functions: There are test failu
res.
[ERROR]
[ERROR] Please refer to C:\Users\Z\Desktop\s\PrestoFunctions\target\surefire-rep
orts for the individual test results.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal o
rg.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on proj
ect presto-third-functions: There are test failures.
Please refer to C:\Users\Z\Desktop\s\PrestoFunctions\target\surefire-reports for
the individual test results.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:213)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreaded
Builder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt
arter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.jav
a:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessor
Impl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche
r.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2
29)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc
her.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356
)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures
.
Please refer to C:\Users\Z\Desktop\s\PrestoFunctions\target\surefire-reports for
the individual test results.
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution (Surefire
Helper.java:83)
at org.apache.maven.plugin.surefire.SurefirePlugin.writeSummary (SurefirePlu
gin.java:176)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary (SurefirePl
ugin.java:150)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPrecond
itionsChecked (AbstractSurefireMojo.java:650)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSu
refireMojo.java:586)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBui
ldPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:154)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.ja
va:146)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (
LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreaded
Builder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleSt
arter.java:128)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:290)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:194)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.jav
a:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessor
Impl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launche
r.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:2
29)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launc
her.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356
)
[ERROR]
[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
我也输入了[Help 1]给出的链接,但仍然无济于事。
我在stackoverflow上发现了一些问题,很多答案都说如果有pom会更好,所以我发布了它。
谢谢!
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cc.shanruifeng</groupId>
<artifactId>presto-third-functions</artifactId>
<version>0.5.1</version>
-<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.targetJdk>1.8</project.build.targetJdk>
<project.report.outputEncoding>UTF-8</project.report.outputEncoding>
<project.report.inputEncoding>UTF-8</project.report.inputEncoding>
<presto.version>0.167</presto.version>
<guava.version>20.0</guava.version>
<joda.version>2.8.2</joda.version>
<airlift.version>0.139</airlift.version>
<pinyin4j.version>2.5.0</pinyin4j.version>
<commons-codec.version>1.10</commons-codec.version>
<junit.version>4.12</junit.version>
<org.slf4j.version>1.7.12</org.slf4j.version>
</properties>
-<dependencyManagement>
-<dependencies>
-<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-spi</artifactId>
<version>${presto.version}</version>
</dependency>
-<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
<version>${presto.version}</version>
</dependency>
-<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
-<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.version}</version>
</dependency>
-<dependency>
<groupId>io.airlift</groupId>
<artifactId>json</artifactId>
<version>${airlift.version}</version>
</dependency>
-<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
-<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
-<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<!-- Logger -->
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
-<dependencies>
-<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-spi</artifactId>
<scope>provided</scope>
</dependency>
-<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-main</artifactId>
<scope>test</scope>
</dependency>
-<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>2.0.3</version>
</dependency>
-<dependency>
<groupId>it.unimi.dsi</groupId>
<artifactId>fastutil</artifactId>
<version>6.5.9</version>
</dependency>
-<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
-<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
-<dependency>
<groupId>io.airlift</groupId>
<artifactId>json</artifactId>
</dependency>
-<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
</dependency>
-<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
-<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<!-- Logger -->
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</dependency>
-<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
</dependency>
</dependencies>
-<build>
<sourceDirectory>src/main/java</sourceDirectory>
-<plugins>
-<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
-<executions>
-<execution>
<phase>package</phase>
-<goals>
<goal>shade</goal>
</goals>
-<configuration>
-<artifactSet>
-<excludes>
<exclude/>
</excludes>
</artifactSet>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
<!-- Tweak the compiler to use more memory and use UTF-8 for the source code. -->
-<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
-<configuration>
<source>${project.build.targetJdk}</source>
<target>${project.build.targetJdk}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<!-- Resource plugins should always use UTF-8 -->
-<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
-<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
答案 0 :(得分:1)
[Help 1]给出的链接只是有关构建失败的一般信息。 您必须从日志中读取以前的信息。所以..
原因:org.apache.maven.plugin.MojoFailureException: 测试失败
测试失败:
testGetIdCardProvince(cc.shanruifeng.functions.udfs.scalar.strin g.ChinaIdCardFunctionsTest):预期:<[???]>但原为:<[å??京å??]>
testGetIdCardArea(cc.shanruifeng.functions.udfs.scalar.string.ChinaIdCardFunct ionsTest):预期:<[???]>但原为:<[ä??å??å?º]>
testGetIdCardCity(cc.shanruifeng.functions.udfs.scalar.string.ChinaIdCardFunct ionsTest):预期:<[???]>但是:<[å??京å??]>运行测试:41,失败:3,错误:0,跳过:0
修复测试后,一切都会好起来的。
答案 1 :(得分:0)
由于测试失败,因此您可以选择是否要跳过测试:
mvn clean compile install -DskipTests