You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ben Alex (JIRA)" <ji...@codehaus.org> on 2006/12/04 02:12:41 UTC

[jira] Created: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Add maven.compile.failonerror equivalent functionality
------------------------------------------------------

                 Key: MCOMPILER-48
                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
             Project: Maven 2.x Compiler Plugin
          Issue Type: Improvement
            Reporter: Ben Alex
            Priority: Critical


Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.

I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.

In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:

504         if ( compilationError )
505         {
506             throw new CompilationFailureException( messages );
507         }
508         else
509         {
510             for ( Iterator i = messages.iterator(); i.hasNext(); )
511             {
512                 CompilerError message = (CompilerError) i.next();
513 
514                 getLog().warn( message.toString() );
515             }
516         }

Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?

At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-48?page=all ]

Carlos Sanchez updated MCOMPILER-48:
------------------------------------

    Fix Version/s:     (was: 2.1)
                   2.0.2

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>         Assigned To: Carlos Sanchez
>            Priority: Critical
>             Fix For: 2.0.2
>
>         Attachments: compiler-failonerror-test.zip, compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-48?page=comments#action_81685 ] 
            
Ben Alex commented on MCOMPILER-48:
-----------------------------------

For those interested, the Maven 1 plugin documentation was at http://maven.apache.org/maven-1.x/plugins/java/properties.html and this feature is also available in Ant's javac (failonerror=false): http://ant.apache.org/manual/CoreTasks/javac.html

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-48?page=comments#action_83196 ] 
            
Carlos Sanchez commented on MCOMPILER-48:
-----------------------------------------

A maven.compiler.failOnError property would be fine

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-48?page=all ]

Ben Alex updated MCOMPILER-48:
------------------------------

    Attachment: compiler-failonerror-test.zip

New files that need to be added to SVN under the maven-compiler-plugin/src/test/resources/unit directory.

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>         Attachments: compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Alan Stewart (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-48?page=comments#action_82433 ] 
            
Alan Stewart commented on MCOMPILER-48:
---------------------------------------

Would it be possible to get clarification on this issue ASAP?  I can patch the code (at least for our own use) if I know a change like that described above will be approved. Thanks

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-48?page=comments#action_84595 ] 
            
Ben Alex commented on MCOMPILER-48:
-----------------------------------

The attached files implement the requested functionality. The unit tests pass and I added a new unit test to demonstrate the functionality works as intended.

Please note I needed to add explicit assignment of the default values for failOnError (and debug whilst there), as the @parameter default-value="true" did not appear to work. This may have been a build step I was missing and a commiter may wish to remove the explicit assignment.

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>         Attachments: compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-48?page=all ]

Ben Alex updated MCOMPILER-48:
------------------------------

    Attachment: compiler-failonerror-test.zip

Use this file, not attachment #1

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>         Attachments: compiler-failonerror-test.zip, compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MCOMPILER-48?page=comments#action_84686 ] 
            
Ben Alex commented on MCOMPILER-48:
-----------------------------------

If only JIRA maintained the same index numbers for attached files...

The two files to use are #1 and #3. Disregard the compiler-failonerror-test.zip with a timestamp of 10/Jan/07 12:56 AM.

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>         Attachments: compiler-failonerror-test.zip, compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-48?page=all ]

Carlos Sanchez closed MCOMPILER-48.
-----------------------------------

         Assignee: Carlos Sanchez
       Resolution: Fixed
    Fix Version/s: 2.1

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>         Assigned To: Carlos Sanchez
>            Priority: Critical
>             Fix For: 2.1
>
>         Attachments: compiler-failonerror-test.zip, compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MCOMPILER-48) Add maven.compile.failonerror equivalent functionality

Posted by "Ben Alex (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MCOMPILER-48?page=all ]

Ben Alex updated MCOMPILER-48:
------------------------------

    Attachment: patch.txt

Patch containing changes to existing SVN files.

> Add maven.compile.failonerror equivalent functionality
> ------------------------------------------------------
>
>                 Key: MCOMPILER-48
>                 URL: http://jira.codehaus.org/browse/MCOMPILER-48
>             Project: Maven 2.x Compiler Plugin
>          Issue Type: Improvement
>            Reporter: Ben Alex
>            Priority: Critical
>         Attachments: compiler-failonerror-test.zip, patch.txt
>
>
> Maven 1.x's "java" plugin offered a maven.compile.failonerror property, which could be set false in order to skip compilation errors.
> I am working on a code generation framework that uses a Maven plugin. The mojo spawns a parallel lifecycle via @execute phase="test-compile", as the mojo itself is @phase generate-sources. This is necessary as the code generator needs to instantiate certain classes to obtain metadata. The nature of the generated types means that users might write code that depends on the generated types to already be compiled on the classpath, although this has not yet happened at this phase because the code generator requires compiled classes first. By the time the generated-sources phase completes and releases to the original lifecycle, the subsequent compilation will work as the generated sources are now available for compilation.
> In practice this issue is easily resolved if AbstractCompilerMojo supported the Maven 1 style maven.compile.failonerror = false property, which could be injected via the MavenProject class during the parallel lifecycle (and reverted upon completion). The relevant lines are:
> 504         if ( compilationError )
> 505         {
> 506             throw new CompilationFailureException( messages );
> 507         }
> 508         else
> 509         {
> 510             for ( Iterator i = messages.iterator(); i.hasNext(); )
> 511             {
> 512                 CompilerError message = (CompilerError) i.next();
> 513 
> 514                 getLog().warn( message.toString() );
> 515             }
> 516         }
> Could you change line 504 to reference an injected property, so the exception can be consumed with simply a warning?
> At present I am planning on working around this issue by using exclude filters (excluding common filename patterns users are likely to generated dependent code for) but this is an inelegant solution by comparison with supporting the injected property. If there is another way to skip errors and I am not aware of it, would you please let me know. Thanks.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira