From 8e30720bed15634380e88b7d6ac8178e72b11098 Mon Sep 17 00:00:00 2001 From: ybonnel Date: Tue, 1 Jul 2014 11:25:18 +0200 Subject: [PATCH 01/30] Upgrade jbake to 2.3.0 --- pom.xml | 2 +- .../java/br/com/ingenieux/mojo/jbake/GenerateMojo.java | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 68e4ce35..9b209c05 100644 --- a/pom.xml +++ b/pom.xml @@ -124,7 +124,7 @@ org.jbake jbake-core - 2.2.1 + 2.3.0 org.apache.maven diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index 2f1e55ce..df002b28 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -40,10 +40,16 @@ public class GenerateMojo extends AbstractMojo { */ @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) protected File inputDirectory; + + /** + * Set if cache is present or clear + */ + @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) + protected boolean isClearCache; public void execute() throws MojoExecutionException { try { - Oven oven = new Oven(inputDirectory, outputDirectory); + Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache); oven.setupPaths(); oven.bake(); From 6598eb9e4db1498b578f2a11d2ac1f26f2456a7d Mon Sep 17 00:00:00 2001 From: ybonnel Date: Tue, 1 Jul 2014 11:57:19 +0200 Subject: [PATCH 02/30] Add livereload for inline goal --- pom.xml | 9 ++++++ .../com/ingenieux/mojo/jbake/InlineMojo.java | 30 +++++++++++++++++++ .../com/ingenieux/mojo/jbake/WatchMojo.java | 7 +++++ 3 files changed, 46 insertions(+) diff --git a/pom.xml b/pom.xml index 68e4ce35..6eb10d20 100644 --- a/pom.xml +++ b/pom.xml @@ -75,6 +75,10 @@ + + net.alchim31 + livereload-jvm + org.apache.maven maven-plugin-api @@ -121,6 +125,11 @@ + + net.alchim31 + livereload-jvm + 0.2.0 + org.jbake jbake-core diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java index df2d6435..78bde29f 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -16,6 +16,8 @@ * limitations under the License. */ +import net_alchim31_livereload.LRServer; +import org.apache.commons.lang.BooleanUtils; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -25,6 +27,10 @@ import org.vertx.java.platform.Verticle; import java.io.File; +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Runs jbake on a folder while watching and serving a folder with it @@ -49,7 +55,14 @@ public class InlineMojo extends WatchMojo { @Parameter(property = "jbake.port", defaultValue = "8080") private Integer port; + /** + * Use livereload. + */ + @Parameter(property = "jbake.livereload", defaultValue = "true") + private Boolean livereload; + Server server = new Server(); + LRServer lrServer; class Server extends Verticle { { @@ -66,7 +79,9 @@ public void handle(HttpServerRequest req) { if (new File(outputDirectory + file).isDirectory()) { req.response().setStatusCode(301).putHeader("Location", file + "/").close(); } else { + refreshLock.readLock().lock(); req.response().sendFile(outputDirectory.getAbsolutePath() + file); + refreshLock.readLock().unlock(); } } }).listen(port, listenAddress); @@ -74,10 +89,25 @@ public void handle(HttpServerRequest req) { } protected void stopServer() { + if (lrServer != null) { + try { + lrServer.stop(); + } catch (Exception e) { + e.printStackTrace(); + } + } server.stop(); } protected void initServer() throws MojoExecutionException { server.start(); + if (BooleanUtils.isTrue(livereload)) { + lrServer = new LRServer(35729, outputDirectory.toPath()); + try { + lrServer.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } } } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java index 38d67212..b44897cc 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -24,12 +24,17 @@ import java.io.InputStreamReader; import java.nio.file.Paths; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; /** * Runs jbake on a folder while watching for changes */ @Mojo(name = "watch", requiresDirectInvocation = true, requiresProject = false) public class WatchMojo extends GenerateMojo { + + ReadWriteLock refreshLock = new ReentrantReadWriteLock(); + public void execute() throws MojoExecutionException { super.execute(); @@ -65,9 +70,11 @@ public void run() { if (Boolean.FALSE.equals(result)) { Thread.sleep(1000); } else if (Boolean.TRUE.equals(result)) { + refreshLock.writeLock().lock(); getLog().info("Refreshing"); super.execute(); + refreshLock.writeLock().unlock(); } else if (null == result) { break; } From a8967d93b2b266d6b6c733c3a509c0565e2645e6 Mon Sep 17 00:00:00 2001 From: ybonnel Date: Wed, 2 Jul 2014 10:50:14 +0200 Subject: [PATCH 03/30] Shutdown OrientDB to avoid error message on maven build --- src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java | 6 ++++++ src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index df002b28..fce0f089 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -16,6 +16,7 @@ * limitations under the License. */ +import com.orientechnologies.orient.core.Orient; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -53,10 +54,15 @@ public void execute() throws MojoExecutionException { oven.setupPaths(); oven.bake(); + shutdownDatabase(); } catch (Exception e) { getLog().info("Oops", e); throw new MojoExecutionException("Failure when running: ", e); } } + + protected void shutdownDatabase() { + Orient.instance().shutdown(); + } } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java index 38d67212..fefe78ca 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -17,6 +17,7 @@ */ import br.com.ingenieux.mojo.jbake.util.DirWatcher; +import com.orientechnologies.orient.core.Orient; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -80,6 +81,7 @@ public void run() { getLog().info("Finishing"); stopServer(); + Orient.instance().shutdown(); } } @@ -88,4 +90,8 @@ protected void stopServer() { protected void initServer() throws MojoExecutionException { } + + @Override + protected void shutdownDatabase() { + } } From 1c3354efa27b7189e7bf470fb37099e9fd5eeb12 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 1 Aug 2014 10:38:55 -0300 Subject: [PATCH 04/30] Minor tweaks to avoid excess re-parsing --- .../ingenieux/mojo/jbake/GenerateMojo.java | 64 +++++---- .../com/ingenieux/mojo/jbake/WatchMojo.java | 126 +++++++++--------- .../ingenieux/mojo/jbake/util/DirWatcher.java | 30 ++--- 3 files changed, 103 insertions(+), 117 deletions(-) diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index fce0f089..19442ba4 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -16,7 +16,6 @@ * limitations under the License. */ -import com.orientechnologies.orient.core.Orient; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -30,39 +29,38 @@ */ @Mojo(name = "generate", requiresProject = false) public class GenerateMojo extends AbstractMojo { - /** - * Location of the Output Directory. - */ - @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.build.directory}/${project.build.finalName}", required = true) - protected File outputDirectory; - - /** - * Location of the Output Directory. - */ - @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) - protected File inputDirectory; - /** - * Set if cache is present or clear - */ - @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) - protected boolean isClearCache; - - public void execute() throws MojoExecutionException { - try { - Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache); - - oven.setupPaths(); - oven.bake(); - shutdownDatabase(); - } catch (Exception e) { - getLog().info("Oops", e); - - throw new MojoExecutionException("Failure when running: ", e); - } - } + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.outputDirectory", + defaultValue = "${project.build.directory}/${project.build.finalName}", + required = true) + protected File outputDirectory; - protected void shutdownDatabase() { - Orient.instance().shutdown(); + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", + required = true) + protected File inputDirectory; + + /** + * Set if cache is present or clear + */ + @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) + protected boolean isClearCache; + + public void execute() throws MojoExecutionException { + try { + Oven oven = new Oven(inputDirectory, outputDirectory); + + oven.setupPaths(); + oven.bake(); + } catch (Exception e) { + getLog().info("Oops", e); + + throw new MojoExecutionException("Failure when running: ", e); } + } } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java index fefe78ca..1ae90b50 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -16,8 +16,6 @@ * limitations under the License. */ -import br.com.ingenieux.mojo.jbake.util.DirWatcher; -import com.orientechnologies.orient.core.Orient; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -26,72 +24,72 @@ import java.nio.file.Paths; import java.util.concurrent.atomic.AtomicBoolean; +import br.com.ingenieux.mojo.jbake.util.DirWatcher; + /** * Runs jbake on a folder while watching for changes */ @Mojo(name = "watch", requiresDirectInvocation = true, requiresProject = false) public class WatchMojo extends GenerateMojo { - public void execute() throws MojoExecutionException { - super.execute(); - - getLog().info( - "Now listening for changes on path " + inputDirectory.getPath()); - - initServer(); - - try { - final AtomicBoolean done = new AtomicBoolean(false); - final BufferedReader reader = new BufferedReader( - new InputStreamReader(System.in)); - - (new Thread() { - @Override - public void run() { - try { - getLog().info("Running. Hit to finish"); - reader.readLine(); - } catch (Exception exc) { - } finally { - done.set(true); - } - } - }).start(); - - DirWatcher dirWatcher = new DirWatcher(Paths.get(inputDirectory - .getPath())); - - do { - Boolean result = dirWatcher.processEvents(); - - if (Boolean.FALSE.equals(result)) { - Thread.sleep(1000); - } else if (Boolean.TRUE.equals(result)) { - getLog().info("Refreshing"); - - super.execute(); - } else if (null == result) { - break; - } - } while (!done.get()); - } catch (Exception exc) { - getLog().info("Oops", exc); - - throw new MojoExecutionException("Oops", exc); - } finally { - getLog().info("Finishing"); - - stopServer(); - Orient.instance().shutdown(); - } - } - - protected void stopServer() { - } - - protected void initServer() throws MojoExecutionException { - } - - @Override - protected void shutdownDatabase() { + + public void execute() throws MojoExecutionException { + super.execute(); + + getLog().info( + "Now listening for changes on path " + inputDirectory.getPath()); + + initServer(); + + try { + final AtomicBoolean done = new AtomicBoolean(false); + final BufferedReader reader = new BufferedReader( + new InputStreamReader(System.in)); + + (new Thread() { + @Override + public void run() { + try { + getLog().info("Running. Hit to finish"); + reader.readLine(); + } catch (Exception exc) { + } finally { + done.set(true); + } + } + }).start(); + + DirWatcher dirWatcher = new DirWatcher(Paths.get(inputDirectory + .getPath())); + + Long lastProcessed = Long.valueOf(System.currentTimeMillis()); + + do { + Long result = dirWatcher.processEvents(); + + if (null == result) { + Thread.sleep(1000); + } else if (result >= lastProcessed) { + getLog().info("Refreshing"); + + super.execute(); + + lastProcessed = Long.valueOf(System.currentTimeMillis()); + } + } while (!done.get()); + } catch (Exception exc) { + getLog().info("Oops", exc); + + throw new MojoExecutionException("Oops", exc); + } finally { + getLog().info("Finishing"); + + stopServer(); } + } + + protected void stopServer() { + } + + protected void initServer() throws MojoExecutionException { + } } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java b/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java index 42f839cd..e10c9fb4 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java @@ -1,11 +1,5 @@ package br.com.ingenieux.mojo.jbake.util; -import static java.nio.file.LinkOption.NOFOLLOW_LINKS; -import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; -import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; -import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; -import static java.nio.file.StandardWatchEventKinds.OVERFLOW; - import java.io.IOException; import java.nio.file.FileSystems; import java.nio.file.FileVisitResult; @@ -21,6 +15,12 @@ import java.util.Map; import java.util.concurrent.TimeUnit; +import static java.nio.file.LinkOption.NOFOLLOW_LINKS; +import static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE; +import static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE; +import static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY; +import static java.nio.file.StandardWatchEventKinds.OVERFLOW; + /** * Example to watch a directory (or tree) for changes to files. */ @@ -41,16 +41,6 @@ static WatchEvent cast(WatchEvent event) { private void register(Path dir) throws IOException { WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); - // if (trace) { - // Path prev = keys.get(key); - // if (prev == null) { - // System.out.format("register: %s\n", dir); - // } else { - // if (!dir.equals(prev)) { - // System.out.format("update: %s -> %s\n", prev, dir); - // } - // } - // } keys.put(key, dir); } @@ -83,17 +73,17 @@ public DirWatcher(Path dir) throws IOException { /** * Process all events for keys queued to the watcher */ - public Boolean processEvents() { + public Long processEvents() { // wait for key to be signalled WatchKey key; try { key = watcher.poll(1L, TimeUnit.SECONDS); } catch (InterruptedException x) { - return Boolean.FALSE; + return null; } if (null == key) - return Boolean.FALSE; + return null; Path dir = keys.get(key); if (dir == null) @@ -136,7 +126,7 @@ public Boolean processEvents() { } } - return Boolean.TRUE; + return Long.valueOf(System.currentTimeMillis()); } static void usage() { From ac2a343d9e02522bd9cf7d74d2e7d65e0725f193 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 1 Aug 2014 12:08:32 -0300 Subject: [PATCH 05/30] Updating Coordinates --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 5b1e2dfa..e98f0dab 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ github - https://bitbucket.org/ingenieux/jbake-maven-plugin/ + https://github.com/ingenieux/jbake-maven-plugin/ @@ -59,9 +59,9 @@ - scm:hg:http://bitbucket.org/ingenieux/jbake-maven-plugin - scm:hg:ssh://hg@bitbucket.org/ingenieux/jbake-maven-plugin - http://bitbucket.org/ingenieux/jbake-maven-plugin + scm:git:http://github.com/ingenieux/jbake-maven-plugin + scm:git:ssh://git@github.com/ingenieux/jbake-maven-plugin.git + http://github.com/ingenieux/jbake-maven-plugin From a0161942ff0c1aa6118b555ca18bd310e9fc2938 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 1 Aug 2014 12:11:42 -0300 Subject: [PATCH 06/30] Disabling javadoc validation --- pom.xml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index e98f0dab..8218be63 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,6 @@ - + 4.0.0 org.sonatype.oss @@ -12,7 +14,7 @@ 0.0.7-SNAPSHOT - 3.1.1 + 3.1.1 jbake-maven-plugin is a plugin to integrate JBake into your projects @@ -60,7 +62,8 @@ scm:git:http://github.com/ingenieux/jbake-maven-plugin - scm:git:ssh://git@github.com/ingenieux/jbake-maven-plugin.git + scm:git:ssh://git@github.com/ingenieux/jbake-maven-plugin.git + http://github.com/ingenieux/jbake-maven-plugin @@ -250,8 +253,19 @@ org.apache.maven.plugins - maven-site-plugin - 3.3 + maven-javadoc-plugin + 2.9 + + + attach-javadocs + + jar + + + -Xdoclint:none + + + From 49f4f6098753c83456cc2cfd11b210ff45c69a65 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 1 Aug 2014 12:12:28 -0300 Subject: [PATCH 07/30] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.7 --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 8218be63..43e609cf 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,4 @@ - + 4.0.0 org.sonatype.oss @@ -11,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.7-SNAPSHOT + 0.0.7 3.1.1 From 0db97db4de47ca13fbcb49bcbfe5886a4773c28c Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 1 Aug 2014 12:12:38 -0300 Subject: [PATCH 08/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 43e609cf..4542bd42 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.7 + 0.0.8-SNAPSHOT 3.1.1 From a073b3fc60c1fe2487f6307e1bdafe3b455f7891 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Thu, 16 Oct 2014 16:40:08 -0300 Subject: [PATCH 09/30] Updating for 2.3.2 --- pom.xml | 2 +- src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 4542bd42..2e37334b 100644 --- a/pom.xml +++ b/pom.xml @@ -134,7 +134,7 @@ org.jbake jbake-core - 2.3.1 + 2.3.2 org.apache.maven diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java index 35f9ba30..2ad69f5e 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -85,7 +85,7 @@ public void run() { } else if (result >= lastProcessed) { getLog().info("Refreshing"); - super.execute(); + super.reRender(); lastProcessed = Long.valueOf(System.currentTimeMillis()); } From 6fc33843320e0c596fb965ffd671b420fbef1bf2 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Thu, 16 Oct 2014 16:43:51 -0300 Subject: [PATCH 10/30] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.8 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2e37334b..3bca3e9e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.8-SNAPSHOT + 0.0.8 3.1.1 From c891f6685ae98f6e292dec3f2eacb5d196b9447c Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Thu, 16 Oct 2014 16:44:01 -0300 Subject: [PATCH 11/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3bca3e9e..3232bf34 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.8 + 0.0.9-SNAPSHOT 3.1.1 From d0367f2672e83e8127fe97e07a1c6dfccc235cb5 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 29 Dec 2014 10:29:30 -0300 Subject: [PATCH 12/30] Adding PR #7 for fixing #6 --- pom.xml | 1 - src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3232bf34..331df58f 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,6 @@ commons-io commons-io - 2.4 diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index 2f5d8e23..8436a583 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -75,6 +75,9 @@ protected void executeInternal() throws MojoExecutionException { protected void reRender() throws MojoExecutionException { try { + // TODO: Smells bad. A lot + Orient.instance().startup(); + // TODO: At some point, reuse Oven Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache); From 03321f024bb92a9e8a00fc830311863810b72cfa Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 29 Dec 2014 10:30:18 -0300 Subject: [PATCH 13/30] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.9 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 331df58f..b76b12e3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.9-SNAPSHOT + 0.0.9 3.1.1 From 5a6e6afa826138c43e834391fe455dda25207d9d Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 29 Dec 2014 10:30:32 -0300 Subject: [PATCH 14/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b76b12e3..ec5e15b4 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.9 + 0.0.10-SNAPSHOT 3.1.1 From 4b61ebaad8069183878f4e40fd2da6b7cef3abdf Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Tue, 17 Mar 2015 16:24:16 -0500 Subject: [PATCH 15/30] Update ctor to compile against latest JBake --- pom.xml | 2 +- .../br/com/ingenieux/mojo/jbake/GenerateMojo.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ec5e15b4..243399e3 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ org.jbake jbake-core - 2.3.2 + 2.3.3-SNAPSHOT org.apache.maven diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index 8436a583..81d9037c 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -25,6 +25,10 @@ import org.jbake.app.Oven; import java.io.File; +import org.apache.commons.configuration.CompositeConfiguration; +import org.apache.commons.configuration.ConfigurationException; +import org.jbake.app.ConfigUtil; +import org.jbake.app.JBakeException; /** * Runs jbake on a folder @@ -77,9 +81,16 @@ protected void reRender() throws MojoExecutionException { try { // TODO: Smells bad. A lot Orient.instance().startup(); + + final CompositeConfiguration config; + try { + config = ConfigUtil.load(inputDirectory); + } catch (final ConfigurationException e) { + throw new JBakeException("Configuration error: " + e.getMessage(), e); + } // TODO: At some point, reuse Oven - Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache); + Oven oven = new Oven(inputDirectory, outputDirectory, config, isClearCache); oven.setupPaths(); From e60195d21a2422206f1fa6569fcb99ef9d70da7a Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 24 Apr 2015 08:41:38 -0500 Subject: [PATCH 16/30] Create new packaging type Add lifecycle mapping in components.xml to override the default and site lifecycles --- pom.xml | 7 ++++ .../resources/META-INF/plexus/components.xml | 40 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 src/main/resources/META-INF/plexus/components.xml diff --git a/pom.xml b/pom.xml index 243399e3..46a0f58a 100644 --- a/pom.xml +++ b/pom.xml @@ -201,6 +201,13 @@ + + + src/main/resources + true + + + org.kuali.maven.wagons diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 00000000..de378a50 --- /dev/null +++ b/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,40 @@ + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + jbake + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + + ${project.groupId}:${project.artifactId}:${project.version}:generate + + + + + + + + + + + site + + + + ${project.groupId}:${project.artifactId}:${project.version}:generate + + + + + + + + + + \ No newline at end of file From 8551f2d14ce6b2d06498e138c1e342498f091db6 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 24 Apr 2015 08:51:47 -0500 Subject: [PATCH 17/30] Downgrade JBake version to most recent published --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 46a0f58a..7ca7f961 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ org.jbake jbake-core - 2.3.3-SNAPSHOT + 2.3.2 org.apache.maven From dbc45b17f76fa5453428c9854eb0028bb6e106b9 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Fri, 24 Apr 2015 09:03:04 -0500 Subject: [PATCH 18/30] Revert "Downgrade JBake version to most recent published" This reverts commit 8551f2d14ce6b2d06498e138c1e342498f091db6. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7ca7f961..46a0f58a 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ org.jbake jbake-core - 2.3.2 + 2.3.3-SNAPSHOT org.apache.maven From 666c26217e7de2122f44334039b5b780048aaa22 Mon Sep 17 00:00:00 2001 From: Philip Graf Date: Mon, 31 Aug 2015 00:17:02 +0200 Subject: [PATCH 19/30] Override JBake properties from plugin configuration This change allows to override JBake properties or define custom properties which can be used in the templates, e.g.: br.com.ingenieux jbake-maven-plugin ... true bar To make this possible an update to JBake 2.4.0 was necessary. This fixes #3 and resolves #11. --- pom.xml | 2 +- .../ingenieux/mojo/jbake/GenerateMojo.java | 25 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index ec5e15b4..714329ee 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ org.jbake jbake-core - 2.3.2 + 2.4.0 org.apache.maven diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index 8436a583..335b7e83 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -18,13 +18,19 @@ import com.orientechnologies.orient.core.Orient; +import org.apache.commons.configuration.CompositeConfiguration; +import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration.MapConfiguration; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.jbake.app.ConfigUtil; import org.jbake.app.Oven; import java.io.File; +import java.util.HashMap; +import java.util.Map; /** * Runs jbake on a folder @@ -53,6 +59,15 @@ public class GenerateMojo extends AbstractMojo { @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) protected boolean isClearCache; + /** + * Custom configuration properties. + * These properties override the properties in jbake.properties. + * In the templates the properties can be accessed using the prefix config. + * e.g. config.foo for the property <foo>bar</foo>. + */ + @Parameter(required = false) + protected Map properties = new HashMap<>(); + public final void execute() throws MojoExecutionException { try { executeInternal(); @@ -79,7 +94,7 @@ protected void reRender() throws MojoExecutionException { Orient.instance().startup(); // TODO: At some point, reuse Oven - Oven oven = new Oven(inputDirectory, outputDirectory, isClearCache); + Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache); oven.setupPaths(); @@ -90,4 +105,12 @@ protected void reRender() throws MojoExecutionException { throw new MojoExecutionException("Failure when running: ", e); } } + + private CompositeConfiguration createConfiguration() throws ConfigurationException { + final CompositeConfiguration config = new CompositeConfiguration(); + config.addConfiguration(new MapConfiguration(properties)); + config.addConfiguration(ConfigUtil.load(inputDirectory)); + return config; + } + } From 3e7003645f89cca14cb21c7ae1d768b500f2bcd2 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:22:35 -0500 Subject: [PATCH 20/30] Interim Commit - pom updates + sparkjava --- pom.xml | 75 +++++++------------ .../com/ingenieux/mojo/jbake/InlineMojo.java | 44 ++++------- 2 files changed, 39 insertions(+), 80 deletions(-) diff --git a/pom.xml b/pom.xml index ec5e15b4..6928d0f8 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,11 @@ - + 4.0.0 org.sonatype.oss oss-parent - 7 + 9 br.com.ingenieux @@ -76,6 +78,10 @@ + + com.sparkjava + spark-core + net.alchim31 livereload-jvm @@ -109,14 +115,6 @@ org.codehaus.plexus plexus-utils - - io.vertx - vertx-core - - - io.vertx - vertx-platform - commons-io commons-io @@ -133,12 +131,12 @@ org.jbake jbake-core - 2.3.2 + 2.4.0 org.apache.maven maven-plugin-api - 3.0.4 + 3.3.9 commons-lang @@ -153,28 +151,28 @@ org.apache.maven.plugin-testing maven-plugin-testing-harness - 2.0-alpha-1 + 3.3.0 test log4j log4j - 1.2.12 + 1.2.17 org.apache.maven maven-settings - 3.0.4 + 3.3.9 org.apache.maven maven-core - 3.0.4 + 3.3.9 org.apache.maven.plugin-tools maven-plugin-annotations - 3.2 + 3.4 provided @@ -185,17 +183,12 @@ org.codehaus.plexus plexus-utils - 3.0.1 + 3.0.22 - io.vertx - vertx-core - 2.0.2-final - - - io.vertx - vertx-platform - 2.0.2-final + com.sparkjava + spark-core + 2.3 @@ -214,34 +207,18 @@ org.apache.maven.plugins maven-plugin-plugin - 3.2 - true + 3.4 1.7 true - - - mojo-descriptor - - descriptor - - - - - help-goal - - helpmojo - - - org.apache.maven.plugins maven-compiler-plugin - 3.1 + 3.3 1.7 @@ -251,7 +228,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 2.9 + 2.10.3 attach-javadocs @@ -273,22 +250,22 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.6 + 2.8.1 org.apache.maven.plugins maven-plugin-plugin - 3.2 + 3.4 org.apache.maven.plugins maven-javadoc-plugin - 2.9 + 2.10.3 org.apache.maven.plugins maven-jxr-plugin - 2.3 + 2.5 diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java index 2f61682d..69952d6e 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -19,14 +19,13 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.vertx.java.core.Handler; -import org.vertx.java.core.VertxFactory; -import org.vertx.java.core.http.HttpServerRequest; -import org.vertx.java.platform.Verticle; import java.io.File; +import static spark.Spark.*; + import net_alchim31_livereload.LRServer; +import spark.Spark; /** * Runs jbake on a folder while watching and serving a folder with it @@ -58,33 +57,8 @@ public class InlineMojo extends WatchMojo { @Parameter(property = "jbake.livereload", defaultValue = "true") private Boolean livereload; - Server server = new Server(); - LRServer lrServer; - class Server extends Verticle { - - { - vertx = VertxFactory.newVertx(); - } - - @Override - public void start() { - vertx.createHttpServer().requestHandler(new Handler() { - @Override - public void handle(HttpServerRequest req) { - String file = req.path().endsWith("/") ? req.path() + indexFile : req.path(); - - if (new File(outputDirectory + file).isDirectory()) { - req.response().setStatusCode(301).putHeader("Location", file + "/").close(); - } else { - req.response().sendFile(outputDirectory.getAbsolutePath() + file); - } - } - }).listen(port, listenAddress); - } - } - protected void stopServer() throws MojoExecutionException { if (lrServer != null) { try { @@ -93,11 +67,17 @@ protected void stopServer() throws MojoExecutionException { throw new MojoExecutionException("LiveReload Failure", e); } } - server.stop(); + + stop(); } protected void initServer() throws MojoExecutionException { - server.start(); + externalStaticFileLocation(outputDirectory.getPath()); + + ipAddress(listenAddress); + port(this.port); + + if (Boolean.TRUE.equals(livereload)) { lrServer = new LRServer(35729, outputDirectory.toPath()); @@ -107,5 +87,7 @@ protected void initServer() throws MojoExecutionException { throw new MojoExecutionException("LiveReload Failure", e); } } + + awaitInitialization(); } } From 7a160497848e786d9fefdd6c4b595667275d231b Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:38:14 -0500 Subject: [PATCH 21/30] [maven-release-plugin] prepare release jbake-maven-plugin-0.1.0 --- pom.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index 6928d0f8..9fa80591 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,4 @@ - + 4.0.0 org.sonatype.oss @@ -11,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.10-SNAPSHOT + 0.1.0 3.1.1 From d4096ef34ff0f9c68c9966a5888cdcbb0e4d7d8d Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:38:18 -0500 Subject: [PATCH 22/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9fa80591..9f957f71 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.1.0 + 0.1.1-SNAPSHOT 3.1.1 From b4ae3fc0615be070f7160116133c303f975c7a58 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:40:13 -0500 Subject: [PATCH 23/30] Bumping versions --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 9f957f71..8cda0fc2 100644 --- a/pom.xml +++ b/pom.xml @@ -208,7 +208,7 @@ 3.4 - 1.7 + 1.8 true @@ -219,8 +219,8 @@ 3.3 - 1.7 - 1.7 + 1.8 + 1.8 From 7db71a098b07db1ff322164fdcb87a5c6d3c68f7 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:47:48 -0500 Subject: [PATCH 24/30] Fixing configuration --- .../br/com/ingenieux/mojo/jbake/GenerateMojo.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index 4847a436..be570273 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -81,13 +81,6 @@ protected void reRender() throws MojoExecutionException { try { // TODO: Smells bad. A lot Orient.instance().startup(); - - final CompositeConfiguration config; - try { - config = ConfigUtil.load(inputDirectory); - } catch (final ConfigurationException e) { - throw new JBakeException("Configuration error: " + e.getMessage(), e); - } // TODO: At some point, reuse Oven Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache); @@ -105,10 +98,10 @@ protected void reRender() throws MojoExecutionException { protected CompositeConfiguration createConfiguration() throws ConfigurationException { final CompositeConfiguration config = new CompositeConfiguration(); - config.addConfiguration(new MapConfiguration(this.getPluginContext())); - config.addConfiguration(ConfigUtil.load(inputDirectory)); + config.addConfiguration(new MapConfiguration(this.getPluginContext())); + return config; } From 1701bb64f62742fce0132bbc96f1879736fbfb80 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:51:01 -0500 Subject: [PATCH 25/30] [maven-release-plugin] prepare release jbake-maven-plugin-0.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8cda0fc2..d640f7dc 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.1.1-SNAPSHOT + 0.2.0 3.1.1 From cc130add8ce8cd7d143b5b35de9a20100898ce54 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 23 Feb 2016 04:51:07 -0500 Subject: [PATCH 26/30] [maven-release-plugin] prepare for next development iteration --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d640f7dc..e55bea7a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.2.0 + 0.3.0-SNAPSHOT 3.1.1 From 37f6d2395e90a883252214e8197c86206722c9e3 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 10 Apr 2016 04:56:54 -0500 Subject: [PATCH 27/30] Updates --- pom.xml | 37 ++++++++++++++---- .../ingenieux/mojo/jbake/GenerateMojo.java | 9 ++++- .../com/ingenieux/mojo/jbake/InlineMojo.java | 38 +++---------------- 3 files changed, 41 insertions(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index e55bea7a..4ed90559 100644 --- a/pom.xml +++ b/pom.xml @@ -1,4 +1,6 @@ - + 4.0.0 org.sonatype.oss @@ -81,8 +83,12 @@ spark-core - net.alchim31 - livereload-jvm + org.eclipse.jetty + jetty-util + + + org.eclipse.jetty + jetty-server org.apache.maven @@ -117,15 +123,20 @@ commons-io commons-io + + org.freemarker + freemarker + 2.3.22 + + + org.asciidoctor + asciidoctorj + 1.5.2 + - - net.alchim31 - livereload-jvm - 0.2.0 - org.jbake jbake-core @@ -188,6 +199,16 @@ spark-core 2.3 + + org.eclipse.jetty + jetty-util + 9.3.2.v20150730 + + + org.eclipse.jetty + jetty-server + 9.3.2.v20150730 + diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java index be570273..4f41b6ff 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -25,6 +25,8 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.plugins.annotations.ResolutionScope; +import org.apache.maven.project.MavenProject; import org.jbake.app.ConfigUtil; import org.jbake.app.JBakeException; import org.jbake.app.Oven; @@ -34,8 +36,11 @@ /** * Runs jbake on a folder */ -@Mojo(name = "generate", requiresProject = false) +@Mojo(name = "generate", requiresProject = true, requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME) public class GenerateMojo extends AbstractMojo { + @Parameter(defaultValue="${project}") + protected MavenProject project; + /** * Location of the Output Directory. */ @@ -100,7 +105,7 @@ protected CompositeConfiguration createConfiguration() throws ConfigurationExcep config.addConfiguration(ConfigUtil.load(inputDirectory)); - config.addConfiguration(new MapConfiguration(this.getPluginContext())); + config.addConfiguration(new MapConfiguration(this.project.getProperties())); return config; } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java index 69952d6e..b309dc1d 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -20,12 +20,11 @@ import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import java.io.File; - -import static spark.Spark.*; - -import net_alchim31_livereload.LRServer; -import spark.Spark; +import static spark.Spark.awaitInitialization; +import static spark.Spark.externalStaticFileLocation; +import static spark.Spark.ipAddress; +import static spark.Spark.port; +import static spark.Spark.stop; /** * Runs jbake on a folder while watching and serving a folder with it @@ -51,23 +50,7 @@ public class InlineMojo extends WatchMojo { @Parameter(property = "jbake.port", defaultValue = "8080") private Integer port; - /** - * Use livereload. - */ - @Parameter(property = "jbake.livereload", defaultValue = "true") - private Boolean livereload; - - LRServer lrServer; - protected void stopServer() throws MojoExecutionException { - if (lrServer != null) { - try { - lrServer.stop(); - } catch (Exception e) { - throw new MojoExecutionException("LiveReload Failure", e); - } - } - stop(); } @@ -77,17 +60,6 @@ protected void initServer() throws MojoExecutionException { ipAddress(listenAddress); port(this.port); - - - if (Boolean.TRUE.equals(livereload)) { - lrServer = new LRServer(35729, outputDirectory.toPath()); - try { - lrServer.start(); - } catch (Exception e) { - throw new MojoExecutionException("LiveReload Failure", e); - } - } - awaitInitialization(); } } From 3342433d458906da86275df439e2781bec18f30a Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 10 Apr 2016 12:21:31 -0500 Subject: [PATCH 28/30] Lifecycle --- .../resources/META-INF/plexus/components.xml | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml index de378a50..50b1ab4c 100644 --- a/src/main/resources/META-INF/plexus/components.xml +++ b/src/main/resources/META-INF/plexus/components.xml @@ -9,26 +9,14 @@ default - - - - ${project.groupId}:${project.artifactId}:${project.version}:generate - - - - - - - + ${project.groupId}:${project.artifactId}:${project.version}:generate site - - ${project.groupId}:${project.artifactId}:${project.version}:generate - + ${project.groupId}:${project.artifactId}:${project.version}:generate From 55970ca415279c6ecfd5b804829f42078fe1650a Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 10 Apr 2016 12:43:59 -0500 Subject: [PATCH 29/30] Trying to fix bom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4ed90559..1dd2725c 100644 --- a/pom.xml +++ b/pom.xml @@ -288,4 +288,4 @@ - + \ No newline at end of file From 08c6ede7a516e5665ffb3005c76589e2cea16295 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Thu, 28 Apr 2016 17:23:47 -0500 Subject: [PATCH 30/30] Minor changes --- pom.xml | 97 +++++++++++-------- .../com/ingenieux/mojo/jbake/InlineMojo.java | 3 + 2 files changed, 57 insertions(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index 1dd2725c..29078585 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,5 @@ - 4.0.0 @@ -221,47 +221,58 @@ - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.4 - - - 1.8 - - true - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.3 - - - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - attach-javadocs - - jar - - - -Xdoclint:none - - - - - - + + + org.apache.maven.plugins + maven-plugin-plugin + 3.4 + + jbake + + 1.8 + + true + + + + default-descriptor + process-classes + + + help-goal + + helpmojo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.3 + + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.3 + + + attach-javadocs + + jar + + + -Xdoclint:none + + + + + diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java index b309dc1d..e11d85c7 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -22,6 +22,7 @@ import static spark.Spark.awaitInitialization; import static spark.Spark.externalStaticFileLocation; +import static spark.Spark.init; import static spark.Spark.ipAddress; import static spark.Spark.port; import static spark.Spark.stop; @@ -60,6 +61,8 @@ protected void initServer() throws MojoExecutionException { ipAddress(listenAddress); port(this.port); + init(); + awaitInitialization(); } }