On 2023/10/22 02:38:07 Alexander Kriegisch wrote:
> Hello Michael, hello community.
> 
> I have decided to actually change the plugin's behaviour the way I
> described:
> 
>   -- I overrode the default value of AbstractMavenReport.outputDirectory
>      [1] by defining a setter method and adding a @Parameter annotation,
>      specifying ${project.build.directory} as the base direcory for the
>      report, because this is what I want to use when the mojo is
>      executed directly. The abstract super class defaults to
>      ${project.reporting.outputDirectory}, which is IMO suboptimal. In a
>      site generation context, the report directory is set automatically
>      anyway, because AbstractMavenReport.setReportOutputDirectory, as
>      mentioned in my original message, sets both reportOutputDirectory
>      and outputDirectory. BTW, is this "trick" to override an inherited
>      property correct? Is there a canonical way to do that?
> 
>   -- Then, I introduced a new reportDirectory [2] property, whis is just
>      a String, not a File. It specifies the subdirectory to be appended
>      to outputDirectory [3]. This works in both use cases, stand-alone
>      mojo execution and site generation.
> 
>   -- Hence, it is now possible to configure the base directory and the
>      subdirectory name separately: The base directory is set in the
>      identically named property outputDirectory, either in the plugin or
>      in Maven Site, depending on the use case. The subdirectory is set
>      in the new reportDirectory property. I.e., reports will end up in
>      the following directories:
>        ** without configuration, stand-alone:
>           target/aspectj-report
>        ** without configuration, site generation:
>           target/site/aspectj-report
>        ** custom base directory, stand-alone: e.g.
>           my-target/aspectj-report
>        ** custom base directory, site generation: e.g.
>           target/my-site/aspectj-report
>        ** custom subdirectory, stand-alone: e.g.
>           target/my-aspectj-report
>        ** custom subdirectory, site generation: e.g.
>           target/site/my-aspectj-report
>        ** custom base + subdirectory, stand-alone: e.g.
>           my-target/my-aspectj-report
>        ** custom base + subdirectory, site generation: e.g.
>           target/my-site/my-aspectj-report
>      Notably, the custom base directory for site generation should work
>      for all plugins playing nicely, e.g. Javadoc or (now after my
>      change) AspectJ. See the integration tests [4] for examples, namely
>      CreateReport* test cases for stand-alone and CreateSite* ones for
>      site generation use cases. For each test case, compare the
>      differences in Maven Site and AspexctJ Maven settings and the
>      corresponding checks in verify.groovy.
> 
> [1] 
> https://github.com/dev-aspectj/aspectj-maven-plugin/blob/9f2d0e97ed963c2b69a7fdf731a4c919a6bb56ef/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java#L90-L106
> [2] 
> https://github.com/dev-aspectj/aspectj-maven-plugin/blob/9f2d0e97ed963c2b69a7fdf731a4c919a6bb56ef/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java#L57-L67
> [3] 
> https://github.com/dev-aspectj/aspectj-maven-plugin/blob/9f2d0e97ed963c2b69a7fdf731a4c919a6bb56ef/src/main/java/org/codehaus/mojo/aspectj/AjcReportMojo.java#L255
> [4] https://github.com/dev-aspectj/aspectj-maven-plugin/tree/main/src/it

Just checked these. They look reasonable. I need to check MJAVADOC whether it 
is reasonable or not. Let's continue with the open PRs.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to