Coming Up for Air

From Awestruct to JBake

Thursday, March 19, 2015 |

For some time now, I have been using awestruct to power my blog, and, for the most part, I’ve been happy. However, I have found, especially on the Mac, the Ruby-based environment more difficult to setup than I would like. While I have solved this problem before, it presented itself once again when I was issued a Mac upon joining NetSuite. I can, of course, muddle through it, but I’m tired of fighting it, so I started looking around for an alternative and found JBake.

JBake, described by Dan Allen as the "jekyll of the JVM", is a Java-based static site generator. While the language the tool is written in is not all that relevant in terms of site generation, it is important to me as a developer who has, from time to time, "needed" to extend the tool in one way or another. Being Java-based also makes it a bit easier to integrate with my toolchain (NetBeans, Maven/Gradle, Hudson/Jenkins) for composing and publishing posts. Long story short (too late!), I’ve taken the plunge and migrated my site to JBake.

Naturally, as these things usually happen to be, JBake didn’t support everything I needed, namely, pagination, so I did what all geeks do: I started coding. Currently, pagination lives in my fork. A pull request has been created to integrate this into JBake proper, but, for now, you must build and use my fork. Also note that, while pagination requires no external changes for a user not interested in pagination, things may change as the PR is considered and processed. Of course, the PR could ultimately be rejected, but I’ll cross that bridge if I ever get there. :)

To build it, I used the JBake Maven Plugin. Sadly, again, I needed to fork the plugin to update it to use the current JBake API, so, again, a local build and install. Neither of these is ideal, but, hopefully, these requirements will go away shortly.

There is one more piece that awestruct provides that JBake does: deployment. For that, I simply added a stanza to my Maven POM, which I control/hide behind a profile:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
    <profiles>
        <profile>
            <id>deploy</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>properties-maven-plugin</artifactId>
                        <version>1.0-alpha-2</version>
                        <executions>
                            <execution>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>read-project-properties</goal>
                                </goals>
                                <configuration>
                                    <files>
                                        <file>site.properties</file>
                                    </files>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>1.3.2</version>
                        <executions>
                            <execution>
                                <id>deploy-blog</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>rsync</executable>
                                    <workingDirectory>${project.build.directory}/${project.build.finalName}</workingDirectory>
                                    <arguments>
                                        <argument>-aP</argument>
                                        <argument>--delete</argument>
                                        <argument>-e ssh</argument>
                                        <argument>.</argument>
                                        <argument>${blog.username}@${blog.host}:${blog.dir}</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

It was a bit more work than I’d anticipated, but, in the end, I think it’s been worth it. The only change in the site itself is the feed link has change from feed.atom to feed.xml. If you happen to see other issues, though, please let me know.

Search

    Quotes

    Sample quote

    Quote source

    About

    My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

    I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

    On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

    My Links

    Publications