Run Maven Project from CLI

This is just a quick not on how to run a maven project from the CLI – command line interface.

  1. cd into the root directory of the project.
  2. Run mvn compile.
  3. Then, to execute a class with a main method (usually the Application class) execute the following Maven command:
mvn exec:java -Dexec.mainClass=[your class here]

For example, let’s say you have a class with a main method in called Application, and that class is in a package named com.myname.myproject. Then the command to execute the main method would be:

mvn exec:java -Dexec.mainClass=com.myname.myproject.Application
Ubuntu Logo

Ubuntu System Services

This post about systemd has been published from a draft, so it’s not been proofed for publication. I find it useful, so I would like it readily available on-line. If you find anything wrong with it, please

Ubuntu, like many GNU/Linux distributions, uses systemd. systemd is a system used by the OS tor manage process, known as services. We can add our own services to systemd, and I’ll show how to do that in this post.

Services are useful, for example, if you start and run server. If we start that server as a user, the process running the server will be killed when the user logs out. If we want the server to run continuously – which is usually the case with servers – this is a problem.

We can be keep the service running by abandoning the process before logout, but it’s a hassle. In this set up, we would need to login, start the server, then abandoning processes. Instead, we can use systemd services and have the server started automatically (or on demand) and it runs in the background.

Systemd Unit Files

Our unit files go in the Systemd system directory.


Each service should have a name of the following form:


Here’s an example of the format of the file.

Description=My Node.js Service


# Note: Debian/Ubuntu uses 'nogroup', RHEL/Fedora uses 'nobody'.
# Note: when 'ExecStart' is used, 'Type' defaults to 'simple'.



For more information on Service files, see the man page.

man systemd.service

Update Systemd Services

 sudo systemctl daemon-reload 
sudo systemctl enable my-webapp.service

Created symlink /etc/systemd/system/ → /etc/systemd/system/event-tracker-api.service.

sudo systemctl start my-webapp
sudo systemctl stop my-app
sudo systemctl status my-webapp


sudo service [name] {start,stop,restart,status}
Maven Logo

Maven: Setting Compiler Version

I recently started a new JavaFX project. I decided to use Maven because the tool is great for building Java projects in a standard way that conforms with best practices. Unfortunately, I’m not the most well versed in the tool. I’ve used it a few times, and “it just worked”.

This evening I got the following errors when attempting to compile my project:

Source option 5 is no longer supported. Use 7 or later.
Target option 5 is no longer supported. Use 7 or later.

I didn’t know what it meant, so I went to the Web. A search result later, I learned this had to do with the compiler. So I added the following directive to my pom.xml file.


I’m using openjdk-13, so I told Maven that my source code (compiler.source) would be written in Java 13; and that my output code ( should run on the Java 13 JVM.

If we were to compile directly on the command line, we could use -source and -target flags reach the same end, but I believe Maven leverages a object that enables invocation of the Java compiler from within programs. From what I can tell, it’s the Maven Compiler Plugin which uses such an object – hence, the maven.compiler.* directives.

Mounting Windows File Shares in Docker

A network graph on top of an image of shipping containers

I recently had the need to mount a Windows network file share location within a Docker container. Thus, I tested the mounting of the share on my local machine. It worked, so I figured I’d simply set up the container to mimic the steps I took to mount the share on the host machine. Unfortunately, it wasn’t as straightforward as that. However, I was able to achieve the mount, and this post explains the steps I took to achieve the mount.

Continue reading

Redirect Apache Requests to Applications

When requests come into the Apache Web server, they are routed by default to the files in the Document Root. Sometimes we want to redirect those requests elsewhere. We can do this with the Rewrite module.

Add the Rewrite directives to the Apache config file, an .htaccess file, or do what I usually do and add it to the Virtual Host file.

Rewrite for SPAs

To direct requests to Single Page Web-apps, such as those that are build with React and Vue.js. This is what works for me.

<Directory "/var/www/my-app/dist">
Options Indexes FollowSymLinks
order allow,deny
allow from all

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*) /index.html [NC,L]

PHP Applications

Often when using Apache to host a PHP Web application, it’s desirable to handle incoming requests with PHP. By default, Apache will try to handle requests. But, we can use the rewrite module to send requests to specified PHP scripts.

<Directory "/path/to/webroot">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /index.php?/$1 [L]