You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by SamadLotia <sa...@hotmail.com> on 2009/01/12 12:11:44 UTC

Cannot compile simple code

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cannot compile simple code

Posted by Jaikiran <ja...@yahoo.co.in>.
What does the following command output:

mvn -version

especially the Java version
-- 
View this message in context: http://www.nabble.com/Cannot-compile-simple-code-tp21412538p21412753.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cannot compile simple code

Posted by SamadLotia <sa...@hotmail.com>.
I apologize for the following typo: "If I uncomment the offending line",
which I meant to say, "If I comment the offending line".


SamadLotia 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-tp21412538p21412571.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cannot compile simple code

Posted by SamadLotia <sa...@hotmail.com>.
That fixed it.

Thank you!


Brett Randall-2 wrote:
> 
> 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
> <sa...@hotmail.com>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: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Cannot-compile-simple-code-tp21412538p21414859.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Cannot compile simple code

Posted by Brett Randall <ja...@gmail.com>.
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 <sa...@hotmail.com>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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>