<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Maven &#8211; My Shitty Code</title>
	<atom:link href="https://myshittycode.com/tag/maven/feed/" rel="self" type="application/rss+xml" />
	<link>https://myshittycode.com</link>
	<description>Embracing the Messiness in Search of Epic Solutions</description>
	<lastBuildDate>Fri, 06 Jan 2023 16:46:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.1</generator>

<image>
	<url>https://myshittycode.com/wp-content/uploads/2022/04/cropped-icon-32x32.png</url>
	<title>Maven &#8211; My Shitty Code</title>
	<link>https://myshittycode.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">205304208</site>	<item>
		<title>Maven: Bundling and Unpacking Native Libraries</title>
		<link>https://myshittycode.com/2015/11/09/maven-bundling-and-unpacking-native-libraries/</link>
					<comments>https://myshittycode.com/2015/11/09/maven-bundling-and-unpacking-native-libraries/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Tue, 10 Nov 2015 01:57:26 +0000</pubDate>
				<category><![CDATA[Server]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Sonatype Nexus]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=854</guid>

					<description><![CDATA[<p>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&#8217;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 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/11/09/maven-bundling-and-unpacking-native-libraries/">Maven: Bundling and Unpacking Native Libraries</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Introduction</h2>



<p>Steps to bundle the native libraries to be pushed to Nexus, and to unpack the native libraries on <b>mvn package</b>.</p>



<h2 class="wp-block-heading">Bundling Native Libraries into a JAR File</h2>



<p>Let&#8217;s assume we have the following native libraries for multiple platforms:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
tree native

native
├── linux
│   ├── x86
│   │   └── libnative_synchronization.so
│   └── x86_64
│       └── libnative_synchronization.so
├── macosx
│   └── libnative_synchronization.jnilib
└── win32
    ├── x86
    │   └── native_synchronization.dll
    └── x86_64
        └── native_synchronization.dll
</pre></div>


<p>Create a jar that contains these native libraries. The <b>-C</b> options prevents the <b>native</b> folder from being created in the JAR file.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; title: ; notranslate">
jar cMf my-project-native.jar -C native .
</pre></div>


<h2 class="wp-block-heading">Pushing JAR to Nexus</h2>



<p>When pushing this native JAR file to Nexus, make sure to use the <b>natives-*</b> classifier. In this example, I called it <b>natives-all</b>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [5]; title: ; notranslate">
&lt;dependency&gt;
	&lt;groupid&gt;my.project&lt;/groupid&gt;
	&lt;artifactid&gt;native&lt;/artifactid&gt;
	&lt;version&gt;1.0&lt;/version&gt;
	&lt;classifier&gt;natives-all&lt;/classifier&gt;
&lt;/dependency&gt;
</pre></div>


<h2 class="wp-block-heading">Configuring pom.xml</h2>



<p>First, add LWJGL and the native JAR dependencies.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;dependencies&gt;
    &lt;dependency&gt;
        &lt;groupid&gt;org.lwjgl.lwjgl&lt;/groupid&gt;
        &lt;artifactid&gt;lwjgl&lt;/artifactid&gt;
        &lt;version&gt;2.9.3&lt;/version&gt;
    &lt;/dependency&gt;
    &lt;dependency&gt;
		&lt;groupid&gt;my.project&lt;/groupid&gt;
		&lt;artifactid&gt;native&lt;/artifactid&gt;
		&lt;version&gt;1.0&lt;/version&gt;
		&lt;classifier&gt;natives-all&lt;/classifier&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;
</pre></div>


<p>Then, add the following plugin:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;build&gt;
    &lt;plugins&gt;
		&lt;plugin&gt;
		    &lt;groupid&gt;com.googlecode.mavennatives&lt;/groupid&gt;
		    &lt;artifactid&gt;maven-nativedependencies-plugin&lt;/artifactid&gt;
		    &lt;version&gt;0.0.7&lt;/version&gt;
		    &lt;executions&gt;
		        &lt;execution&gt;
		            &lt;id&gt;unpacknatives&lt;/id&gt;
		            &lt;phase&gt;generate-resources&lt;/phase&gt;
		            &lt;goals&gt;
		                &lt;goal&gt;copy&lt;/goal&gt;
		            &lt;/goals&gt;
		        &lt;/execution&gt;
		    &lt;/executions&gt;
		&lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</pre></div>


<p>This plugin searches for dependencies with <b>natives-*</b> classifier and unpacks the content to <b>target/natives</b> folder.</p>



<h2 class="wp-block-heading">Testing</h2>



<p>Run <b>mvn clean package</b>.</p>



<p>Inspect <b>target/natives</b>. The native libraries should be unpacked here:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [19,20,21,22,23,26,27,29,30,31,32,33]; title: ; notranslate">
target/natives
├── META-INF
│   └── MANIFEST.MF
├── OpenAL32.dll
├── OpenAL64.dll
├── jinput-dx8.dll
├── jinput-dx8_64.dll
├── jinput-raw.dll
├── jinput-raw_64.dll
├── jinput-wintab.dll
├── libjinput-linux.so
├── libjinput-linux64.so
├── libjinput-osx.jnilib
├── liblwjgl.dylib
├── liblwjgl.so
├── liblwjgl64.so
├── libopenal.so
├── libopenal64.so
├── linux
│   ├── x86
│   │   └── libnative_synchronization.so
│   └── x86_64
│       └── libnative_synchronization.so
├── lwjgl.dll
├── lwjgl64.dll
├── macosx
│   └── libnative_synchronization.jnilib
├── openal.dylib
└── win32
    ├── x86
    │   └── native_synchronization.dll
    └── x86_64
        └── native_synchronization.dll
</pre></div><p>The post <a rel="nofollow" href="https://myshittycode.com/2015/11/09/maven-bundling-and-unpacking-native-libraries/">Maven: Bundling and Unpacking Native Libraries</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2015/11/09/maven-bundling-and-unpacking-native-libraries/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">854</post-id>	</item>
		<item>
		<title>Maven Archetype Plugin: Velocity Variable Substitutions Not Resolving</title>
		<link>https://myshittycode.com/2015/08/05/maven-archetype-plugin-velocity-variable-substitutions-not-resolving/</link>
					<comments>https://myshittycode.com/2015/08/05/maven-archetype-plugin-velocity-variable-substitutions-not-resolving/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Wed, 05 Aug 2015 16:38:06 +0000</pubDate>
				<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Archetype Plugin]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=794</guid>

					<description><![CDATA[<p>PROBLEM Let&#8217;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&#8217;t resolve at all. SOLUTION After reading Maven Archetype Plugin&#8217;s source code here and here, the Velocity variable substitutions are only performed on the following file extensions:- In another word, if [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/08/05/maven-archetype-plugin-velocity-variable-substitutions-not-resolving/">Maven Archetype Plugin: Velocity Variable Substitutions Not Resolving</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>Let&#8217;s assume we have the following <code>package.json</code> in our archetype:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: jscript; title: ; notranslate">
{
  &quot;name&quot;: &quot;${rootArtifactId}&quot;,
  &quot;private&quot;: true,
  &quot;devDependencies&quot;: {
    ...
  }
}
</pre></div>


<p>When creating a project from this archetype, the Velocity variable substitution for <code>${rootArtifactId}</code> doesn&#8217;t resolve at all.</p>



<h2 class="wp-block-heading">SOLUTION</h2>



<p>After reading Maven Archetype Plugin&#8217;s source code <a href="http://maven.apache.org/archetype/maven-archetype-plugin/xref/org/apache/maven/archetype/mojos/CreateArchetypeFromProjectMojo.html" target="_blank" rel="noopener">here</a> and <a href="http://maven.apache.org/archetype/archetype-common/xref/org/apache/maven/archetype/common/Constants.html#L25" target="_blank" rel="noopener">here</a>, the Velocity variable substitutions are only performed on the following file extensions:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; title: ; notranslate">
List&lt;String&gt; DEFAULT_FILTERED_EXTENSIONS =
    Arrays.asList(
        new String&#x5B;]
            {
                &quot;java&quot;, &quot;xml&quot;, &quot;txt&quot;, &quot;groovy&quot;, &quot;cs&quot;, &quot;mdo&quot;, &quot;aj&quot;, &quot;jsp&quot;, &quot;gsp&quot;,
                &quot;vm&quot;, &quot;html&quot;, &quot;xhtml&quot;, &quot;properties&quot;, &quot;.classpath&quot;, &quot;.project&quot;
            }
    );
</pre></div>


<p>In another word, if we have these variables in JSON or JavaScript files, they will not resolved at all.</p>



<p>To fix this, define the needed file extensions in Maven Archetype Plugin configuration:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-archetype-plugin&lt;/artifactId&gt;
    &lt;version&gt;2.3&lt;/version&gt;
    &lt;configuration&gt;
        &lt;archetypeFilteredExtentions&gt;js,json,md,java,xml,txt,groovy,jsp,vm,html,properties&lt;/archetypeFilteredExtentions&gt;
    &lt;/configuration&gt;
&lt;/plugin&gt;
</pre></div><p>The post <a rel="nofollow" href="https://myshittycode.com/2015/08/05/maven-archetype-plugin-velocity-variable-substitutions-not-resolving/">Maven Archetype Plugin: Velocity Variable Substitutions Not Resolving</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2015/08/05/maven-archetype-plugin-velocity-variable-substitutions-not-resolving/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">794</post-id>	</item>
		<item>
		<title>Maven Archetype Plugin: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project</title>
		<link>https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/</link>
					<comments>https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Wed, 05 Aug 2015 12:50:40 +0000</pubDate>
				<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Maven Archetype Plugin]]></category>
		<category><![CDATA[Maven EAR Plugin]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=790</guid>

					<description><![CDATA[<p>PROBLEM When running mvn archetype:create-from-project with Maven Ear Plugin defined under &#60;pluginManagement&#62;&#8230;. &#8230; the following exception occurs&#8230; 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 &#60;modules&#62; under &#60;configuration&#62; to prevent NullPointerException.</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/">Maven Archetype Plugin: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>When running <code>mvn archetype:create-from-project</code> with Maven Ear Plugin defined under <code>&lt;pluginManagement&gt;</code>&#8230;.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; title: ; notranslate">
&lt;project ...&gt;
    ...
    &lt;build&gt;
        &lt;pluginManagement&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-archetype-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.3&lt;/version&gt;
                &lt;/plugin&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-ear-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.10.1&lt;/version&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;
&lt;/project&gt;
</pre></div>


<p>&#8230; the following exception occurs&#8230;</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&#x5B;ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project (default-cli) on project myproject-webapp: null: MojoFailureException -&amp;amp;gt; &#x5B;Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project (default-cli) on project myproject-webapp: null
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException
        at org.apache.maven.archetype.mojos.CreateArchetypeFromProjectMojo.execute(CreateArchetypeFromProjectMojo.java:258)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 19 more
</pre></div>


<h2 class="wp-block-heading">SOLUTION</h2>



<p>It appears this problem happens when using Maven Archetype Plugin 2.3, but works fine when using 2.2.</p>



<p>To fix this, define an empty <code>&lt;modules&gt;</code> under <code>&lt;configuration&gt;</code> to prevent <code>NullPointerException</code>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [15,16,17]; title: ; notranslate">
&lt;project ...&gt;
    ...
    &lt;build&gt;
        &lt;pluginManagement&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-archetype-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.3&lt;/version&gt;
                &lt;/plugin&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                    &lt;artifactId&gt;maven-ear-plugin&lt;/artifactId&gt;
                    &lt;version&gt;2.10.1&lt;/version&gt;
                    &lt;configuration&gt;
                        &lt;modules/&gt;
                    &lt;/configuration&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/pluginManagement&gt;
    &lt;/build&gt;
&lt;/project&gt;
</pre></div><p>The post <a rel="nofollow" href="https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/">Maven Archetype Plugin: Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.3:create-from-project</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2015/08/05/maven-archetype-plugin-failed-to-execute-goal-org-apache-maven-pluginsmaven-archetype-plugin2-3create-from-project/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">790</post-id>	</item>
		<item>
		<title>Maven: Skinning Generated Site</title>
		<link>https://myshittycode.com/2015/07/23/maven-skinning-generated-site/</link>
					<comments>https://myshittycode.com/2015/07/23/maven-skinning-generated-site/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Thu, 23 Jul 2015 18:27:13 +0000</pubDate>
				<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Maven]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=784</guid>

					<description><![CDATA[<p>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, [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/07/23/maven-skinning-generated-site/">Maven: Skinning Generated Site</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>The default Maven generated site looks like web pages created in the 80s:-</p>



<figure class="wp-block-image aligncenter"><img fetchpriority="high" decoding="async" width="1134" height="565" src="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-11-26-pm-1.png?x45560" alt="" class="wp-image-785" srcset="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-11-26-pm-1.png 1134w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-11-26-pm-1-300x149.png 300w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-11-26-pm-1-1024x510.png 1024w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-11-26-pm-1-768x383.png 768w" sizes="(max-width: 1134px) 100vw, 1134px" /></figure>



<h2 class="wp-block-heading">SOLUTION</h2>



<p>The good news is Maven allows us to <a href="https://maven.apache.org/skins/" target="_blank" rel="noopener">change the skin</a>.</p>



<p>To use one of these pre-defined skins, create <code>site.xml</code> at this location:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [8]; title: ; notranslate">
├── pom.xml
└── src
   ├── main
   │  └── java
   │      └── ...
   └── site
      └── site.xml
</pre></div>


<p>In <code>site.xml</code>, enter the following:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [16,17,18,19,20]; title: ; notranslate">
&lt;project xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;
         xmlns=&quot;http://maven.apache.org/DECORATION/1.6.0&quot;
         xsi:schemaLocation=&quot;http://maven.apache.org/DECORATION/1.6.0
         http://maven.apache.org/xsd/decoration-1.6.0.xsd&quot;&gt;
    &lt;bannerLeft&gt;
        &lt;name&gt;${project.name}&lt;/name&gt;
        &lt;href&gt;${project.url}&lt;/href&gt;
    &lt;/bannerLeft&gt;

    &lt;publishDate position=&quot;right&quot; format=&quot;MMMM dd, yyyy&quot;/&gt;
    &lt;version/&gt;
    &lt;poweredBy&gt;
        &lt;logo img=&quot;#&quot; alt=&quot;&quot;/&gt;
    &lt;/poweredBy&gt;

    &lt;skin&gt;
        &lt;groupId&gt;org.apache.maven.skins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-fluido-skin&lt;/artifactId&gt;
        &lt;version&gt;1.4&lt;/version&gt;
    &lt;/skin&gt;

    &lt;body&gt;
        &lt;menu ref=&quot;reports&quot;/&gt;
        &lt;footer/&gt;
    &lt;/body&gt;
&lt;/project&gt;
</pre></div>


<p>In the above example, we use Maven Fluido Skin.</p>



<p>In Maven 3, <code>site:attach-descriptor</code> has been removed from the built-in lifecycle bindings, so we need to explicitly define <code>attach-descriptor</code> goal in Maven Site Plugin to pick up <code>src/site/site.xml</code>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [6,7,8,9,10,11]; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
    &lt;version&gt;3.4&lt;/version&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;id&gt;attach-descriptor&lt;/id&gt;
            &lt;goals&gt;
                &lt;goal&gt;attach-descriptor&lt;/goal&gt;
            &lt;/goals&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</pre></div>


<p>When you run <code>mvn clean site</code>, oh hey, welcome to 21st century!</p>



<figure class="wp-block-image aligncenter"><img decoding="async" width="1124" height="597" src="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-08-50-pm-1.png?x45560" alt="" class="wp-image-787" srcset="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-08-50-pm-1.png 1124w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-08-50-pm-1-300x159.png 300w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-08-50-pm-1-1024x544.png 1024w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-23-at-1-08-50-pm-1-768x408.png 768w" sizes="(max-width: 1124px) 100vw, 1124px" /></figure>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/07/23/maven-skinning-generated-site/">Maven: Skinning Generated Site</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2015/07/23/maven-skinning-generated-site/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">784</post-id>	</item>
		<item>
		<title>JaCoCo Web Report Not Rendering Properly in GitHub Pages</title>
		<link>https://myshittycode.com/2015/07/22/jacoco-web-report-not-rendering-properly-in-github-pages/</link>
					<comments>https://myshittycode.com/2015/07/22/jacoco-web-report-not-rendering-properly-in-github-pages/#respond</comments>
		
		<dc:creator><![CDATA[Shitty Author]]></dc:creator>
		<pubDate>Wed, 22 Jul 2015 23:08:30 +0000</pubDate>
				<category><![CDATA[Development Tools]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[JaCoCo Maven Plugin]]></category>
		<category><![CDATA[Maven]]></category>
		<guid isPermaLink="false">http://myshittycode.com/?p=767</guid>

					<description><![CDATA[<p>PROBLEM When pushing JaCoCo web report to GitHub&#8217;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 [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/07/22/jacoco-web-report-not-rendering-properly-in-github-pages/">JaCoCo Web Report Not Rendering Properly in GitHub Pages</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">PROBLEM</h2>



<p>When pushing JaCoCo web report to GitHub&#8217;s gh-pages branch, it does not render properly on the web. For example:-</p>



<figure class="wp-block-image aligncenter"><img decoding="async" width="2194" height="468" src="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1.png?x45560" alt="" class="wp-image-769" srcset="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1.png 2194w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1-300x64.png 300w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1-1024x218.png 1024w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1-768x164.png 768w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1-1536x328.png 1536w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-4-34-15-pm-1-2048x437.png 2048w" sizes="(max-width: 2194px) 100vw, 2194px" /></figure>



<p>The GitHub pages are powered by <a href="http://jekyllrb.com/docs/github-pages/" target="_blank" rel="noopener">Jekyll</a>. By default, Jekyll does not allow directories or files that begin with a dot, pound sign, tilde or underscore.</p>



<p>Since JaCoCo places all the image and CSS files in a directory called <b>.resources</b>, this directory will not be pushed to GitHub&#8217;s gh-pages branch.</p>



<h2 class="wp-block-heading">SOLUTION UPDATE: 2015-07-23</h2>



<p><a href="https://github.github.com/maven-plugins/site-plugin/site-mojo.html" target="_blank" rel="noopener">GitHub Site Plugin</a> has a <b>noJekyll</b> parameter that will create the <b>.nojekyll</b> file at the root path if it is set to <b>true</b>.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: xml; highlight: [8]; title: ; notranslate">
&lt;plugin&gt;
    &lt;groupid&gt;com.github.github&lt;/groupid&gt;
    &lt;artifactid&gt;site-maven-plugin&lt;/artifactid&gt;
    &lt;version&gt;${site-maven-plugin.version}&lt;/version&gt;
    &lt;configuration&gt;
        &lt;message&gt;Creating site for ${project.version}&lt;/message&gt;
        &lt;server&gt;github&lt;/server&gt;
        &lt;nojekyll&gt;true&lt;/nojekyll&gt;
    &lt;/configuration&gt;
    &lt;executions&gt;
        &lt;execution&gt;
            &lt;goals&gt;
                &lt;goal&gt;site&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;phase&gt;site&lt;/phase&gt;
        &lt;/execution&gt;
    &lt;/executions&gt;
&lt;/plugin&gt;
</pre></div>


<h2 class="wp-block-heading">SOLUTION 1: Disable Jekyll</h2>



<p>One simple fix is to completely disable Jekyll by creating an empty file called <b>.nojekyll</b> at this location:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [7,8,9]; title: ; notranslate">
myproject
├── pom.xml
├── src
│   ├── main
│   │   └── java
│   │       └── ...
│   ├── site
│   │   └── resources
│   │       └── .nojekyll
</pre></div>


<h2 class="wp-block-heading">SOLUTION 2: Configure Jekyll</h2>



<p>While disabling Jekyll works, it may 1) seem rather risky since there maybe other hidden directories/files and 2) possibly send too much garbage to GitHub&#8217;s gh-pages branch.</p>



<p>To fix this, we will instruct Jekyll to allow JaCoCo&#8217;s <b>.resources</b> directory through by creating a file called <b>_config.yml</b> at this location:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; highlight: [7,8,9]; title: ; notranslate">
myproject
├── pom.xml
├── src
│   ├── main
│   │   └── java
│   │       └── ...
│   ├── site
│   │   └── resources
│   │       └── _config.yml
</pre></div>


<p>In <b>_config.yml</b>, enter the following:-</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: ruby; title: ; notranslate">
# Allow JaCoCo&#039;s directory to bypass GitHub&#039;s Jekyll-powered pages
# so that the web report renders properly
include: &#x5B;&#039;.resources&#039;]
</pre></div>


<h2 class="wp-block-heading">OUTCOME</h2>



<p>Either solution will produce a nicely rendered JaCoCo web report in GitHub pages.</p>



<figure class="wp-block-image aligncenter"><img loading="lazy" decoding="async" width="2496" height="324" src="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1.png?x45560" alt="" class="wp-image-770" srcset="https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1.png 2496w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1-300x39.png 300w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1-1024x133.png 1024w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1-768x100.png 768w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1-1536x199.png 1536w, https://myshittycode.com/wp-content/uploads/2015/07/screen-shot-2015-07-22-at-5-16-18-pm-1-2048x266.png 2048w" sizes="auto, (max-width: 2496px) 100vw, 2496px" /></figure>
<p>The post <a rel="nofollow" href="https://myshittycode.com/2015/07/22/jacoco-web-report-not-rendering-properly-in-github-pages/">JaCoCo Web Report Not Rendering Properly in GitHub Pages</a> appeared first on <a rel="nofollow" href="https://myshittycode.com">My Shitty Code</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://myshittycode.com/2015/07/22/jacoco-web-report-not-rendering-properly-in-github-pages/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">767</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Page Caching using Disk: Enhanced 
Lazy Loading (feed)
Database Caching 9/75 queries in 0.042 seconds using Disk

Served from: myshittycode.com @ 2026-02-20 03:05:22 by W3 Total Cache
-->