Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.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 Maven生成失败:无法分析错误消息:方法:格式_Java_Maven_Ubuntu 14.04 - Fatal编程技术网

Java Maven生成失败:无法分析错误消息:方法:格式

Java Maven生成失败:无法分析错误消息:方法:格式,java,maven,ubuntu-14.04,Java,Maven,Ubuntu 14.04,我试图用Maven构建我的java项目,但是,我得到了以下错误: [ERROR] could not parse error message: symbol: method format(String,int,int) [ERROR] location: class String 我想基本上是因为找不到String.format方法 String.format(pathTemplate, useD8 ? 8 : 40, transactionFileNumber) 编译在OS

我试图用Maven构建我的java项目,但是,我得到了以下错误:

[ERROR] could not parse error message:   symbol:   method     format(String,int,int)
[ERROR] location: class String
我想基本上是因为找不到String.format方法

String.format(pathTemplate, useD8 ? 8 : 40, transactionFileNumber)
编译在OSX和CentOS上运行良好,但在Ubuntu上由于此错误而失败。这里是“mvn编译-v”

我可以在Ubuntu 14.04上解决这个问题吗?非常感谢

-----------------------编辑-------------------------- mvn构建的输出-X

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project sales: Compilation failure: Compilation failure:
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:[48,35] error: cannot find symbol
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,int,int)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:171: error: cannot find symbol
[ERROR] System.err.println(String.format("Type %d: Total Transactions: %d", i, transactionCounts[i]));
[ERROR] ^
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,int,int)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:172: error: cannot find symbol
[ERROR] System.err.println(String.format("Type %d: Time used: %f s", i, duration));
[ERROR] ^
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,int,float)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:173: error: cannot find symbol
[ERROR] System.err.println(String.format("Type %d: Throughput: %f", i, throughput));
[ERROR] ^
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,int,float)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:176: error: cannot find symbol
[ERROR] System.err.println(String.format("Overall: Total Transactions: %d", totalCounts));
[ERROR] ^
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,int)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:177: error: cannot find symbol
[ERROR] System.err.println(String.format("Overall: Time used: %f s", totalTiming));
[ERROR] ^
[ERROR] 
[ERROR] could not parse error message:   symbol:   method format(String,float)
[ERROR] location: class String
[ERROR] /home/junchao/Desktop/repos/Cassandra-benchmarking/app/src/main/java/cs4224/ClientApp.java:178: error: cannot find symbol
[ERROR] System.err.println(String.format("Overall: Throughput: %f", throughput));
[ERROR] ^
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project sales: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:516)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
javap java.lang.String | grep格式的输出

public static java.lang.String format(java.lang.String, java.lang.Object...);
  public static java.lang.String format(java.util.Locale, java.lang.String, java.lang.Object...);

你能用
-X
进行mvn并检查输出吗?你从哪里得到消息?从编译器插件?您是否已配置将源/目标设置为java 7/8?我建议您检查openJdk发行版中java.lang.String的确切API:只需打开一个shell并执行
javap java.lang.String
。然后在生成的输出中查找格式(字符串、对象…)。您可以使用
-X
进行mvn并检查输出吗?您从哪里获得消息?从编译器插件?您是否已配置将源/目标设置为java 7/8?我建议您检查openJdk发行版中java.lang.String的确切API:只需打开一个shell并执行
javap java.lang.String
。然后在生成的输出中查找格式(字符串、对象…)。
public static java.lang.String format(java.lang.String, java.lang.Object...);
  public static java.lang.String format(java.util.Locale, java.lang.String, java.lang.Object...);