Skip to content

Commit

Permalink
Fixes #2&0
Browse files Browse the repository at this point in the history
  • Loading branch information
Riduidel committed Sep 7, 2022
1 parent 163e789 commit 6b2f1e5
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.io.File;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.net.ServerSocket;
import java.nio.file.FileSystems;
import java.nio.file.Path;
Expand All @@ -37,6 +38,11 @@

import net_alchim31_livereload.LRServer; //#from net.alchim31:livereload-jvm:0.2.0

/**
* Allow faster edit loop by rebuilding documentation and making it available through live-reload protocol.
* @author nicolas-delsaux
*
*/
@Mojo(name = "livereload", defaultPhase = LifecyclePhase.PACKAGE)
public class LiveReload extends AbstractMojo {
@Parameter(defaultValue = "${mojo.groupId}")
Expand Down Expand Up @@ -88,15 +94,7 @@ public class LiveReload extends AbstractMojo {
* </ul>
*/
@Parameter(name="goals-to-execute")
private List<String> goalsToExecute = Arrays.asList("prepare-package",
String.format("%s:%s@generate-html-docs",mojoGroupId, mojoArtifactId, getMojoNameOf(GenerateHtmlDocs.class)),
String.format("%s:%s@generate-html-slides",mojoGroupId, mojoArtifactId, getMojoNameOf(GenerateHtmlSlides.class))
);

private static String getMojoNameOf(Class<? extends AbstractMojo> mojoClass) {
Mojo mojo = mojoClass.getDeclaredAnnotation(Mojo.class);
return mojo.name();
}
private List<String> goalsToExecute = null;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
Expand Down Expand Up @@ -140,6 +138,12 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

private Element[] goals() {
if(goalsToExecute==null) {
goalsToExecute = Arrays.asList("prepare-package",
String.format("%s:%s:generate-html-docs",mojoGroupId, mojoArtifactId),
String.format("%s:%s:generate-html-slides",mojoGroupId, mojoArtifactId)
);
}
// First, get our artifact name
return goalsToExecute.stream()
.map(text -> element(name("goal"), text))
Expand Down

0 comments on commit 6b2f1e5

Please sign in to comment.