@ SuppressWarnings ( "unchecked" ) protected void executeReport ( Locale locale ) throws MavenReportException { getLog ( ) . info ( "Starting generating ajdoc" ) ; project . getCompileSourceRoots ( ) . add ( basedir . getAbsolutePath ( ) + "/" + aspectDirectory ) ; project . getTestCompileSourceRoots ( ) . add ( basedir . getAbsolutePath ( ) + "/" + testAspectDirectory ) ; List < String > arguments = new ArrayList < String > ( ) ; // Add classpath arguments . add ( "-classpath" ) ; arguments . add ( AjcHelper . createClassPath ( project , pluginArtifacts , getClasspathDirectories ( ) ) ) ; arguments . addAll ( ajcOptions ) ; Set < String > includes ; try { if ( null != ajdtBuildDefFile ) { includes = AjcHelper . getBuildFilesForAjdtFile ( ajdtBuildDefFile , basedir ) ; } else { includes = AjcHelper . getBuildFilesForSourceDirs ( getSourceDirectories ( ) , this . includes , this . excludes ) ; } } catch ( MojoExecutionException e ) { throw new MavenReportException ( "AspectJ Report failed" , e ) ; } // add target dir argument arguments . add ( "-d" ) ; arguments . add ( StringUtils . replace ( getOutputDirectory ( ) , "//" , "/" ) ) ; arguments . addAll ( includes ) ; if ( getLog ( ) . isDebugEnabled ( ) ) { StringBuilder command = new StringBuilder ( "Running : ajdoc " ) ; for ( String argument : arguments ) { command . append ( ' ' ) . append ( argument ) ; } getLog ( ) . debug ( command ) ; } // There seems to be a difference in classloading when calling 'mvn site' or 'mvn aspectj:aspectj-report'. // When calling mvn site, without the contextClassLoader set, you might see the next message: // javadoc: error - Cannot find doclet class com.sun.tools.doclets.standard.Standard ClassLoader oldContextClassLoader = Thread . currentThread ( ) . getContextClassLoader ( ) ; try { Thread . currentThread ( ) . setContextClassLoader ( this . getClass ( ) . getClassLoader ( ) ) ; // MASPECTJ-11: Make the ajdoc use the ${project.build.directory} directory for its intermediate folder. // The argument should be the absolute path to the parent directory of the "ajdocworkingdir" folder. Main . setOutputWorkingDir ( buildDirectory . getAbsolutePath ( ) ) ; // Now produce the JavaDoc. Main . main ( ( String [ ] ) arguments . toArray ( new String [ 0 ] ) ) ; } finally { Thread . currentThread ( ) . setContextClassLoader ( oldContextClassLoader ) ; } }
Executes this ajdoc - report generation .