You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Paul Bourke <pa...@gmail.com> on 2013/02/18 23:18:08 UTC

Maven eating compiler errors?

Hi,

I'm having trouble where Maven is not showing compiler errors as one
would expect.

Take the following:

```
# Create a basic 'hello world' project
$ mvn archetype:generate -DgroupId=com.mycompany.app
-DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart
-DinteractiveMode=false

$ cd my-app/

# Add a syntax error
$ sed -i 's/println/printl/g' src/main/java/com/mycompany/app/App.java

# Try to compile
$ mvn package
```

I get the following:

...
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
(default-compile) on project my-app: Compilation failure
[ERROR] /home/bourke/tmp/my-app/src/main/java/com/mycompany/app/App.java:[11,18]
error: cannot find symbol
[ERROR] -> [Help 1]
...

It doesn't show me what symbol is wrong.  Compare with the default javac output:

$ javac src/main/java/com/mycompany/app/App.java
src/main/java/com/mycompany/app/App.java:11: error: cannot find symbol
        System.out.printl( "Hello World!" );
                  ^
  symbol:   method printl(String)
  location: variable out of type PrintStream
1 error

Obviously much more useful.

Any help much appreciated.
-Paul

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


Re: Maven eating compiler errors?

Posted by Paul Bourke <pa...@gmail.com>.
Ok I understand what you mean now.

Adding the stanza listed at
http://maven.apache.org/plugins/maven-compiler-plugin/usage.html has
given me better output:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.0:compile
(default-compile) on project my-app: Compilation failure
[ERROR] /home/bourke/tmp/my-app/src/main/java/com/mycompany/app/App.java:[11,19]
cannot find symbol
[ERROR] symbol:   method printl(java.lang.String)
[ERROR] location: variable out of type java.io.PrintStream
[ERROR] -> [Help 1]

Thanks very much :)

-Paul

On 18 February 2013 22:47, Paul Bourke <pa...@gmail.com> wrote:
> Ah, sorry, I meant to include version info in my original mail.
>
> $ mvn --version
> Apache Maven 3.0.4
> Maven home: /usr/share/maven
> Java version: 1.7.0_13, vendor: Oracle Corporation
> Java home: /usr/lib/jvm/jdk1.7.0_13/jre
> Default locale: en_IE, platform encoding: UTF-8
> OS name: "linux", version: "3.5.0-23-generic", arch: "amd64", family: "unix"
>
> I've placed the pom contents at https://gist.github.com/brk3/4981471
> (unsure which field represents the plugin version...)
>
> -Paul
>
> On 18 February 2013 22:26, Anders Hammar <an...@hammar.net> wrote:
>> If you use version 3.0 of maven-compiler-plugin it should give you better
>> info if you use JDK 1.6+. You need to pin down the version of the plugin in
>> the pom.
>>
>> /Anders
>>
>>
>> On Mon, Feb 18, 2013 at 11:18 PM, Paul Bourke <pa...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> I'm having trouble where Maven is not showing compiler errors as one
>>> would expect.
>>>
>>> Take the following:
>>>
>>> ```
>>> # Create a basic 'hello world' project
>>> $ mvn archetype:generate -DgroupId=com.mycompany.app
>>> -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart
>>> -DinteractiveMode=false
>>>
>>> $ cd my-app/
>>>
>>> # Add a syntax error
>>> $ sed -i 's/println/printl/g' src/main/java/com/mycompany/app/App.java
>>>
>>> # Try to compile
>>> $ mvn package
>>> ```
>>>
>>> I get the following:
>>>
>>> ...
>>> [ERROR] Failed to execute goal
>>> org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
>>> (default-compile) on project my-app: Compilation failure
>>> [ERROR]
>>> /home/bourke/tmp/my-app/src/main/java/com/mycompany/app/App.java:[11,18]
>>> error: cannot find symbol
>>> [ERROR] -> [Help 1]
>>> ...
>>>
>>> It doesn't show me what symbol is wrong.  Compare with the default javac
>>> output:
>>>
>>> $ javac src/main/java/com/mycompany/app/App.java
>>> src/main/java/com/mycompany/app/App.java:11: error: cannot find symbol
>>>         System.out.printl( "Hello World!" );
>>>                   ^
>>>   symbol:   method printl(String)
>>>   location: variable out of type PrintStream
>>> 1 error
>>>
>>> Obviously much more useful.
>>>
>>> Any help much appreciated.
>>> -Paul
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>

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


Re: Maven eating compiler errors?

Posted by Paul Bourke <pa...@gmail.com>.
Ah, sorry, I meant to include version info in my original mail.

$ mvn --version
Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.7.0_13, vendor: Oracle Corporation
Java home: /usr/lib/jvm/jdk1.7.0_13/jre
Default locale: en_IE, platform encoding: UTF-8
OS name: "linux", version: "3.5.0-23-generic", arch: "amd64", family: "unix"

I've placed the pom contents at https://gist.github.com/brk3/4981471
(unsure which field represents the plugin version...)

-Paul

On 18 February 2013 22:26, Anders Hammar <an...@hammar.net> wrote:
> If you use version 3.0 of maven-compiler-plugin it should give you better
> info if you use JDK 1.6+. You need to pin down the version of the plugin in
> the pom.
>
> /Anders
>
>
> On Mon, Feb 18, 2013 at 11:18 PM, Paul Bourke <pa...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm having trouble where Maven is not showing compiler errors as one
>> would expect.
>>
>> Take the following:
>>
>> ```
>> # Create a basic 'hello world' project
>> $ mvn archetype:generate -DgroupId=com.mycompany.app
>> -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart
>> -DinteractiveMode=false
>>
>> $ cd my-app/
>>
>> # Add a syntax error
>> $ sed -i 's/println/printl/g' src/main/java/com/mycompany/app/App.java
>>
>> # Try to compile
>> $ mvn package
>> ```
>>
>> I get the following:
>>
>> ...
>> [ERROR] Failed to execute goal
>> org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
>> (default-compile) on project my-app: Compilation failure
>> [ERROR]
>> /home/bourke/tmp/my-app/src/main/java/com/mycompany/app/App.java:[11,18]
>> error: cannot find symbol
>> [ERROR] -> [Help 1]
>> ...
>>
>> It doesn't show me what symbol is wrong.  Compare with the default javac
>> output:
>>
>> $ javac src/main/java/com/mycompany/app/App.java
>> src/main/java/com/mycompany/app/App.java:11: error: cannot find symbol
>>         System.out.printl( "Hello World!" );
>>                   ^
>>   symbol:   method printl(String)
>>   location: variable out of type PrintStream
>> 1 error
>>
>> Obviously much more useful.
>>
>> Any help much appreciated.
>> -Paul
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>

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


Re: Maven eating compiler errors?

Posted by Anders Hammar <an...@hammar.net>.
If you use version 3.0 of maven-compiler-plugin it should give you better
info if you use JDK 1.6+. You need to pin down the version of the plugin in
the pom.

/Anders


On Mon, Feb 18, 2013 at 11:18 PM, Paul Bourke <pa...@gmail.com> wrote:

> Hi,
>
> I'm having trouble where Maven is not showing compiler errors as one
> would expect.
>
> Take the following:
>
> ```
> # Create a basic 'hello world' project
> $ mvn archetype:generate -DgroupId=com.mycompany.app
> -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart
> -DinteractiveMode=false
>
> $ cd my-app/
>
> # Add a syntax error
> $ sed -i 's/println/printl/g' src/main/java/com/mycompany/app/App.java
>
> # Try to compile
> $ mvn package
> ```
>
> I get the following:
>
> ...
> [ERROR] Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile
> (default-compile) on project my-app: Compilation failure
> [ERROR]
> /home/bourke/tmp/my-app/src/main/java/com/mycompany/app/App.java:[11,18]
> error: cannot find symbol
> [ERROR] -> [Help 1]
> ...
>
> It doesn't show me what symbol is wrong.  Compare with the default javac
> output:
>
> $ javac src/main/java/com/mycompany/app/App.java
> src/main/java/com/mycompany/app/App.java:11: error: cannot find symbol
>         System.out.printl( "Hello World!" );
>                   ^
>   symbol:   method printl(String)
>   location: variable out of type PrintStream
> 1 error
>
> Obviously much more useful.
>
> Any help much appreciated.
> -Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>