我正在尝试使用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 X和CentOS上工作正常,但在Ubuntu上出现此错误失败。这是“mvn compile -v”
Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.13.0-61-generic", arch: "amd64", family: "unix"
我是如何在Ubuntu 14.04上解决此问题的?非常感谢。
-----------------------编辑----------------------- --- mvn build -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...);