My Shitty Code

Embracing the Messiness in Search of Epic Solutions

Tag: Maven

  • Maven: Bundling and Unpacking Native Libraries

    Introduction Steps to bundle the native libraries to be pushed to Nexus, and to unpack the native libraries on mvn package. Bundling Native Libraries into a JAR File Let’s assume we have the following native libraries for multiple platforms:- Create a jar that contains these native libraries. The -C options prevents the native folder from […]

  • Maven Archetype Plugin: Velocity Variable Substitutions Not Resolving

    PROBLEM Let’s assume we have the following package.json in our archetype:- When creating a project from this archetype, the Velocity variable substitution for ${rootArtifactId} doesn’t resolve at all. SOLUTION After reading Maven Archetype Plugin’s source code here and here, the Velocity variable substitutions are only performed on the following file extensions:- In another word, if […]

  • Maven Archetype Plugin: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project

    PROBLEM When running mvn archetype:create-from-project with Maven Ear Plugin defined under <pluginManagement>…. … the following exception occurs… SOLUTION It appears this problem happens when using Maven Archetype Plugin 2.3, but works fine when using 2.2. To fix this, define an empty <modules> under <configuration> to prevent NullPointerException.

  • Maven: Skinning Generated Site

    PROBLEM The default Maven generated site looks like web pages created in the 80s:- SOLUTION The good news is Maven allows us to change the skin. To use one of these pre-defined skins, create site.xml at this location:- In site.xml, enter the following:- In the above example, we use Maven Fluido Skin. In Maven 3, […]

  • JaCoCo Web Report Not Rendering Properly in GitHub Pages

    PROBLEM When pushing JaCoCo web report to GitHub’s gh-pages branch, it does not render properly on the web. For example:- The GitHub pages are powered by Jekyll. By default, Jekyll does not allow directories or files that begin with a dot, pound sign, tilde or underscore. Since JaCoCo places all the image and CSS files […]

  • Maven: Deploying Generated Site to GitHub

    INTRO GitHub provides an incredible feature that allows us to easily push Maven generated site to our project’s GitHub repository. Here’s how to do it… STEP 1: Define GitHub credential Go to ~/.m2/settings.xml and add your GitHub username and password:- STEP 2: Define GitHub’s site-maven-plugin GitHub provides its own site-maven-plugin that can be used to […]