Skip to content

Commit

Permalink
Update example and rewrite blog post
Browse files Browse the repository at this point in the history
  • Loading branch information
pkainulainen committed Nov 23, 2014
1 parent 51d4110 commit 13f4de3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
10 changes: 0 additions & 10 deletions assembly-plugin/README

This file was deleted.

9 changes: 9 additions & 0 deletions assembly-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
This an example application of my blog entry:

* [Creating a Runnable Binary Distribution With Maven Assembly Plugin](http://www.petrikainulainen.net/programming/tips-and-tricks/creating-a-runnable-binary-distribution-with-maven-assembly-plugin/)

You can create the binary distribution by running one of the following command at command prompt:

mvn package assembly:single

mvn assembly:assembly (invokes the package phase)
31 changes: 17 additions & 14 deletions assembly-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,42 @@
<build>
<finalName>maven-assembly-plugin</finalName>
<plugins>
<!-- The configuration of maven-assembly-plugin -->
<!--
The configuration of the Maven Assembly plugin that assembles the
binary distribution of our example application.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.2</version>
<!-- The configuration of the plugin -->
<version>2.5.1</version>
<configuration>
<!-- Specifies the configuration file of the assembly plugin -->
<!-- Configures the used assembly descriptor -->
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<!-- The configuration of maven-jar-plugin -->
<!--
The configuration of Maven Jar plugin that packages our application
into a jar file.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<!-- The configuration of the plugin -->
<version>2.5</version>
<configuration>
<!-- Configuration of the archiver -->
<!-- Configures the created archive -->
<archive>
<!-- Manifest specific configuration -->
<!-- Configures the content of the created manifest -->
<manifest>
<!-- Classpath is added to the manifest of the created jar file. -->
<!-- Adds the classpath to the created manifest -->
<addClasspath>true</addClasspath>
<!--
Configures the classpath prefix. This configuration option is
used to specify that all needed libraries are found under lib/
directory.
Specifies that all dependencies of our application are found
from the lib directory.
-->
<classpathPrefix>lib/</classpathPrefix>
<!-- Specifies the main class of the application -->
<!-- Configures the main class of the application -->
<mainClass>net.petrikainulainen.mavenassemblyplugin.HelloWorldApp</mainClass>
</manifest>
</archive>
Expand Down
12 changes: 7 additions & 5 deletions assembly-plugin/src/main/assembly/assembly.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<assembly>
<id>bin</id>
<!-- Generates a zip package containing the needed files -->
<!-- Specifies that our binary distribution is a zip package -->
<formats>
<format>zip</format>
</formats>

<!-- Adds dependencies to zip package under lib directory -->
<!-- Adds the dependencies of our application to the lib directory -->
<dependencySets>
<dependencySet>
<!--
Expand All @@ -21,8 +21,7 @@
<fileSets>
<!--
Adds startup scripts to the root directory of zip package. The startup
scripts are located to src/main/scripts directory as stated by Maven
conventions.
scripts are from the src/main/scripts directory.
-->
<fileSet>
<directory>${project.build.scriptSourceDirectory}</directory>
Expand All @@ -31,7 +30,10 @@
<include>startup.*</include>
</includes>
</fileSet>
<!-- adds jar package to the root directory of zip package -->
<!--
Adds the jar file of our example application to the root directory
of the created zip package.
-->
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory></outputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
*/
public class HelloWorldApp
{
private static Logger logger = Logger.getLogger(HelloWorldApp.class);
private static Logger LOGGER = Logger.getLogger(HelloWorldApp.class);

public static void main( String[] args )
{
logger.info( "Hello World!" );
LOGGER.info("Hello World!");
}
}

0 comments on commit 13f4de3

Please sign in to comment.