Luís Miranda created MJAVADOC-347:
-------------------------------------

             Summary: javadoc:aggregate-jar doesn't create Javadoc JAR if 
failOnError=false and there is an error
                 Key: MJAVADOC-347
                 URL: https://jira.codehaus.org/browse/MJAVADOC-347
             Project: Maven 2.x Javadoc Plugin
          Issue Type: Bug
    Affects Versions: 2.8.1
            Reporter: Luís Miranda


We are generating Javadocs for a large multi-module build, so there are bound 
to be some errors (for example, in 3rd party dependencies).

Currently we set failOnError=false, but we found that the {{aggregate-jar}} 
MOJO does not produce a JAR if there are errors. The problem comes down to this 
code in JavadocJar:

{code}
        try
        {
            executeReport( Locale.getDefault() );

            if ( innerDestDir.exists() )
            {
                File outputFile = generateArchive( innerDestDir, finalName + 
"-" + getClassifier() + ".jar" );

                if ( !attach )
                {
                    getLog().info( "NOT adding javadoc to attached artifacts 
list." );
                }
                else
                {
                    // TODO: these introduced dependencies on the project are 
going to become problematic - can we expor
                    //  through metadata instead?
                    projectHelper.attachArtifact( project, "javadoc", 
getClassifier(), outputFile );
                }
            }
        }
        catch ( ArchiverException e )
        {
            failOnError( "ArchiverException: Error while creating archive", e );
        }
        catch ( IOException e )
        {
            failOnError( "IOException: Error while creating archive", e );
        }
        catch ( MavenReportException e )
        {
            failOnError( "MavenReportException: Error while creating archive", 
e );
        }
        catch ( RuntimeException e )
        {
            failOnError( "RuntimeException: Error while creating archive", e );
        }
{code}

If there is an error in {{executeReport( Locale.getDefault() )}} then the MOJO 
will just give up and not try to create the archive. I think that if 
failOnError is set, then we should try to create the archive anyway.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to