Uploaded image for project: 'Maven Javadoc Plugin'
  1. Maven Javadoc Plugin
  2. MJAVADOC-347

javadoc:aggregate-jar doesn't create Javadoc JAR if failOnError=false and there is an error

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.8.1
    • 2.10.3
    • None
    • None

    Description

      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:

              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 );
              }
      

      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.

      Attachments

        Activity

          People

            khmarbaise Karl Heinz Marbaise
            luuuis Luis Miranda
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: