The missing symbol method was added in Java 1.5. Maven defaults to source level 1.4. Set your source/target to a minimum of 1.5 on the maven-compiler-plugin, see http://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-source-and-target.html.
Brett On Mon, Jan 12, 2009 at 10:11 PM, SamadLotia <[email protected]>wrote: > > Hello fellow Maven users, > I have been trying to compile an OSGi project created using the PAX > scripts. > In the source file ConsoleTaskManager.java on line 15 I have written: > > System.out.println(java.lang.String.format("%s", "Why will not this > compile?")); > > When I type "mvn install", I get the following error message: > > [INFO] [pax:compile] > [INFO] Compiling 5 source files to > /Users/slotia/src/csplugins-slotia/work-pir-api/target/classes > [INFO] [recovering meta-data] > [INFO] > ------------------------------------------------------------------------ > [ERROR] BUILD FAILURE > [INFO] > ------------------------------------------------------------------------ > [INFO] Compilation failure > > /Users/slotia/src/csplugins-slotia/work-pir-api/src/main/java/org/cytoscape/work/internal/ConsoleTaskManager.java:[15,41] > cannot find symbol > symbol : method format(java.lang.String,java.lang.String) > location: class java.lang.String > > > /Users/slotia/src/csplugins-slotia/work-pir-api/src/main/java/org/cytoscape/work/internal/ConsoleTaskManager.java:[15,41] > cannot find symbol > symbol : method format(java.lang.String,java.lang.String) > location: class java.lang.String > > If I uncomment the offending line, the project compiles fine. I also wrote > a > 5-line class file with the offending line, and it compiles fine with javac. > This suggests that there probably isn't a problem with the JDK. I have > tried > to clean the project, which deletes the target directory, delete the runner > directory, and delete the .m2 directory, but it still does not compile. > > Here are some specs of my system: > OS: Mac OS X 10.5.6 > Java: 1.5.0_16-b06-284 32-bit > Maven: 2.0.9 > > I am completely lost as to how to fix this. Any help would be greatly > appreciated. Thank you. > -- > View this message in context: > http://www.nabble.com/Cannot-compile-simple-code-tp21412538p21412538.html > Sent from the Maven - Users mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
