Class AutoRefreshMojo

All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

@Mojo(name="auto-refresh", requiresDependencyResolution=TEST, threadSafe=true, aggregator=true) public class AutoRefreshMojo extends AbstractSiteRenderingMojo
Renders the site once completely and then watches for Doxia source file changes. After modifications the affected file(s) are re-rendered and the output files updated. The goal blocks until the user presses Enter.

This is intended for use during site development to provide immediate feedback on changes. It only works on a single project and does neither consider child projects nor site staging.

Since:
3.22.0
  • Field Details

    • outputDirectory

      @Parameter(property="siteOutputDirectory", defaultValue="${project.reporting.outputDirectory}") protected File outputDirectory
      Directory where the project sites and report distributions will be generated (as html/css/...).
    • pollingInterval

      @Parameter(property="auto-refresh.interval", defaultValue="1000") private long pollingInterval
      Polling interval in milliseconds for watching file changes.
    • generateReports

      @Parameter(property="generateReports", defaultValue="true") private boolean generateReports
      Whether to generate reports during initial rendering.
    • prompter

      private final org.codehaus.plexus.components.interactivity.Prompter prompter
  • Constructor Details

    • AutoRefreshMojo

      @Inject public AutoRefreshMojo(org.apache.maven.doxia.site.inheritance.SiteModelInheritanceAssembler assembler, org.apache.maven.doxia.siterenderer.SiteRenderer siteRenderer, org.apache.maven.reporting.exec.MavenReportExecutor mavenReportExecutor, org.codehaus.plexus.components.interactivity.Prompter prompter)
  • Method Details

    • execute

      public void execute() throws org.apache.maven.plugin.MojoExecutionException, org.apache.maven.plugin.MojoFailureException
      Throws:
      org.apache.maven.plugin.MojoExecutionException
      org.apache.maven.plugin.MojoFailureException
    • handleDeletion

      private void handleDeletion(File deletedFile, List<Locale> localesList)
    • triggerRerender

      private void triggerRerender(File changedFile, List<Locale> localesList)
    • renderSite

      private void renderSite(Locale locale, List<org.apache.maven.reporting.exec.MavenReportExecution> reports, List<Locale> supportedLocales, File outputDirectory) throws IOException, org.apache.maven.doxia.siterenderer.RendererException, org.apache.maven.plugin.MojoFailureException, org.apache.maven.plugin.MojoExecutionException
      Throws:
      IOException
      org.apache.maven.doxia.siterenderer.RendererException
      org.apache.maven.plugin.MojoFailureException
      org.apache.maven.plugin.MojoExecutionException
    • getOutputDirectory

      private File getOutputDirectory(Locale locale)