From 9ff9fedcaf22f6fd8f2aee15a9c10bae98cc9c16 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 13 Sep 2013 14:21:59 -0300 Subject: [PATCH 001/123] First Version --- .gitignore | 7 + .hgignore | 9 + .travis.yml | 5 + pom.xml | 254 ++++++++++++++++++ .../ingenieux/mojo/jbake/GenerateMojo.java | 56 ++++ .../com/ingenieux/mojo/jbake/InlineMojo.java | 135 ++++++++++ 6 files changed, 466 insertions(+) create mode 100644 .gitignore create mode 100644 .hgignore create mode 100644 .travis.yml create mode 100644 pom.xml create mode 100644 src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java create mode 100644 src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..e729b388 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.settings +.idea +target +.classpath +.project +*.log +*.iml diff --git a/.hgignore b/.hgignore new file mode 100644 index 00000000..6bcb865b --- /dev/null +++ b/.hgignore @@ -0,0 +1,9 @@ +.settings +.idea +target +.classpath +.project +syntax:glob +*.log +syntax:glob +*.iml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..33b39027 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,5 @@ +language: java + +jdk: + - oraclejdk7 + - openjdk6 diff --git a/pom.xml b/pom.xml new file mode 100644 index 00000000..ebd340a0 --- /dev/null +++ b/pom.xml @@ -0,0 +1,254 @@ + + 4.0.0 + + org.sonatype.oss + oss-parent + 7 + + + br.com.ingenieux + jbake-maven-plugin + maven-plugin + 0.0.1-SNAPSHOT + + jbake-maven-plugin is a plugin to integrate JBake into your projects + http://docs.ingenieux.com.br/jbake-maven-plugin/ + 2013 + + + + http://www.apache.org/licenses/LICENSE-2.0.txt + Apache 2.0 + + + + + + docs.ingenieux.com.br + ingenieux Beanstalker Site + s3://docs.ingenieux.com.br/projects/jbake-maven-plugin/ + + + + + ingenieux + http://ingenieux.com.br + + + + + aldrinleal + Aldrin Leal + -3 + + + + + github + https://bitbucket.org/ingenieux/jbake-maven-plugin/ + + + + UTF-8 + UTF-8 + UTF-8 + + + + 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 + + + + + org.jbake.app + jbake + + + org.apache.maven + maven-plugin-api + + + commons-lang + commons-lang + + + org.apache.maven + maven-settings + + + org.apache.maven + maven-core + + + org.apache.maven.plugin-tools + maven-plugin-annotations + provided + + + org.sonatype.plexus + plexus-build-api + + + org.codehaus.plexus + plexus-utils + + + org.jvnet.hudson.winstone + winstone + + + + + + + org.jbake.app + jbake + 2.2 + + + org.apache.maven + maven-plugin-api + 3.0.4 + + + commons-lang + commons-lang + 2.6 + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + 2.0-alpha-1 + test + + + log4j + log4j + 1.2.12 + + + org.apache.maven + maven-settings + 3.0.4 + + + org.apache.maven + maven-core + 3.0.4 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.2 + provided + + + org.sonatype.plexus + plexus-build-api + 0.0.7 + + + org.codehaus.plexus + plexus-utils + 3.0.1 + + + org.jvnet.hudson.winstone + winstone + 0.9.10-hudson-24 + + + + + + + + org.kuali.maven.wagons + maven-s3-wagon + 1.1.20 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + true + + + 1.7 + + true + + + + mojo-descriptor + + descriptor + + + + + help-goal + + helpmojo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-site-plugin + 3.2 + + + org.apache.maven.doxia + doxia-module-markdown + 1.3 + + + + + + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.6 + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9 + + + org.apache.maven.plugins + maven-jxr-plugin + 2.3 + + + + diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java new file mode 100644 index 00000000..7ba65f6d --- /dev/null +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -0,0 +1,56 @@ +package br.com.ingenieux.mojo.jbake; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.File; + +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.Oven; + +/** + * Runs jbake on a folder + */ +@Mojo(name = "generate") +public class GenerateMojo extends AbstractMojo { + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.build.directory}/${project.build.finalName}", required = true) + private File outputDirectory; + + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) + private File inputDirectory; + + 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/InlineMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java new file mode 100644 index 00000000..dab37519 --- /dev/null +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -0,0 +1,135 @@ +package br.com.ingenieux.mojo.jbake; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.BufferedReader; +import java.io.File; +import java.io.InputStreamReader; +import java.nio.file.FileSystems; +import java.nio.file.Path; +import java.nio.file.StandardWatchEventKinds; +import java.nio.file.WatchEvent; +import java.nio.file.WatchKey; +import java.nio.file.WatchService; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; +import org.apache.maven.plugins.annotations.Parameter; + +import winstone.Launcher; + +/** + * Runs jbake on a folder while watching and serving a folder with it + */ +@Mojo(name = "inline", requiresDirectInvocation = true) +public class InlineMojo extends GenerateMojo { + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.build.directory}/${project.build.finalName}", required = true) + private File outputDirectory; + + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) + private File inputDirectory; + + /** + * Listen Port + */ + @Parameter(property = "jbake.listenAddress", defaultValue = "127.0.0.1") + private String listenAddress; + + /** + * Listen Port + */ + @Parameter(property = "jbake.port", defaultValue = "8080") + private Integer port; + + public void execute() throws MojoExecutionException { + super.execute(); + + getLog().info("Now listening for changes on path " + inputDirectory.getPath()); + + Map args = new HashMap(); + + Launcher launcher = null; + + try { + args.put("webroot", outputDirectory.getAbsolutePath()); + args.put("httpPort", port.toString()); + args.put("httpListenAddress", listenAddress); + + launcher = new Launcher(args); + + final Path inPath = FileSystems.getDefault().getPath( + inputDirectory.getAbsolutePath()); + final WatchService watchService = inPath.getFileSystem() + .newWatchService(); + + inPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, + StandardWatchEventKinds.ENTRY_MODIFY, + StandardWatchEventKinds.ENTRY_DELETE); + + 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); + } + } + }).run(); + + do { + WatchKey watchKey = watchService.take(); + Thread.sleep(1000L); + + if (watchKey.reset()) { + watchKey.cancel(); + watchService.close(); + return; + } + + List> events = watchKey.pollEvents(); + + if (! events.isEmpty()) { + getLog().info("Refreshing"); + super.execute(); + } + } while (! done.get()); + } catch (Exception exc) { + getLog().info("Oops", exc); + + throw new MojoExecutionException("Oops", exc); + } finally { + getLog().info("Finishing"); + launcher.shutdown(); + } + } +} From 76606eb556ad34d0cc2234db18779496253b30ef Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 13 Sep 2013 15:03:21 -0300 Subject: [PATCH 002/123] Fixing Watch and Inline --- .../ingenieux/mojo/jbake/GenerateMojo.java | 6 +- .../com/ingenieux/mojo/jbake/InlineMojo.java | 91 ++--------- .../com/ingenieux/mojo/jbake/WatchMojo.java | 92 +++++++++++ .../ingenieux/mojo/jbake/util/DirWatcher.java | 146 ++++++++++++++++++ 4 files changed, 251 insertions(+), 84 deletions(-) create mode 100644 src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java create mode 100644 src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java 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 7ba65f6d..1af08e21 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -1,7 +1,7 @@ package br.com.ingenieux.mojo.jbake; /* - * Copyright 2001-2005 The Apache Software Foundation. + * Copyright 2013 ingenieux Labs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,13 +33,13 @@ public class GenerateMojo extends AbstractMojo { * Location of the Output Directory. */ @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.build.directory}/${project.build.finalName}", required = true) - private File outputDirectory; + protected File outputDirectory; /** * Location of the Output Directory. */ @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) - private File inputDirectory; + protected File inputDirectory; public void execute() throws MojoExecutionException { try { 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 dab37519..e4a7673c 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -1,7 +1,7 @@ package br.com.ingenieux.mojo.jbake; /* - * Copyright 2001-2005 The Apache Software Foundation. + * Copyright 2013 ingenieux Labs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,19 +16,8 @@ * limitations under the License. */ -import java.io.BufferedReader; -import java.io.File; -import java.io.InputStreamReader; -import java.nio.file.FileSystems; -import java.nio.file.Path; -import java.nio.file.StandardWatchEventKinds; -import java.nio.file.WatchEvent; -import java.nio.file.WatchKey; -import java.nio.file.WatchService; import java.util.HashMap; -import java.util.List; import java.util.Map; -import java.util.concurrent.atomic.AtomicBoolean; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; @@ -40,19 +29,7 @@ * Runs jbake on a folder while watching and serving a folder with it */ @Mojo(name = "inline", requiresDirectInvocation = true) -public class InlineMojo extends GenerateMojo { - /** - * Location of the Output Directory. - */ - @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.build.directory}/${project.build.finalName}", required = true) - private File outputDirectory; - - /** - * Location of the Output Directory. - */ - @Parameter(property = "jbake.inputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) - private File inputDirectory; - +public class InlineMojo extends WatchMojo { /** * Listen Port */ @@ -65,71 +42,23 @@ public class InlineMojo extends GenerateMojo { @Parameter(property = "jbake.port", defaultValue = "8080") private Integer port; - public void execute() throws MojoExecutionException { - super.execute(); - - getLog().info("Now listening for changes on path " + inputDirectory.getPath()); + protected Launcher launcher = null; - Map args = new HashMap(); - - Launcher launcher = null; + protected void stopServer() { + launcher.shutdown(); + } + protected void initServer() throws MojoExecutionException { try { + Map args = new HashMap(); + args.put("webroot", outputDirectory.getAbsolutePath()); args.put("httpPort", port.toString()); args.put("httpListenAddress", listenAddress); launcher = new Launcher(args); - - final Path inPath = FileSystems.getDefault().getPath( - inputDirectory.getAbsolutePath()); - final WatchService watchService = inPath.getFileSystem() - .newWatchService(); - - inPath.register(watchService, StandardWatchEventKinds.ENTRY_CREATE, - StandardWatchEventKinds.ENTRY_MODIFY, - StandardWatchEventKinds.ENTRY_DELETE); - - 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); - } - } - }).run(); - - do { - WatchKey watchKey = watchService.take(); - Thread.sleep(1000L); - - if (watchKey.reset()) { - watchKey.cancel(); - watchService.close(); - return; - } - - List> events = watchKey.pollEvents(); - - if (! events.isEmpty()) { - getLog().info("Refreshing"); - super.execute(); - } - } while (! done.get()); } catch (Exception exc) { - getLog().info("Oops", exc); - - throw new MojoExecutionException("Oops", exc); - } finally { - getLog().info("Finishing"); - launcher.shutdown(); + throw new MojoExecutionException("Ooops", exc); } } } diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java new file mode 100644 index 00000000..a4a82ffb --- /dev/null +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -0,0 +1,92 @@ +package br.com.ingenieux.mojo.jbake; + +/* + * Copyright 2013 ingenieux Labs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.nio.file.Paths; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; + +import br.com.ingenieux.mojo.jbake.util.DirWatcher; + +/** + * Runs jbake on a folder while watching for changes + */ +@Mojo(name = "watch", requiresDirectInvocation = true) +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(); + } + } + + 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 new file mode 100644 index 00000000..42f839cd --- /dev/null +++ b/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java @@ -0,0 +1,146 @@ +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; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.WatchEvent; +import java.nio.file.WatchEvent.Kind; +import java.nio.file.WatchKey; +import java.nio.file.WatchService; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * Example to watch a directory (or tree) for changes to files. + */ + +public class DirWatcher { + private final WatchService watcher; + + private final Map keys; + + @SuppressWarnings("unchecked") + static WatchEvent cast(WatchEvent event) { + return (WatchEvent) event; + } + + /** + * Register the given directory with the WatchService + */ + 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); + } + + /** + * Register the given directory, and all its sub-directories, with the + * WatchService. + */ + private void registerAll(final Path start) throws IOException { + // register directory and sub-directories + Files.walkFileTree(start, new SimpleFileVisitor() { + @Override + public FileVisitResult preVisitDirectory(Path dir, + BasicFileAttributes attrs) throws IOException { + register(dir); + return FileVisitResult.CONTINUE; + } + }); + } + + /** + * Creates a WatchService and registers the given directory + */ + public DirWatcher(Path dir) throws IOException { + this.watcher = FileSystems.getDefault().newWatchService(); + this.keys = new HashMap(); + + registerAll(dir); + } + + /** + * Process all events for keys queued to the watcher + */ + public Boolean processEvents() { + // wait for key to be signalled + WatchKey key; + try { + key = watcher.poll(1L, TimeUnit.SECONDS); + } catch (InterruptedException x) { + return Boolean.FALSE; + } + + if (null == key) + return Boolean.FALSE; + + Path dir = keys.get(key); + if (dir == null) + throw new IllegalStateException("WatchKey not recognized!!"); + + for (WatchEvent event : key.pollEvents()) { + Kind kind = event.kind(); + + // TBD - provide example of how OVERFLOW event is handled + if (kind == OVERFLOW) { + continue; + } + + // Context for directory entry event is the file name of entry + WatchEvent ev = cast(event); + Path name = ev.context(); + Path child = dir.resolve(name); + + // if directory is created, and watching recursively, then + // register it and its sub-directories + if (kind == ENTRY_CREATE) { + try { + if (Files.isDirectory(child, NOFOLLOW_LINKS)) { + registerAll(child); + } + } catch (IOException x) { + // ignore to keep sample readbale + } + } + } + + // reset key and remove from set if directory no longer accessible + boolean valid = key.reset(); + if (!valid) { + keys.remove(key); + + // all directories are inaccessible + if (keys.isEmpty()) { + return null; + } + } + + return Boolean.TRUE; + } + + static void usage() { + System.err.println("usage: java WatchDir [-r] dir"); + System.exit(-1); + } +} \ No newline at end of file From abce914bf9e2a57d560070832ab31783d6ac6c53 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 22 Sep 2013 14:23:19 -0300 Subject: [PATCH 003/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.1 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ebd340a0..8d337115 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ - + 4.0.0 org.sonatype.oss @@ -10,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.1-SNAPSHOT + 0.0.1 jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 5b3efb63113347b7c5e7b952f373bd24699b4862 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 22 Sep 2013 14:23:25 -0300 Subject: [PATCH 004/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.1 --- .hgtags | 1 + 1 file changed, 1 insertion(+) create mode 100644 .hgtags diff --git a/.hgtags b/.hgtags new file mode 100644 index 00000000..26eb971b --- /dev/null +++ b/.hgtags @@ -0,0 +1 @@ +29a2a0ff369456f68e2f0f772a04428829335763 jbake-maven-plugin-0.0.1 From 75f492ef090ae4db718751d0bc149ba3401a1e7c Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 22 Sep 2013 14:23:32 -0300 Subject: [PATCH 005/123] [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 8d337115..fc4f35e3 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.1 + 0.0.2-SNAPSHOT jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 9f05c53c2543b88ebfe2a147f8100b92939d743b Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 22 Sep 2013 14:27:42 -0300 Subject: [PATCH 006/123] Redoing the release --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index fc4f35e3..caaa7cb5 100644 --- a/pom.xml +++ b/pom.xml @@ -103,9 +103,9 @@ - org.jbake.app - jbake - 2.2 + org.jbake + jbake-core + 2.1 org.apache.maven From 0dc0f3f17efba627edf201c35479aac16b9f4353 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Sun, 22 Sep 2013 14:29:11 -0300 Subject: [PATCH 007/123] Fixing --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index caaa7cb5..99cd5b22 100644 --- a/pom.xml +++ b/pom.xml @@ -62,8 +62,8 @@ - org.jbake.app - jbake + org.jbake + jbake-core org.apache.maven From 1a7c346813ee4522d63fa7377df090b831081094 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 23 Sep 2013 16:34:56 -0300 Subject: [PATCH 008/123] Fixing for release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 99cd5b22..5b515e60 100644 --- a/pom.xml +++ b/pom.xml @@ -105,7 +105,7 @@ org.jbake jbake-core - 2.1 + 2.1.1 org.apache.maven From 845659757d6bf6acaa24140d8e3b594995cc7066 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 23 Sep 2013 16:38:32 -0300 Subject: [PATCH 009/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5b515e60..752830dc 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.2-SNAPSHOT + 0.0.2 jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From cd82bff010a36e73e846bacf81967a7132636fbc Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 23 Sep 2013 16:38:46 -0300 Subject: [PATCH 010/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.2 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 26eb971b..a443e59b 100644 --- a/.hgtags +++ b/.hgtags @@ -1 +1,2 @@ 29a2a0ff369456f68e2f0f772a04428829335763 jbake-maven-plugin-0.0.1 +a4cc0a5a7e191369db77919f9bb1424693f0ec8e jbake-maven-plugin-0.0.2 From 29d7ef3333193c1027b8865e7473c62341182529 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 23 Sep 2013 16:38:52 -0300 Subject: [PATCH 011/123] [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 752830dc..fd473d66 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.2 + 0.0.3-SNAPSHOT jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 95738d6ae871fcce0cc7056b6a11b6f6fbad52a2 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 6 Dec 2013 06:48:45 -0300 Subject: [PATCH 012/123] Swapping Winstone for Vert.x --- pom.xml | 486 +++++++++--------- .../com/ingenieux/mojo/jbake/InlineMojo.java | 55 +- 2 files changed, 285 insertions(+), 256 deletions(-) diff --git a/pom.xml b/pom.xml index fd473d66..3bf87841 100644 --- a/pom.xml +++ b/pom.xml @@ -1,253 +1,263 @@ - - 4.0.0 - - org.sonatype.oss - oss-parent - 7 - + + 4.0.0 + + org.sonatype.oss + oss-parent + 7 + - br.com.ingenieux - jbake-maven-plugin - maven-plugin - 0.0.3-SNAPSHOT + br.com.ingenieux + jbake-maven-plugin + maven-plugin + 0.0.3-SNAPSHOT - jbake-maven-plugin is a plugin to integrate JBake into your projects - http://docs.ingenieux.com.br/jbake-maven-plugin/ - 2013 + jbake-maven-plugin is a plugin to integrate JBake into your projects + http://docs.ingenieux.com.br/jbake-maven-plugin/ + 2013 - - - http://www.apache.org/licenses/LICENSE-2.0.txt - Apache 2.0 - - + + + http://www.apache.org/licenses/LICENSE-2.0.txt + Apache 2.0 + + - - - docs.ingenieux.com.br - ingenieux Beanstalker Site - s3://docs.ingenieux.com.br/projects/jbake-maven-plugin/ - - + + + docs.ingenieux.com.br + ingenieux Beanstalker Site + s3://docs.ingenieux.com.br/projects/jbake-maven-plugin/ + + - - ingenieux - http://ingenieux.com.br - + + ingenieux + http://ingenieux.com.br + - - - aldrinleal - Aldrin Leal - -3 - - + + + aldrinleal + Aldrin Leal + -3 + + - - github - https://bitbucket.org/ingenieux/jbake-maven-plugin/ - + + github + https://bitbucket.org/ingenieux/jbake-maven-plugin/ + - - UTF-8 - UTF-8 - UTF-8 - + + UTF-8 + UTF-8 + UTF-8 + - - 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: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 + - - - org.jbake - jbake-core - - - org.apache.maven - maven-plugin-api - - - commons-lang - commons-lang - - - org.apache.maven - maven-settings - - - org.apache.maven - maven-core - - - org.apache.maven.plugin-tools - maven-plugin-annotations - provided - - - org.sonatype.plexus - plexus-build-api - - - org.codehaus.plexus - plexus-utils - - - org.jvnet.hudson.winstone - winstone - - + + + org.jbake + jbake-core + + + org.apache.maven + maven-plugin-api + + + commons-lang + commons-lang + + + org.apache.maven + maven-settings + + + org.apache.maven + maven-core + + + org.apache.maven.plugin-tools + maven-plugin-annotations + provided + + + org.sonatype.plexus + plexus-build-api + + + org.codehaus.plexus + plexus-utils + + + io.vertx + vertx-core + + + io.vertx + vertx-platform + + - - - - org.jbake - jbake-core - 2.1.1 - - - org.apache.maven - maven-plugin-api - 3.0.4 - - - commons-lang - commons-lang - 2.6 - - - org.apache.maven.plugin-testing - maven-plugin-testing-harness - 2.0-alpha-1 - test - - - log4j - log4j - 1.2.12 - - - org.apache.maven - maven-settings - 3.0.4 - - - org.apache.maven - maven-core - 3.0.4 - - - org.apache.maven.plugin-tools - maven-plugin-annotations - 3.2 - provided - - - org.sonatype.plexus - plexus-build-api - 0.0.7 - - - org.codehaus.plexus - plexus-utils - 3.0.1 - - - org.jvnet.hudson.winstone - winstone - 0.9.10-hudson-24 - - - + + + + org.jbake + jbake-core + 2.1.1 + + + org.apache.maven + maven-plugin-api + 3.0.4 + + + commons-lang + commons-lang + 2.6 + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + 2.0-alpha-1 + test + + + log4j + log4j + 1.2.12 + + + org.apache.maven + maven-settings + 3.0.4 + + + org.apache.maven + maven-core + 3.0.4 + + + org.apache.maven.plugin-tools + maven-plugin-annotations + 3.2 + provided + + + org.sonatype.plexus + plexus-build-api + 0.0.7 + + + org.codehaus.plexus + plexus-utils + 3.0.1 + + + io.vertx + vertx-core + 2.0.2-final + + + io.vertx + vertx-platform + 2.0.2-final + + + - - - - org.kuali.maven.wagons - maven-s3-wagon - 1.1.20 - - + + + + org.kuali.maven.wagons + maven-s3-wagon + 1.1.20 + + - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.2 - true - - - 1.7 - - true - - - - mojo-descriptor - - descriptor - - - - - help-goal - - helpmojo - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 3.0 - - - 1.7 - 1.7 - - - - org.apache.maven.plugins - maven-site-plugin - 3.2 - - - org.apache.maven.doxia - doxia-module-markdown - 1.3 - - - - - - + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + true + + + 1.7 + + true + + + + mojo-descriptor + + descriptor + + + + + help-goal + + helpmojo + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.0 + + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-site-plugin + 3.2 + + + org.apache.maven.doxia + doxia-module-markdown + 1.3 + + + + + + - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.6 - - - org.apache.maven.plugins - maven-plugin-plugin - 3.2 - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.9 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.3 - - - + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 2.6 + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.9 + + + org.apache.maven.plugins + maven-jxr-plugin + 2.3 + + + 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 e4a7673c..e10b0962 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -16,14 +16,15 @@ * limitations under the License. */ -import java.util.HashMap; -import java.util.Map; - 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 winstone.Launcher; +import java.io.File; /** * Runs jbake on a folder while watching and serving a folder with it @@ -36,29 +37,47 @@ public class InlineMojo extends WatchMojo { @Parameter(property = "jbake.listenAddress", defaultValue = "127.0.0.1") private String listenAddress; - /** + /** + * Listen Port + */ + @Parameter(property = "jbake.indexFile", defaultValue = "index.html") + private String indexFile; + + /** * Listen Port */ @Parameter(property = "jbake.port", defaultValue = "8080") private Integer port; - protected Launcher launcher = null; + Server server = new Server(); + + 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() { - launcher.shutdown(); + server.stop(); } protected void initServer() throws MojoExecutionException { - try { - Map args = new HashMap(); - - args.put("webroot", outputDirectory.getAbsolutePath()); - args.put("httpPort", port.toString()); - args.put("httpListenAddress", listenAddress); - - launcher = new Launcher(args); - } catch (Exception exc) { - throw new MojoExecutionException("Ooops", exc); - } + server.start(); } } From f021b8f94fa3cbc25c5dccba48c90cb9714145fe Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Fri, 6 Dec 2013 06:52:56 -0300 Subject: [PATCH 013/123] Fixing metadata --- src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 e10b0962..d06f2763 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -38,7 +38,7 @@ public class InlineMojo extends WatchMojo { private String listenAddress; /** - * Listen Port + * Index File */ @Parameter(property = "jbake.indexFile", defaultValue = "index.html") private String indexFile; From 7337c6c95a7d2edb837b9ce2ee4a657aed7517d8 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Mon, 27 Jan 2014 17:09:47 -0300 Subject: [PATCH 014/123] Fixing JBake Version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3bf87841..ff3533d6 100644 --- a/pom.xml +++ b/pom.xml @@ -110,7 +110,7 @@ org.jbake jbake-core - 2.1.1 + 2.2.1 org.apache.maven From cc51599934943cbb83fd059623f9e29af18e058e Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 02:58:21 -0300 Subject: [PATCH 015/123] Fixing pom --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index ff3533d6..dacccd69 100644 --- a/pom.xml +++ b/pom.xml @@ -65,6 +65,12 @@ org.jbake jbake-core + + + org.eclipse.jetty + jetty-server + + org.apache.maven From e57c389bcaac4fb76d56f723ca9eea17e1d0e32d Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 00:19:42 -0600 Subject: [PATCH 016/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.3 --- pom.xml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index dacccd69..e7eb6e6c 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,4 @@ - + 4.0.0 org.sonatype.oss @@ -10,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.3-SNAPSHOT + 0.0.3 jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 9f9b388e51483fa6ca53073c7beea1c6db12fc80 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 00:19:44 -0600 Subject: [PATCH 017/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.3 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index a443e59b..17360ae5 100644 --- a/.hgtags +++ b/.hgtags @@ -1,2 +1,3 @@ 29a2a0ff369456f68e2f0f772a04428829335763 jbake-maven-plugin-0.0.1 a4cc0a5a7e191369db77919f9bb1424693f0ec8e jbake-maven-plugin-0.0.2 +dac515355fb76185faba67020f44735a00e9fdd6 jbake-maven-plugin-0.0.3 From 92d7ac3fb6a77fdf332d703b4c44ccaf17a90985 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 00:19:46 -0600 Subject: [PATCH 018/123] [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 e7eb6e6c..ee5beed2 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.3 + 0.0.4-SNAPSHOT jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 8fd028ea1a832a6732a11d8dc75dc2aeb6a1e996 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 04:43:09 -0300 Subject: [PATCH 019/123] Removing Project Requirement --- .../br/com/ingenieux/mojo/jbake/GenerateMojo.java | 6 +++--- .../java/br/com/ingenieux/mojo/jbake/InlineMojo.java | 2 +- .../java/br/com/ingenieux/mojo/jbake/WatchMojo.java | 11 +++++------ 3 files changed, 9 insertions(+), 10 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 1af08e21..2f1e55ce 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java @@ -16,18 +16,18 @@ * limitations under the License. */ -import java.io.File; - 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.Oven; +import java.io.File; + /** * Runs jbake on a folder */ -@Mojo(name = "generate") +@Mojo(name = "generate", requiresProject = false) public class GenerateMojo extends AbstractMojo { /** * Location of the Output Directory. 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 d06f2763..df2d6435 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java @@ -29,7 +29,7 @@ /** * Runs jbake on a folder while watching and serving a folder with it */ -@Mojo(name = "inline", requiresDirectInvocation = true) +@Mojo(name = "inline", requiresDirectInvocation = true, requiresProject = false) public class InlineMojo extends WatchMojo { /** * Listen Port 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 a4a82ffb..38d67212 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java @@ -16,20 +16,19 @@ * limitations under the License. */ +import br.com.ingenieux.mojo.jbake.util.DirWatcher; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugins.annotations.Mojo; + import java.io.BufferedReader; import java.io.InputStreamReader; import java.nio.file.Paths; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Mojo; - -import br.com.ingenieux.mojo.jbake.util.DirWatcher; - /** * Runs jbake on a folder while watching for changes */ -@Mojo(name = "watch", requiresDirectInvocation = true) +@Mojo(name = "watch", requiresDirectInvocation = true, requiresProject = false) public class WatchMojo extends GenerateMojo { public void execute() throws MojoExecutionException { super.execute(); From 8768579e0e1a3044644be8e8dd8c5f2dc8b27ad0 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 02:54:41 -0600 Subject: [PATCH 020/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ee5beed2..94026dba 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.4-SNAPSHOT + 0.0.4 jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 60f22fb7baa0baf5dacc48334aadce2915eb4981 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 02:54:43 -0600 Subject: [PATCH 021/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 17360ae5..e76b8c5d 100644 --- a/.hgtags +++ b/.hgtags @@ -1,3 +1,4 @@ 29a2a0ff369456f68e2f0f772a04428829335763 jbake-maven-plugin-0.0.1 a4cc0a5a7e191369db77919f9bb1424693f0ec8e jbake-maven-plugin-0.0.2 dac515355fb76185faba67020f44735a00e9fdd6 jbake-maven-plugin-0.0.3 +3cefc1a3c056ef859960b0cdcc0ceca49bfbc9da jbake-maven-plugin-0.0.4 From bc0730559e5c2922e67ec2cbf521fc5e7082d58b Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 02:54:45 -0600 Subject: [PATCH 022/123] [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 94026dba..a0b3270d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.4 + 0.0.5-SNAPSHOT jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ From 1545207bfcd851cba3303017b63481c322e077ad Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 03:07:04 -0600 Subject: [PATCH 023/123] Updating Prereqs and plugins --HG-- extra : amend_source : 31da5144387b274a1c962c35dbcb7746cab6c34a --- pom.xml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index a0b3270d..a7a4529d 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,10 @@ maven-plugin 0.0.5-SNAPSHOT + + 3.1.1 + + jbake-maven-plugin is a plugin to integrate JBake into your projects http://docs.ingenieux.com.br/jbake-maven-plugin/ 2013 @@ -218,7 +222,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.0 + 3.1 1.7 @@ -228,14 +232,7 @@ org.apache.maven.plugins maven-site-plugin - 3.2 - - - org.apache.maven.doxia - doxia-module-markdown - 1.3 - - + 3.3 From 85298ad11266b4a1385cbad680f350f12cd12ddb Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 03:10:07 -0600 Subject: [PATCH 024/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.5 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a7a4529d..d12aae8b 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.5-SNAPSHOT + 0.0.5 3.1.1 From fb97ce571c8434824c53e3fba19b23244f1ec8d7 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 03:10:10 -0600 Subject: [PATCH 025/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.5 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index e76b8c5d..13a119f5 100644 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,4 @@ a4cc0a5a7e191369db77919f9bb1424693f0ec8e jbake-maven-plugin-0.0.2 dac515355fb76185faba67020f44735a00e9fdd6 jbake-maven-plugin-0.0.3 3cefc1a3c056ef859960b0cdcc0ceca49bfbc9da jbake-maven-plugin-0.0.4 +cf9b1156b7ca9818a11814b19274fec23109c880 jbake-maven-plugin-0.0.5 From 1ef1e0802c5300a172b5b58e3939f7c1370a045c Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 03:10:13 -0600 Subject: [PATCH 026/123] [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 d12aae8b..dd734870 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.5 + 0.0.6-SNAPSHOT 3.1.1 From 31503d745ed945f8837f3b8e45a283ef8ce421a3 Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 07:57:49 -0300 Subject: [PATCH 027/123] Adding Seed Mojo --HG-- rename : src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java => src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java --- pom.xml | 5 + .../br/com/ingenieux/mojo/jbake/SeedMojo.java | 122 ++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java diff --git a/pom.xml b/pom.xml index dd734870..0477ea8f 100644 --- a/pom.xml +++ b/pom.xml @@ -112,6 +112,11 @@ io.vertx vertx-platform + + commons-io + commons-io + 2.4 + diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java b/src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java new file mode 100644 index 00000000..b04fc4b9 --- /dev/null +++ b/src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java @@ -0,0 +1,122 @@ +package br.com.ingenieux.mojo.jbake; + +/* + * Copyright 2013 ingenieux Labs + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.commons.io.IOUtils; +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 java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; +import java.util.LinkedList; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import static java.lang.String.format; +import static java.util.Arrays.asList; +import static org.apache.commons.lang.StringUtils.join; + +/** + * Seeds a new JBake Template into the (non-existing) directory defined by outputDirectory + */ +@Mojo(name = "seed", requiresProject = true, requiresDirectInvocation = true) +public class SeedMojo extends AbstractMojo { + /** + * Location of the Seeding Zip + */ + @Parameter(property = "jbake.seedUrl", defaultValue = "https://github.com/jbake-org/jbake-template-bootstrap/zipball/master/", required = true) + protected String seedUrl; + + /** + * Location of the Output Directory. + */ + @Parameter(property = "jbake.outputDirectory", defaultValue = "${project.basedir}/src/main/jbake", required = true) + protected File outputDirectory; + + /** + * Really force overwrite if output dir exists? defaults to false + */ + @Parameter(property = "jbake.force", defaultValue = "false") + protected Boolean force; + + public void execute() throws MojoExecutionException { + if (outputDirectory.exists() && (! force)) + throw new MojoExecutionException(format("The outputDirectory %s must *NOT* exist. Invoke with jbake.force as true to disregard", outputDirectory.getName())); + + try { + URL url = new URL(seedUrl); + File tmpZipFile = File.createTempFile("jbake", ".zip"); + + getLog().info(format("Downloading contents from %s into %s", seedUrl, tmpZipFile)); + + final FileOutputStream fos = new FileOutputStream(tmpZipFile); + int length = IOUtils.copy(url.openStream(), fos); + + fos.close(); + + getLog().info(format("%d bytes downloaded. Unpacking into %s", length, outputDirectory)); + + unpackZip(tmpZipFile); + } catch (Exception e) { + getLog().info("Oops", e); + + throw new MojoExecutionException("Failure when running: ", e); + } + } + + private void unpackZip(File tmpZipFile) throws IOException { + ZipInputStream zis = + new ZipInputStream(new FileInputStream(tmpZipFile)); + //get the zipped file list entry + ZipEntry ze = zis.getNextEntry(); + + while(ze!=null){ + if (ze.isDirectory()) { + ze = zis.getNextEntry(); + continue; + } + + String fileName = stripLeadingPath(ze.getName()); + File newFile = new File(outputDirectory + File.separator + fileName); + + new File(newFile.getParent()).mkdirs(); + + FileOutputStream fos = new FileOutputStream(newFile); + + IOUtils.copy(zis, fos); + + fos.close(); + ze = zis.getNextEntry(); + } + + zis.closeEntry(); + zis.close(); + } + + private String stripLeadingPath(String name) { + LinkedList elements = new LinkedList<>(asList(name.split("/"))); + + elements.pop(); + + return join(elements.iterator(), '/'); + } +} From 564f4b61e40b99f8ee89f40bcd1570d1a3ad1e0d Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 04:59:21 -0600 Subject: [PATCH 028/123] [maven-release-plugin] prepare release jbake-maven-plugin-0.0.6 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0477ea8f..7b3905ac 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.6-SNAPSHOT + 0.0.6 3.1.1 From fe57867205ae4e689a2302e839b1c7acaee9f87a Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 04:59:23 -0600 Subject: [PATCH 029/123] [maven-release-plugin] copy for tag jbake-maven-plugin-0.0.6 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 13a119f5..24dc6ec6 100644 --- a/.hgtags +++ b/.hgtags @@ -3,3 +3,4 @@ a4cc0a5a7e191369db77919f9bb1424693f0ec8e jbake-maven-plugin-0.0.2 dac515355fb76185faba67020f44735a00e9fdd6 jbake-maven-plugin-0.0.3 3cefc1a3c056ef859960b0cdcc0ceca49bfbc9da jbake-maven-plugin-0.0.4 cf9b1156b7ca9818a11814b19274fec23109c880 jbake-maven-plugin-0.0.5 +d2a88144f8c8b75504a6fafdce28eccc74e488cf jbake-maven-plugin-0.0.6 From 8be2128f611875c0f61d487180e40d84580fcdbb Mon Sep 17 00:00:00 2001 From: Aldrin Leal Date: Tue, 25 Feb 2014 04:59:24 -0600 Subject: [PATCH 030/123] [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 7b3905ac..68e4ce35 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ br.com.ingenieux jbake-maven-plugin maven-plugin - 0.0.6 + 0.0.7-SNAPSHOT 3.1.1 From 8e30720bed15634380e88b7d6ac8178e72b11098 Mon Sep 17 00:00:00 2001 From: ybonnel Date: Tue, 1 Jul 2014 11:25:18 +0200 Subject: [PATCH 031/123] 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 032/123] 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 033/123] 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 034/123] 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 035/123] 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 036/123] 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 037/123] [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 038/123] [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 039/123] 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 040/123] [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 041/123] [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 042/123] 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 043/123] [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 044/123] [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 045/123] 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 046/123] 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 047/123] 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 048/123] 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 049/123] 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 050/123] 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 051/123] [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 052/123] [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 053/123] 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 054/123] 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 055/123] [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 056/123] [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 057/123] 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 058/123] 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 059/123] 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 060/123] 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(); } } From 6986fce226df249cb900815d8c50cb51425f09f9 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 13:36:59 +0100 Subject: [PATCH 061/123] [maven-release-plugin] prepare release v0.2.0 --- pom.xml | 42 ++++++++++++++++-------------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 29078585..40fb4dad 100644 --- a/pom.xml +++ b/pom.xml @@ -1,6 +1,4 @@ - + 4.0.0 org.sonatype.oss @@ -8,17 +6,18 @@ 9 - br.com.ingenieux + org.jbake jbake-maven-plugin + 0.2.0 maven-plugin - 0.3.0-SNAPSHOT 3.1.1 - - jbake-maven-plugin is a plugin to integrate JBake into your projects - http://docs.ingenieux.com.br/jbake-maven-plugin/ + + jbake-maven-plugin + jbake-maven-plugin is a Maven plugin allowing you to integrate JBake into your projects build + http://jbake.org 2013 @@ -28,17 +27,9 @@ - - - docs.ingenieux.com.br - ingenieux Beanstalker Site - s3://docs.ingenieux.com.br/projects/jbake-maven-plugin/ - - - - ingenieux - http://ingenieux.com.br + JBake + http://jbake.org @@ -50,8 +41,8 @@ - github - https://github.com/ingenieux/jbake-maven-plugin/ + GitHub Issues + https://github.com/jbake-org/jbake-maven-plugin/issues @@ -61,10 +52,9 @@ - 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 + scm:git:http://github.com/jbake-org/jbake-maven-plugin + scm:git:ssh://git@github.com/jbake-org/jbake-maven-plugin.git + http://github.com/jbake-org/jbake-maven-plugin @@ -213,13 +203,13 @@ - + From ccf4458c16096b2b45543c8b388f3a961fdd7fc5 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 13:39:31 +0100 Subject: [PATCH 062/123] [maven-release-plugin] prepare release v0.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 40fb4dad..4c00908b 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ scm:git:http://github.com/jbake-org/jbake-maven-plugin - scm:git:ssh://git@github.com/jbake-org/jbake-maven-plugin.git + scm:git:https://git@github.com/jbake-org/jbake-maven-plugin.git http://github.com/jbake-org/jbake-maven-plugin From 110ec36b6610929c4a617480356bfc8570ebc0ed Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 13:41:23 +0100 Subject: [PATCH 063/123] [maven-release-plugin] prepare release v0.2.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4c00908b..4f545972 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ scm:git:http://github.com/jbake-org/jbake-maven-plugin - scm:git:https://git@github.com/jbake-org/jbake-maven-plugin.git + scm:git:https://github.com/jbake-org/jbake-maven-plugin.git http://github.com/jbake-org/jbake-maven-plugin From b2de3db99f561ae3cd0f4882ed80944892eed763 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 13:41:29 +0100 Subject: [PATCH 064/123] [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 4f545972..547c24b1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.2.0 + 0.2.1-SNAPSHOT maven-plugin From f63698702283372a7989e8e20dbdce51bc58c41e Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 13:57:23 +0100 Subject: [PATCH 065/123] Updated package names to match published group id. --- .../mojo/jbake => org/jbake/maven}/GenerateMojo.java | 2 +- .../ingenieux/mojo/jbake => org/jbake/maven}/InlineMojo.java | 2 +- .../ingenieux/mojo/jbake => org/jbake/maven}/SeedMojo.java | 2 +- .../ingenieux/mojo/jbake => org/jbake/maven}/WatchMojo.java | 5 ++--- .../mojo/jbake => org/jbake/maven}/util/DirWatcher.java | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) rename src/main/java/{br/com/ingenieux/mojo/jbake => org/jbake/maven}/GenerateMojo.java (98%) rename src/main/java/{br/com/ingenieux/mojo/jbake => org/jbake/maven}/InlineMojo.java (98%) rename src/main/java/{br/com/ingenieux/mojo/jbake => org/jbake/maven}/SeedMojo.java (99%) rename src/main/java/{br/com/ingenieux/mojo/jbake => org/jbake/maven}/WatchMojo.java (97%) rename src/main/java/{br/com/ingenieux/mojo/jbake => org/jbake/maven}/util/DirWatcher.java (97%) diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java similarity index 98% rename from src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java rename to src/main/java/org/jbake/maven/GenerateMojo.java index 4f41b6ff..957a0f44 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -1,4 +1,4 @@ -package br.com.ingenieux.mojo.jbake; +package org.jbake.maven; /* * Copyright 2013 ingenieux Labs diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java b/src/main/java/org/jbake/maven/InlineMojo.java similarity index 98% rename from src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java rename to src/main/java/org/jbake/maven/InlineMojo.java index e11d85c7..6f373a21 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/InlineMojo.java +++ b/src/main/java/org/jbake/maven/InlineMojo.java @@ -1,4 +1,4 @@ -package br.com.ingenieux.mojo.jbake; +package org.jbake.maven; /* * Copyright 2013 ingenieux Labs diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java b/src/main/java/org/jbake/maven/SeedMojo.java similarity index 99% rename from src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java rename to src/main/java/org/jbake/maven/SeedMojo.java index b04fc4b9..d92465e5 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/SeedMojo.java +++ b/src/main/java/org/jbake/maven/SeedMojo.java @@ -1,4 +1,4 @@ -package br.com.ingenieux.mojo.jbake; +package org.jbake.maven; /* * Copyright 2013 ingenieux Labs diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java b/src/main/java/org/jbake/maven/WatchMojo.java similarity index 97% rename from src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java rename to src/main/java/org/jbake/maven/WatchMojo.java index 2ad69f5e..a3bd7be8 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/WatchMojo.java +++ b/src/main/java/org/jbake/maven/WatchMojo.java @@ -1,4 +1,4 @@ -package br.com.ingenieux.mojo.jbake; +package org.jbake.maven; /* * Copyright 2013 ingenieux Labs @@ -18,13 +18,12 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugins.annotations.Mojo; +import org.jbake.maven.util.DirWatcher; import java.io.BufferedReader; import java.io.InputStreamReader; import java.util.concurrent.atomic.AtomicBoolean; -import br.com.ingenieux.mojo.jbake.util.DirWatcher; - import static org.apache.commons.lang.StringUtils.isBlank; /** diff --git a/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java b/src/main/java/org/jbake/maven/util/DirWatcher.java similarity index 97% rename from src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java rename to src/main/java/org/jbake/maven/util/DirWatcher.java index d46f4934..1c7a0602 100644 --- a/src/main/java/br/com/ingenieux/mojo/jbake/util/DirWatcher.java +++ b/src/main/java/org/jbake/maven/util/DirWatcher.java @@ -1,4 +1,4 @@ -package br.com.ingenieux.mojo.jbake.util; +package org.jbake.maven.util; import org.apache.commons.io.monitor.FileAlterationListenerAdaptor; import org.apache.commons.io.monitor.FileAlterationMonitor; From dacbb81baa741d0f6ca9590f70a33e127a7faf07 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 14:08:11 +0100 Subject: [PATCH 066/123] Reverted change to version for tag. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 547c24b1..4f545972 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.2.1-SNAPSHOT + 0.2.0 maven-plugin From 712e1340b583fbbbff1f995e7268a3fc70d1f42e Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 14:09:44 +0100 Subject: [PATCH 067/123] Reverted version for tag. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 547c24b1..4f545972 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.2.1-SNAPSHOT + 0.2.0 maven-plugin From d29993d12b3a25ee8f5a623cd2017a0d25fa7672 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Fri, 2 Jun 2017 21:49:56 +0100 Subject: [PATCH 068/123] Added README. --- README.asciidoc | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 README.asciidoc diff --git a/README.asciidoc b/README.asciidoc new file mode 100644 index 00000000..0d3d2acf --- /dev/null +++ b/README.asciidoc @@ -0,0 +1,36 @@ += JBake Maven Plugin +Jonathan Bullock +2017-06-02 +:idprefix: + +JBake Maven Plugin is a Maven plugin allowing you to integrate http://jbake.org[JBake] into your projects build. This is the official version published at +the following Maven coordinates: + +---- + + org.jbake + jbake-maven-plugin + 0.2.0 + +---- + +Special thanks must go to the original author of this plugin - Aldrin Leal[https://github.com/aldrinleal]. + +== Versioning + +The project adopts the http://semver.org[Semantic Versioning] spec to maintain an understandable backwards compatibility strategy. + +The version format is as follows: + +---- +..- @@ -130,7 +135,7 @@ org.jbake jbake-core - 2.4.0 + 2.5.1 org.apache.maven From 58fa7d9d971119d003569befa756d4d28f21753d Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sun, 22 Apr 2018 20:46:05 +0100 Subject: [PATCH 071/123] Fixes #5 Edited the incorrect opening tag. --- src/main/resources/META-INF/plexus/components.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/META-INF/plexus/components.xml b/src/main/resources/META-INF/plexus/components.xml index 50b1ab4c..b8cbddd6 100644 --- a/src/main/resources/META-INF/plexus/components.xml +++ b/src/main/resources/META-INF/plexus/components.xml @@ -9,7 +9,7 @@ default - ${project.groupId}:${project.artifactId}:${project.version}:generate + ${project.groupId}:${project.artifactId}:${project.version}:generate From 98cc1bd1fd5eaa97685818e1d85cf23ffd94ec3e Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sun, 22 Apr 2018 21:37:10 +0100 Subject: [PATCH 072/123] Fixes #8 Upgraded JBake dependency and cleaned up the rest declared. --- pom.xml | 44 +------------------------------------------- 1 file changed, 1 insertion(+), 43 deletions(-) diff --git a/pom.xml b/pom.xml index 9980b6ab..c1b90cb1 100644 --- a/pom.xml +++ b/pom.xml @@ -66,25 +66,11 @@ org.jbake jbake-core - - - org.eclipse.jetty - jetty-server - - com.sparkjava spark-core - - org.eclipse.jetty - jetty-util - - - org.eclipse.jetty - jetty-server - org.apache.maven maven-plugin-api @@ -118,16 +104,6 @@ commons-io commons-io - @@ -135,7 +111,7 @@ org.jbake jbake-core - 2.5.1 + 2.6.1 org.apache.maven @@ -194,28 +170,10 @@ spark-core 2.3 - - org.eclipse.jetty - jetty-util - 9.3.2.v20150730 - - - org.eclipse.jetty - jetty-server - 9.3.2.v20150730 - - - org.apache.maven.plugins From d25bc69545fd6c9bdb15aabd7416e46a6ac3a91e Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 23 Apr 2018 12:59:18 +0100 Subject: [PATCH 073/123] [maven-release-plugin] prepare release v0.3.0 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9980b6ab..4838ddd1 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.0-SNAPSHOT + 0.3.0 maven-plugin From 14f6b1074ddcf9e42cf4d4603850b72db22f3d18 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 23 Apr 2018 12:59:25 +0100 Subject: [PATCH 074/123] [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 4838ddd1..4840eca6 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.0 + 0.4.0-SNAPSHOT maven-plugin From 88b3b0f02061312053c8182f5b73b427f0ada4d0 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 23 Apr 2018 13:12:30 +0100 Subject: [PATCH 075/123] [maven-release-plugin] prepare release v0.3.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5ad9207f..bdbf1256 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.4.0-SNAPSHOT + 0.3.1 maven-plugin From 17acfbbf976296db9dbce0adf072f7edfd5f6676 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 23 Apr 2018 13:12:36 +0100 Subject: [PATCH 076/123] [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 bdbf1256..5ad9207f 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.1 + 0.4.0-SNAPSHOT maven-plugin From a4f74b355a67d698a22d2c8860449c6e7b9fd761 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Mon, 23 Apr 2018 13:28:25 +0100 Subject: [PATCH 077/123] Updated readme with details of goals. --- README.asciidoc | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 538a30a2..eed9bc1a 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1,6 +1,6 @@ = JBake Maven Plugin Jonathan Bullock -2017-06-02 +2018-04-23 :idprefix: JBake Maven Plugin is a Maven plugin allowing you to integrate http://jbake.org[JBake] into your projects build. This is the official version published at @@ -10,12 +10,27 @@ the following Maven coordinates: org.jbake jbake-maven-plugin - 0.2.0 + 0.3.1 ---- Special thanks must go to the original author of this plugin - https://github.com/aldrinleal[Aldrin Leal]. +== Goals + +There are 4 goals provided by this plugin: + +* `jbake:seed` - seeds your project/site with example content and templates +* `jbake:generate` - bakes your project/site +* `jbake:watch` - watches to changes and bakes your site whenever a change is detected +* `jbake:inline` - bakes, watches and serves out content on http://localhost:8080[http://localhost:8080] + +You can also more details on each goal by running the help goal: + +---- +$ mvn jbake:help -Ddetail # -DgoalName=[seed|generate|watch|inline] +---- + == Versioning The project adopts the http://semver.org[Semantic Versioning] spec to maintain an understandable backwards compatibility strategy. From a998ccf97cf35854621ea874f25a0009553125be Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Wed, 10 Oct 2018 13:12:29 +0200 Subject: [PATCH 078/123] Adjustments to make it compatible with JBake 2.6.2 This closes #16 --- pom.xml | 2 +- .../java/org/jbake/maven/GenerateMojo.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 5ad9207f..551cd0a9 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.jbake jbake-core - 2.6.1 + 2.6.2 org.apache.maven diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index 957a0f44..473aa7f4 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -27,9 +27,10 @@ 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; +import org.jbake.app.configuration.DefaultJBakeConfiguration; +import org.jbake.app.configuration.JBakeConfiguration; +import org.jbake.app.configuration.JBakeConfigurationFactory; import java.io.File; @@ -88,7 +89,7 @@ protected void reRender() throws MojoExecutionException { Orient.instance().startup(); // TODO: At some point, reuse Oven - Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache); + Oven oven = new Oven(createConfiguration()); oven.setupPaths(); @@ -100,14 +101,19 @@ protected void reRender() throws MojoExecutionException { } } - protected CompositeConfiguration createConfiguration() throws ConfigurationException { + protected JBakeConfiguration createConfiguration() throws ConfigurationException { + JBakeConfigurationFactory jbakeConfigurationFactory = new JBakeConfigurationFactory(); + + // load base config (cast to DefaultJBakeConfig) + DefaultJBakeConfiguration baseConfiguration = (DefaultJBakeConfiguration)jbakeConfigurationFactory.getConfigUtil().loadConfig(inputDirectory); + final CompositeConfiguration config = new CompositeConfiguration(); - config.addConfiguration(ConfigUtil.load(inputDirectory)); + config.addConfiguration(baseConfiguration.getCompositeConfiguration()); config.addConfiguration(new MapConfiguration(this.project.getProperties())); - return config; + return jbakeConfigurationFactory.createDefaultJbakeConfiguration(inputDirectory, outputDirectory, config, isClearCache); } } From 1b4df424bf08d98e85eab0c3f6e7e29a5832b07c Mon Sep 17 00:00:00 2001 From: Daniel Schwering Date: Tue, 13 Nov 2018 12:39:55 +0100 Subject: [PATCH 079/123] Update to JBake 2.6.3 --- pom.xml | 4 ++-- .../java/org/jbake/maven/GenerateMojo.java | 24 ++++++++----------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 5ad9207f..5b169121 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.jbake jbake-core - 2.6.1 + 2.6.3 org.apache.maven @@ -178,7 +178,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.6.0 jbake diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index 957a0f44..90ee7ba0 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -18,7 +18,6 @@ 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; @@ -27,9 +26,10 @@ 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; +import org.jbake.app.configuration.ConfigUtil; +import org.jbake.app.configuration.DefaultJBakeConfiguration; +import org.jbake.app.configuration.JBakeConfiguration; import java.io.File; @@ -88,9 +88,7 @@ protected void reRender() throws MojoExecutionException { Orient.instance().startup(); // TODO: At some point, reuse Oven - Oven oven = new Oven(inputDirectory, outputDirectory, createConfiguration(), isClearCache); - - oven.setupPaths(); + Oven oven = new Oven(createConfiguration()); oven.bake(); } catch (Exception e) { @@ -100,14 +98,12 @@ protected void reRender() throws MojoExecutionException { } } - protected CompositeConfiguration createConfiguration() throws ConfigurationException { - final CompositeConfiguration config = new CompositeConfiguration(); - - config.addConfiguration(ConfigUtil.load(inputDirectory)); - - config.addConfiguration(new MapConfiguration(this.project.getProperties())); - - return config; + protected JBakeConfiguration createConfiguration() throws ConfigurationException { + DefaultJBakeConfiguration jBakeConfiguration = (DefaultJBakeConfiguration) new ConfigUtil().loadConfig(inputDirectory); + jBakeConfiguration.getCompositeConfiguration().addConfiguration(new MapConfiguration(this.project.getProperties())); + jBakeConfiguration.setDestinationFolder(outputDirectory); + jBakeConfiguration.setClearCache(isClearCache); + return jBakeConfiguration; } } From f51050ffe3342f5b989cbaeec240ffbecb1e77ca Mon Sep 17 00:00:00 2001 From: Konrad Windszus Date: Fri, 16 Nov 2018 08:18:00 +0100 Subject: [PATCH 080/123] Fail build on baking errors This closes #13 --- src/main/java/org/jbake/maven/GenerateMojo.java | 16 +++++++++++++--- src/main/java/org/jbake/maven/WatchMojo.java | 3 ++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index 473aa7f4..86cdbfbd 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -23,6 +23,7 @@ import org.apache.commons.configuration.MapConfiguration; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.plugins.annotations.ResolutionScope; @@ -57,13 +58,19 @@ public class GenerateMojo extends AbstractMojo { required = true) protected File inputDirectory; + /** + * Breaks the build when {@code true} and errors occur during baking in JBake oven. + */ + @Parameter(property = "jbake.failOnError", defaultValue = "true") + protected boolean failOnError; + /** * Set if cache is present or clear */ @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) protected boolean isClearCache; - public final void execute() throws MojoExecutionException { + public final void execute() throws MojoExecutionException, MojoFailureException { try { executeInternal(); } finally { @@ -79,11 +86,11 @@ protected final void closeQuietly() { } } - protected void executeInternal() throws MojoExecutionException { + protected void executeInternal() throws MojoExecutionException, MojoFailureException { reRender(); } - protected void reRender() throws MojoExecutionException { + protected void reRender() throws MojoExecutionException, MojoFailureException { try { // TODO: Smells bad. A lot Orient.instance().startup(); @@ -94,6 +101,9 @@ protected void reRender() throws MojoExecutionException { oven.setupPaths(); oven.bake(); + if (failOnError && !oven.getErrors().isEmpty()) { + throw new MojoFailureException("Baked with " + oven.getErrors().size() + " errors. Check output above for details!"); + } } catch (Exception e) { getLog().info("Oops", e); diff --git a/src/main/java/org/jbake/maven/WatchMojo.java b/src/main/java/org/jbake/maven/WatchMojo.java index a3bd7be8..6402af07 100644 --- a/src/main/java/org/jbake/maven/WatchMojo.java +++ b/src/main/java/org/jbake/maven/WatchMojo.java @@ -17,6 +17,7 @@ */ import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; import org.jbake.maven.util.DirWatcher; @@ -32,7 +33,7 @@ @Mojo(name = "watch", requiresDirectInvocation = true, requiresProject = false) public class WatchMojo extends GenerateMojo { - public void executeInternal() throws MojoExecutionException { + public void executeInternal() throws MojoExecutionException, MojoFailureException { reRender(); Long lastProcessed = Long.valueOf(System.currentTimeMillis()); From a9eb7d9da7252a9bc7716047ceaf9e8fd3db6bae Mon Sep 17 00:00:00 2001 From: Gerd Aschemann Date: Sat, 5 Oct 2019 10:16:36 +0200 Subject: [PATCH 081/123] Update to JBake 2.6.4 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aa504b11..8f06372d 100644 --- a/pom.xml +++ b/pom.xml @@ -111,7 +111,7 @@ org.jbake jbake-core - 2.6.3 + 2.6.4 org.apache.maven From 755ef0a3a081feb831c4c7c3f846e69c8cac3bb5 Mon Sep 17 00:00:00 2001 From: Randall Wood <297232+rhwood@users.noreply.github.com> Date: Wed, 15 Apr 2020 08:02:25 -0400 Subject: [PATCH 082/123] fix: Use same default port as the CLI tool --- src/main/java/org/jbake/maven/InlineMojo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/jbake/maven/InlineMojo.java b/src/main/java/org/jbake/maven/InlineMojo.java index 6f373a21..a4c936bf 100644 --- a/src/main/java/org/jbake/maven/InlineMojo.java +++ b/src/main/java/org/jbake/maven/InlineMojo.java @@ -48,7 +48,7 @@ public class InlineMojo extends WatchMojo { /** * Listen Port */ - @Parameter(property = "jbake.port", defaultValue = "8080") + @Parameter(property = "jbake.port", defaultValue = "8820") private Integer port; protected void stopServer() throws MojoExecutionException { From 9ad15de778bc3676267f2c08718bbc199f2eba92 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 15 Apr 2020 22:48:18 +0100 Subject: [PATCH 083/123] [maven-release-plugin] prepare release v0.3.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8f06372d..7d22e08d 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.4.0-SNAPSHOT + 0.3.2 maven-plugin From 59262e0b83a2c4b95d9290533087f76a79ea7714 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 15 Apr 2020 22:48:27 +0100 Subject: [PATCH 084/123] [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 7d22e08d..18a0974e 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.2 + 0.3.3-SNAPSHOT maven-plugin From f3b3ab8ccbf9bbf542675679694059402734a440 Mon Sep 17 00:00:00 2001 From: Randall Wood <297232+rhwood@users.noreply.github.com> Date: Sat, 18 Apr 2020 16:13:03 -0400 Subject: [PATCH 085/123] fix: Use configuration, falling back on default if needed --- src/main/java/org/jbake/maven/InlineMojo.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jbake/maven/InlineMojo.java b/src/main/java/org/jbake/maven/InlineMojo.java index a4c936bf..e99c6eb3 100644 --- a/src/main/java/org/jbake/maven/InlineMojo.java +++ b/src/main/java/org/jbake/maven/InlineMojo.java @@ -1,5 +1,7 @@ package org.jbake.maven; +import org.apache.commons.configuration.ConfigurationException; + /* * Copyright 2013 ingenieux Labs * @@ -48,9 +50,22 @@ public class InlineMojo extends WatchMojo { /** * Listen Port */ - @Parameter(property = "jbake.port", defaultValue = "8820") + @Parameter(property = "jbake.port") private Integer port; + private int getPort() { + if (this.port == null) { + try { + return createConfiguration().getServerPort(); + } catch (ConfigurationException e) { + // ignore since default will be returned + } + } else { + return this.port; + } + return 8820; + } + protected void stopServer() throws MojoExecutionException { stop(); } @@ -59,7 +74,7 @@ protected void initServer() throws MojoExecutionException { externalStaticFileLocation(outputDirectory.getPath()); ipAddress(listenAddress); - port(this.port); + port(getPort()); init(); From 432738dc29accfbee64143136b6b3c9679ee9437 Mon Sep 17 00:00:00 2001 From: Randall Wood <297232+rhwood@users.noreply.github.com> Date: Sat, 18 Apr 2020 16:25:33 -0400 Subject: [PATCH 086/123] doc: Update version on maven and add "live" badge --- README.asciidoc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index eed9bc1a..abd8f754 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -3,6 +3,8 @@ Jonathan Bullock 2018-04-23 :idprefix: +image:https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin/badge.svg[link="https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin"] + JBake Maven Plugin is a Maven plugin allowing you to integrate http://jbake.org[JBake] into your projects build. This is the official version published at the following Maven coordinates: @@ -10,7 +12,7 @@ the following Maven coordinates: org.jbake jbake-maven-plugin - 0.3.1 + 0.3.2 ---- @@ -48,4 +50,4 @@ The version format is as follows: == Copyright & License -This plugin is licensed under the Apache 2.0 License. \ No newline at end of file +This plugin is licensed under the Apache 2.0 License. From 9192424e535cdf5d02c64f6e9384e0921df4a60a Mon Sep 17 00:00:00 2001 From: Frank Becker Date: Fri, 1 May 2020 13:14:02 +0200 Subject: [PATCH 087/123] update jbake to 2.6.5 --- pom.xml | 27 ++-- .../java/org/jbake/maven/GenerateMojo.java | 126 ++++++++---------- src/main/java/org/jbake/maven/WatchMojo.java | 4 +- 3 files changed, 73 insertions(+), 84 deletions(-) diff --git a/pom.xml b/pom.xml index 18a0974e..66b3d9e8 100644 --- a/pom.xml +++ b/pom.xml @@ -76,8 +76,12 @@ maven-plugin-api - commons-lang - commons-lang + org.apache.commons + commons-lang3 + + + commons-configuration + commons-configuration org.apache.maven @@ -111,7 +115,7 @@ org.jbake jbake-core - 2.6.4 + 2.6.5 org.apache.maven @@ -119,14 +123,19 @@ 3.3.9 - commons-lang - commons-lang - 2.6 + org.apache.commons + commons-lang3 + 3.10 + + + commons-configuration + commons-configuration + 1.10 commons-io commons-io - 2.4 + 2.6 org.apache.maven.plugin-testing @@ -233,12 +242,12 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.8.1 + 2.9 org.apache.maven.plugins maven-plugin-plugin - 3.4 + 3.6.0 org.apache.maven.plugins diff --git a/src/main/java/org/jbake/maven/GenerateMojo.java b/src/main/java/org/jbake/maven/GenerateMojo.java index c9ee76d5..499b82cf 100644 --- a/src/main/java/org/jbake/maven/GenerateMojo.java +++ b/src/main/java/org/jbake/maven/GenerateMojo.java @@ -16,8 +16,6 @@ * limitations under the License. */ -import com.orientechnologies.orient.core.Orient; - import org.apache.commons.configuration.ConfigurationException; import org.apache.commons.configuration.MapConfiguration; import org.apache.maven.plugin.AbstractMojo; @@ -28,9 +26,9 @@ import org.apache.maven.plugins.annotations.ResolutionScope; import org.apache.maven.project.MavenProject; import org.jbake.app.Oven; -import org.jbake.app.configuration.ConfigUtil; import org.jbake.app.configuration.DefaultJBakeConfiguration; import org.jbake.app.configuration.JBakeConfiguration; +import org.jbake.app.configuration.JBakeConfigurationFactory; import java.io.File; @@ -39,81 +37,63 @@ */ @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. - */ - @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; - - /** - * Breaks the build when {@code true} and errors occur during baking in JBake oven. - */ - @Parameter(property = "jbake.failOnError", defaultValue = "true") - protected boolean failOnError; - - /** - * Set if cache is present or clear - */ - @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) - protected boolean isClearCache; - - public final void execute() throws MojoExecutionException, MojoFailureException { - try { - executeInternal(); - } finally { - closeQuietly(); + @Parameter(defaultValue = "${project}") + protected MavenProject project; + + /** + * 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; + + /** + * Breaks the build when {@code true} and errors occur during baking in JBake oven. + */ + @Parameter(property = "jbake.failOnError", defaultValue = "true") + protected boolean failOnError; + + /** + * Set if cache is present or clear + */ + @Parameter(property = "jbake.isClearCache", defaultValue = "false", required = true) + protected boolean isClearCache; + + public final void execute() throws MojoExecutionException { + executeInternal(); } - } - protected final void closeQuietly() { - try { - Orient.instance().shutdown(); - } catch (Exception e) { - getLog().warn("Oops", e); + protected void executeInternal() throws MojoExecutionException { + reRender(); } - } - protected void executeInternal() throws MojoExecutionException, MojoFailureException { - reRender(); - } - - protected void reRender() throws MojoExecutionException, MojoFailureException { - try { - // TODO: Smells bad. A lot - Orient.instance().startup(); - - // TODO: At some point, reuse Oven - Oven oven = new Oven(createConfiguration()); - - oven.bake(); - if (failOnError && !oven.getErrors().isEmpty()) { - throw new MojoFailureException("Baked with " + oven.getErrors().size() + " errors. Check output above for details!"); - } - } catch (Exception e) { - getLog().info("Oops", e); - - throw new MojoExecutionException("Failure when running: ", e); + protected void reRender() throws MojoExecutionException { + try { + // TODO: At some point, reuse Oven + Oven oven = new Oven(createConfiguration()); + oven.bake(); + if (failOnError && !oven.getErrors().isEmpty()) { + throw new MojoFailureException("Baked with " + oven.getErrors().size() + " errors. Check output above for details!"); + } + } catch (Exception e) { + getLog().info("Oops", e); + + throw new MojoExecutionException("Failure when running: ", e); + } } - } - protected JBakeConfiguration createConfiguration() throws ConfigurationException { - DefaultJBakeConfiguration jBakeConfiguration = (DefaultJBakeConfiguration) new ConfigUtil().loadConfig(inputDirectory); - jBakeConfiguration.getCompositeConfiguration().addConfiguration(new MapConfiguration(this.project.getProperties())); - jBakeConfiguration.setDestinationFolder(outputDirectory); - jBakeConfiguration.setClearCache(isClearCache); - return jBakeConfiguration; - } + protected JBakeConfiguration createConfiguration() throws ConfigurationException { + DefaultJBakeConfiguration jBakeConfiguration = new JBakeConfigurationFactory().createDefaultJbakeConfiguration(inputDirectory, outputDirectory, isClearCache); + jBakeConfiguration.getCompositeConfiguration().addConfiguration(new MapConfiguration(this.project.getProperties())); + return jBakeConfiguration; + } } diff --git a/src/main/java/org/jbake/maven/WatchMojo.java b/src/main/java/org/jbake/maven/WatchMojo.java index 6402af07..5c47575b 100644 --- a/src/main/java/org/jbake/maven/WatchMojo.java +++ b/src/main/java/org/jbake/maven/WatchMojo.java @@ -33,10 +33,10 @@ @Mojo(name = "watch", requiresDirectInvocation = true, requiresProject = false) public class WatchMojo extends GenerateMojo { - public void executeInternal() throws MojoExecutionException, MojoFailureException { + public void executeInternal() throws MojoExecutionException { reRender(); - Long lastProcessed = Long.valueOf(System.currentTimeMillis()); + Long lastProcessed = System.currentTimeMillis(); getLog().info( "Now listening for changes on path " + inputDirectory.getPath()); From 0b250c1ddad887dbe50a81765c3bf53c0a4ada64 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sat, 12 Sep 2020 17:41:59 +0100 Subject: [PATCH 088/123] [maven-release-plugin] prepare release v0.3.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 66b3d9e8..08f203a6 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.3-SNAPSHOT + 0.3.3 maven-plugin From 0fb5ac0808ecf467441159199bfbf1ab1dc50569 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sat, 12 Sep 2020 17:42:07 +0100 Subject: [PATCH 089/123] [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 08f203a6..8a57cf15 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.jbake jbake-maven-plugin - 0.3.3 + 0.3.4-SNAPSHOT maven-plugin From e839bb8caa549e2d164e91ba6a1d2526f8805a07 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Sat, 12 Sep 2020 21:52:55 +0100 Subject: [PATCH 090/123] Updated version info. --- README.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index abd8f754..a4e675c9 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1,6 +1,6 @@ = JBake Maven Plugin Jonathan Bullock -2018-04-23 +2020-09-12 :idprefix: image:https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin/badge.svg[link="https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin"] @@ -12,7 +12,7 @@ the following Maven coordinates: org.jbake jbake-maven-plugin - 0.3.2 + 0.3.3 ---- From 57b114fa24f00bb3549ebcf163570108cfaffce1 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 3 Mar 2021 23:46:26 +0000 Subject: [PATCH 091/123] Resolves #25, resolves #32 --- README.asciidoc | 124 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index a4e675c9..eaeb6e6d 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -1,11 +1,11 @@ = JBake Maven Plugin Jonathan Bullock -2020-09-12 +2021-03-03 :idprefix: image:https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin/badge.svg[link="https://maven-badges.herokuapp.com/maven-central/org.jbake/jbake-maven-plugin"] -JBake Maven Plugin is a Maven plugin allowing you to integrate http://jbake.org[JBake] into your projects build. This is the official version published at +JBake Maven Plugin is a Maven plugin allowing you to integrate http://jbake.org[JBake] into your projects build. This is the official version published at the following Maven coordinates: ---- @@ -18,6 +18,126 @@ the following Maven coordinates: Special thanks must go to the original author of this plugin - https://github.com/aldrinleal[Aldrin Leal]. +== Usage + +To use JBake Maven Plugin in your build add the plugin into your pom.xml as shown below: + +---- + +... + + ... + + org.jbake + jbake-maven-plugin + 0.3.2 + + + + + + default-generate + generate-resources + + generate + + + + + + + + ... + +... + +---- + +=== Dependencies + +The plugin itself includes all required dependencies such as jbake-core, however you will need to explicitly declare dependencies for +the content formats and template engines used in your project. As these dependencies are marked as optional to reduce bloat. + +If you have AsciiDoc content you'll need this dependency: + +---- + + org.asciidoctor + asciidoctorj + 2.2.0 + +---- + +If you have Markdown content you'll need these dependencies: + +---- + + com.vladsch.flexmark + flexmark + 0.61.0 + + + com.vladsch.flexmark + flexmark-profile-pegdown + 0.61.0 + +---- + +If you have Freemarker templates then you'll need this dependency: + +---- + + org.freemarker + freemarker + 2.3.30 + +---- + +If you have Groovy templates then you'll need these dependencies: + +---- + + org.codehaus.groovy + groovy + 3.0.2 + + + org.codehaus.groovy + groovy-templates + 3.0.2 + + + org.codehaus.groovy + groovy-dateutil + 3.0.2 + +---- + +If you have Thymeleaf templates then you'll need this dependency: + +---- + + org.thymeleaf + thymeleaf + 3.0.11.RELEASE + +---- + +If you have Jade4J templates then you'll need this dependency: + +---- + + de.neuland-bfi + jade4j + 1.3.2 + +---- + +An example of the plugin being used can be found in this project: https://github.com/jonbullock/maven-jbake-site[https://github.com/jonbullock/maven-jbake-site] + == Goals There are 4 goals provided by this plugin: From ad85e942a1ba895306ddd8e8a17f0a7e237df0c4 Mon Sep 17 00:00:00 2001 From: Jonathan Bullock Date: Wed, 3 Mar 2021 23:50:11 +0000 Subject: [PATCH 092/123] Fixed whitespace --- README.asciidoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index eaeb6e6d..4d950df3 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -29,8 +29,8 @@ To use JBake Maven Plugin in your build add the plugin into your pom.xml as show ... org.jbake - jbake-maven-plugin - 0.3.2 + jbake-maven-plugin + 0.3.2 - 1.8 - 1.8 - - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - attach-javadocs - - jar - - - -Xdoclint:none - - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.9 - - - org.apache.maven.plugins - maven-plugin-plugin - 3.6.0 - - - org.apache.maven.plugins - maven-javadoc-plugin - 2.10.3 - - - org.apache.maven.plugins - maven-jxr-plugin - 2.5 - - - - From 50b5980836974c14de3c3a79129c3ab78c4b0b08 Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Thu, 30 Dec 2021 09:52:57 +0100 Subject: [PATCH 119/123] jbake-maven-plugin: BUILD.adoc mention --- BUILD.adoc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BUILD.adoc b/BUILD.adoc index 024b8d13..dc4f0ffe 100644 --- a/BUILD.adoc +++ b/BUILD.adoc @@ -25,7 +25,7 @@ To get an overview of all available tasks with a short description run `./gradle == Structure -There are 3 projects +There are 4 projects: root aka. jbake-base:: configures subprojects, jacoco execution aggregation and coveralls @@ -34,6 +34,9 @@ jbake-core:: - the core library. produces jbake-core-{version}.jar (`build/libs`) - publishes to bintray maven repository jbake-core +jbake-maven-plugin:: + - the JBake maven plugin, build by Gradle too + jbake-dist:: - bundles the cli to an distribution (`build/distribution`) - publishes to bintray binary repository jbake From 52b7ef4bd75916c061935c528d0e51b76c89eac5 Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Thu, 30 Dec 2021 10:50:32 +0100 Subject: [PATCH 120/123] Restore the optional dependencies --- jbake-core/build.gradle | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/jbake-core/build.gradle b/jbake-core/build.gradle index 8c05afd2..706d070b 100644 --- a/jbake-core/build.gradle +++ b/jbake-core/build.gradle @@ -4,6 +4,7 @@ plugins { id "org.jbake.convention.java-common" id 'java-library' id 'org.ajoberstar.grgit' version "$grgitVersion" + id 'nebula.optional-base' version '3.0.3' } apply from: "$rootDir/gradle/maven-publishing.gradle" @@ -21,22 +22,22 @@ dependencies { exclude group: "junit", module: "junit" } implementation "com.orientechnologies:orientdb-core:$orientDbVersion" - api "org.asciidoctor:asciidoctorj:$asciidoctorjVersion" - api "org.codehaus.groovy:groovy:$groovyVersion" - api "org.codehaus.groovy:groovy-templates:$groovyVersion" - api "org.codehaus.groovy:groovy-dateutil:$groovyVersion" - api "org.freemarker:freemarker:$freemarkerVersion" - api "org.thymeleaf:thymeleaf:$thymeleafVersion" - api "de.neuland-bfi:jade4j:$jade4jVersion" - api "com.vladsch.flexmark:flexmark:$flexmarkVersion" - api "com.vladsch.flexmark:flexmark-profile-pegdown:$flexmarkVersion" - api "io.pebbletemplates:pebble:$pebbleVersion" + api "org.asciidoctor:asciidoctorj:$asciidoctorjVersion", optional + api "org.codehaus.groovy:groovy:$groovyVersion", optional + api "org.codehaus.groovy:groovy-templates:$groovyVersion", optional + api "org.codehaus.groovy:groovy-dateutil:$groovyVersion", optional + api "org.freemarker:freemarker:$freemarkerVersion", optional + api "org.thymeleaf:thymeleaf:$thymeleafVersion", optional + api "de.neuland-bfi:jade4j:$jade4jVersion", optional + api "com.vladsch.flexmark:flexmark:$flexmarkVersion", optional + api "com.vladsch.flexmark:flexmark-profile-pegdown:$flexmarkVersion", optional + api "io.pebbletemplates:pebble:$pebbleVersion", optional implementation "org.jsoup:jsoup:$jsoupVersion" - implementation "org.yaml:snakeyaml:$snakeYamlVersion" + implementation "org.yaml:snakeyaml:$snakeYamlVersion", optional // cli specific dependencies - implementation "org.eclipse.jetty:jetty-server:$jettyServerVersion" - implementation "info.picocli:picocli:$picocli" + implementation "org.eclipse.jetty:jetty-server:$jettyServerVersion", optional + implementation "info.picocli:picocli:$picocli", optional } processResources { From 8ba2515abe8a6ec059c3359290c6d467acc62116 Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Thu, 30 Dec 2021 11:46:49 +0100 Subject: [PATCH 121/123] jbake-maven-plugin: mention that all optional dependencies are now included out of the box --- jbake-maven-plugin/README.asciidoc | 94 ++++-------------------------- 1 file changed, 10 insertions(+), 84 deletions(-) diff --git a/jbake-maven-plugin/README.asciidoc b/jbake-maven-plugin/README.asciidoc index e5bd5e4a..dbfebd36 100644 --- a/jbake-maven-plugin/README.asciidoc +++ b/jbake-maven-plugin/README.asciidoc @@ -30,12 +30,10 @@ To use JBake Maven Plugin in your build add the plugin into your pom.xml as show org.jbake jbake-maven-plugin - ... + ... - + + @@ -46,9 +44,6 @@ To use JBake Maven Plugin in your build add the plugin into your pom.xml as show - - - ... @@ -58,83 +53,14 @@ To use JBake Maven Plugin in your build add the plugin into your pom.xml as show === Dependencies -The plugin itself includes all required dependencies such as jbake-core, however you will need to explicitly declare dependencies for -the content formats and template engines used in your project. As these dependencies are marked as optional to reduce bloat. +The plugin automatically includes all optional dependencies of `jbake-core`, +including freemarker, thymeleaf, asciidoctor, flexmark (markdown), etc. +This makes it easy to get started with the plugin. +It also reduces maintenance when upgrading to a new JBake version, +because you don't need to align the versions of freemarker, thymeleaf, asciidoctor, flexmark, etc. -If you have AsciiDoc content you'll need this dependency: - ----- - - org.asciidoctor - asciidoctorj - 2.4.3 - ----- - -If you have Markdown content you'll need these dependencies: - ----- - - com.vladsch.flexmark - flexmark - 0.62.2 - - - com.vladsch.flexmark - flexmark-profile-pegdown - 0.62.2 - ----- - -If you have Freemarker templates then you'll need this dependency: - ----- - - org.freemarker - freemarker - 2.3.31 - ----- - -If you have Groovy templates then you'll need these dependencies: - ----- - - org.codehaus.groovy - groovy - 3.0.7 - - - org.codehaus.groovy - groovy-templates - 3.0.7 - - - org.codehaus.groovy - groovy-dateutil - 3.0.7 - ----- - -If you have Thymeleaf templates then you'll need this dependency: - ----- - - org.thymeleaf - thymeleaf - 3.0.12.RELEASE - ----- - -If you have Jade4J templates then you'll need this dependency: - ----- - - de.neuland-bfi - jade4j - 1.3.2 - ----- +However, if you want your build to only download the bare minimum it needs, +you can use `` to exclude the dependencies you don't need. An example of the plugin being used can be found in this project: https://github.com/jonbullock/maven-jbake-site[https://github.com/jonbullock/maven-jbake-site] From 941c706c59dc3f4690e0774fdcfb19080638422a Mon Sep 17 00:00:00 2001 From: Geoffrey De Smet Date: Fri, 31 Dec 2021 21:56:00 +0100 Subject: [PATCH 122/123] Restore optional flag for commons-vfs2 too --- jbake-core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jbake-core/build.gradle b/jbake-core/build.gradle index 706d070b..e6b9c4ad 100644 --- a/jbake-core/build.gradle +++ b/jbake-core/build.gradle @@ -16,7 +16,7 @@ dependencies { api "commons-io:commons-io:$commonsIoVersion" api "org.apache.commons:commons-configuration2:$commonsConfigurationVersion" implementation "commons-beanutils:commons-beanutils:$commonsBeanutilsVersion" - implementation "org.apache.commons:commons-vfs2:$commonsVfs2Version" + implementation "org.apache.commons:commons-vfs2:$commonsVfs2Version", optional implementation "org.apache.commons:commons-lang3:$commonsLangVersion" implementation("com.googlecode.json-simple:json-simple:$jsonSimpleVersion") { exclude group: "junit", module: "junit" From c24275746c604828cfea158f48b11a93e4ab235d Mon Sep 17 00:00:00 2001 From: Frank Becker Date: Sat, 1 Jan 2022 19:31:54 +0100 Subject: [PATCH 123/123] add pom definition and enable signatures for jbake-maven-plugin switch back to maven plugin development gradle plugin from Benedikt Ritter https://github.com/britter/maven-plugin-development --- build.gradle | 8 + .../org.jbake.convention.java-common.gradle | 10 ++ gradle/maven-publishing.gradle | 150 ++++++++---------- jbake-core/build.gradle | 19 ++- jbake-dist/build.gradle | 1 - jbake-maven-plugin/build.gradle | 22 ++- jbake-maven-plugin/gradle.properties | 4 +- 7 files changed, 121 insertions(+), 93 deletions(-) diff --git a/build.gradle b/build.gradle index cb339964..6a2f560a 100644 --- a/build.gradle +++ b/build.gradle @@ -1,10 +1,15 @@ +import java.time.format.DateTimeFormatter + plugins { id "io.github.gradle-nexus.publish-plugin" version "1.0.0" id 'com.github.ben-manes.versions' version '0.38.0' + id 'org.ajoberstar.grgit' version "$grgitVersion" id "eclipse" id "idea" } +def buildTimeAndDate = grgit.head().dateTime + // common variables ext { isTravis = (System.getenv("TRAVIS") == "true") @@ -17,6 +22,9 @@ ext { sonarDefaultProjectKey = "org.jbake:jbake-base:jbake-core" sonarURL = System.getenv("SONARHOST") ?: sonarDefaultURL sonarProjectKey = System.getenv("SONARPROJECTKEY") ?: sonarDefaultProjectKey + buildDate = buildTimeAndDate.format(DateTimeFormatter.ofPattern('yyyy-MM-dd')) + buildTime = buildTimeAndDate.format(DateTimeFormatter.ofPattern('HH:mm:ss.SSSZ')) + isReleaseVersion = !version.endsWith("SNAPSHOT") } nexusPublishing { diff --git a/buildSrc/src/main/groovy/org/jbake/convention/org.jbake.convention.java-common.gradle b/buildSrc/src/main/groovy/org/jbake/convention/org.jbake.convention.java-common.gradle index 33f60525..359ba6d8 100644 --- a/buildSrc/src/main/groovy/org/jbake/convention/org.jbake.convention.java-common.gradle +++ b/buildSrc/src/main/groovy/org/jbake/convention/org.jbake.convention.java-common.gradle @@ -48,6 +48,16 @@ tasks.withType(Test) { jvmArgs args } +task javadocJar(type: Jar) { + archiveClassifier.set('javadoc') + from javadoc +} + +task sourcesJar(type: Jar) { + archiveClassifier.set('sources') + from sourceSets.main.allSource +} + tasks.withType(AbstractArchiveTask) { preserveFileTimestamps = false reproducibleFileOrder = true diff --git a/gradle/maven-publishing.gradle b/gradle/maven-publishing.gradle index c49e0c4b..f5fb4f55 100644 --- a/gradle/maven-publishing.gradle +++ b/gradle/maven-publishing.gradle @@ -1,111 +1,85 @@ -import java.time.format.DateTimeFormatter - apply plugin: 'maven-publish' -def buildTimeAndDate = grgit.head().dateTime -ext { - buildDate = buildTimeAndDate.format(DateTimeFormatter.ofPattern('yyyy-MM-dd')) - buildTime = buildTimeAndDate.format(DateTimeFormatter.ofPattern('HH:mm:ss.SSSZ')) - isReleaseVersion = !version.endsWith("SNAPSHOT") -} - -task javadocJar(type: Jar) { - archiveClassifier.set('javadoc') - from javadoc -} - -task sourcesJar(type: Jar) { - archiveClassifier.set('sources') - from sourceSets.main.allSource -} - publishing { publications { - mavenJava(MavenPublication) { - from components.java + mavenJava(MavenPublication) { + from components.java - artifact javadocJar - artifact sourcesJar + artifact javadocJar + artifact sourcesJar - pom { - name = "jbake" - description = project.description - url = project.website - developers { - developer { - id = 'jonbullock' - name = 'Jonathan Bullock' - email = 'jonbullock@gmail.com' - url = 'http://jonathanbullock.com' - timezone = 'Europe/London' - } - developer { - id = 'ancho' - name = 'Frank Becker' - email = 'frank@calmdevelopment.de' - timezone = 'Europe/Berlin' - } - developer { - id = 'manikmagar' - name = 'Manik Magar' - url = 'https://manik.magar.me/' - timezone = 'America/New_York' - } - developer { - id = 'aldrinleal' - name = 'Aldrin Leal' - timezone = 'America/Bogota' - } + pom { + name = "jbake" + description = project.description + url = project.website + developers { + developer { + id = 'jonbullock' + name = 'Jonathan Bullock' + email = 'jonbullock@gmail.com' + url = 'http://jonathanbullock.com' + timezone = 'Europe/London' } - scm { - url = project.vcs - connection = 'scm:git:git@github.com:jbake-org/jbake.git' - developerConnection = 'scm:git:https://github.com/jbake-org/jbake.git' + developer { + id = 'ancho' + name = 'Frank Becker' + email = 'frank@calmdevelopment.de' + timezone = 'Europe/Berlin' } - issueManagement { - system = 'GitHub Issues' - url = project.issues + developer { + id = 'manikmagar' + name = 'Manik Magar' + url = 'https://manik.magar.me/' + timezone = 'America/New_York' } - mailingLists { - - mailingList { - name = 'jbake-dev' - subscribe = 'jbake-dev@googlegroups.com' - unsubscribe = 'jbake-dev+unsubscribe@googlegroups.com' - archive = 'http://groups.google.com/group/jbake-dev' - } - mailingList { - name = 'jbake-user' - subscribe = 'jbake-user@googlegroups.com' - unsubscribe = 'jbake-user+unsubscribe@googlegroups.com' - archive = 'http://groups.google.com/group/jbake-user' - } + developer { + id = 'aldrinleal' + name = 'Aldrin Leal' + timezone = 'America/Bogota' } + } + scm { + url = project.vcs + connection = 'scm:git:git@github.com:jbake-org/jbake.git' + developerConnection = 'scm:git:https://github.com/jbake-org/jbake.git' + } + issueManagement { + system = 'GitHub Issues' + url = project.issues + } + mailingLists { - licenses { - license { - name = 'The MIT License (MIT)' - url = 'http://opensource.org/licenses/MIT' - } + mailingList { + name = 'jbake-dev' + subscribe = 'jbake-dev@googlegroups.com' + unsubscribe = 'jbake-dev+unsubscribe@googlegroups.com' + archive = 'http://groups.google.com/group/jbake-dev' + } + mailingList { + name = 'jbake-user' + subscribe = 'jbake-user@googlegroups.com' + unsubscribe = 'jbake-user+unsubscribe@googlegroups.com' + archive = 'http://groups.google.com/group/jbake-user' } } } } } +} jar { manifest { attributes( - 'Built-By': System.properties['user.name'], - 'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(), - 'Build-Date': buildDate, - 'Build-Time': buildTime, - 'Specification-Title': project.name, - 'Specification-Version': project.version, - 'Specification-Vendor': project.name, - 'Implementation-Title': project.name, - 'Implementation-Version': project.version, - 'Implementation-Vendor': project.name + 'Built-By': System.properties['user.name'], + 'Created-By': "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})".toString(), + 'Build-Date': buildDate, + 'Build-Time': buildTime, + 'Specification-Title': project.name, + 'Specification-Version': project.version, + 'Specification-Vendor': project.name, + 'Implementation-Title': project.name, + 'Implementation-Version': project.version, + 'Implementation-Vendor': project.name ) } } diff --git a/jbake-core/build.gradle b/jbake-core/build.gradle index e6b9c4ad..b935114f 100644 --- a/jbake-core/build.gradle +++ b/jbake-core/build.gradle @@ -3,7 +3,6 @@ import java.time.format.DateTimeFormatter plugins { id "org.jbake.convention.java-common" id 'java-library' - id 'org.ajoberstar.grgit' version "$grgitVersion" id 'nebula.optional-base' version '3.0.3' } @@ -12,6 +11,24 @@ apply from: "$rootDir/gradle/signing.gradle" description = "The core library of JBake" +publishing { + publications { + mavenJava(MavenPublication) { + pom { + name = "jbake-core" + + licenses { + license { + name = 'The MIT License (MIT)' + url = 'http://opensource.org/licenses/MIT' + } + } + } + } + } +} + + dependencies { api "commons-io:commons-io:$commonsIoVersion" api "org.apache.commons:commons-configuration2:$commonsConfigurationVersion" diff --git a/jbake-dist/build.gradle b/jbake-dist/build.gradle index 30aed779..bd5567bd 100644 --- a/jbake-dist/build.gradle +++ b/jbake-dist/build.gradle @@ -1,7 +1,6 @@ plugins { id "io.sdkman.vendors" version "2.0.0" id "com.github.breadmoirai.github-release" version "2.2.12" - id 'org.ajoberstar.grgit' version "$grgitVersion" id "org.jbake.convention.java-common" id 'application' } diff --git a/jbake-maven-plugin/build.gradle b/jbake-maven-plugin/build.gradle index 1a82b8e1..eb119626 100644 --- a/jbake-maven-plugin/build.gradle +++ b/jbake-maven-plugin/build.gradle @@ -1,10 +1,30 @@ plugins { - id "io.freefair.maven-plugin" version "6.3.0" + id 'de.benediktritter.maven-plugin-development' version '0.3.1' id "org.jbake.convention.java-common" } group = "org.jbake" +apply from: "$rootDir/gradle/maven-publishing.gradle" +apply from: "$rootDir/gradle/signing.gradle" + +publishing { + publications { + mavenJava(MavenPublication) { + pom { + name = "jbake-maven-plugin" + + licenses { + license { + name = 'Apache License, Version 2.0' + url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + } + } + } +} + dependencies { implementation project(":jbake-core") diff --git a/jbake-maven-plugin/gradle.properties b/jbake-maven-plugin/gradle.properties index a6af4c9d..ec2427b8 100644 --- a/jbake-maven-plugin/gradle.properties +++ b/jbake-maven-plugin/gradle.properties @@ -1,2 +1,2 @@ -project_description = JBake Maven Plugin -pluginDisplayName = JBake Maven Plugin +name = jbake-maven-plugin +description = JBake Maven Plugin is a Maven plugin allowing you to integrate JBake into your projects build