How do I make this simple project work using maven?

I am trying tof figure out how to distribute a simple Hello World app as a jar file using maven.  Project code is a s follows:

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

import javax.swing.*;

* Created by Ian on 5/3/14.
public class HelloWorlds {
    private JPanel panel1;
    private JButton clickMeButton;
    boolean toggle = false;

    public static void main(String[] args) {
        JFrame frame = new JFrame("HelloWorlds");
        frame.setContentPane(new HelloWorlds().panel1);

// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<

     * Method generated by IntelliJ IDEA GUI Designer
     * >>> IMPORTANT!! <<<
     * DO NOT edit this method OR call it in your code!
     * @noinspection ALL
    private void $$$setupUI$$$() {
        panel1 = new JPanel();
        panel1.setLayout(new FormLayout("fill:d:grow", "center:d:noGrow,top:3dlu:noGrow,center:max(d;4px):noGrow"));
        final JLabel label1 = new JLabel();
        label1.setText("Hello Worlds");
        CellConstraints cc = new CellConstraints();
        panel1.add(label1, cc.xy(1, 1, CellConstraints.CENTER, CellConstraints.DEFAULT));
        clickMeButton = new JButton();
        clickMeButton.setText("Click Me");
        panel1.add(clickMeButton, cc.xy(1, 3));

     * @noinspection ALL
    public JComponent $$$getRootComponent$$$() {
        return panel1;

POM file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=""




I keep getting the following error

Ian42: ~ >:java -jar HelloWorld-1.0-SNAPSHOT.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/jgoodies/forms/layout/FormLayout
 at HelloWorlds.$$$setupUI$$$(
 at HelloWorlds.<init>(
 at HelloWorlds.main(
Caused by: java.lang.ClassNotFoundException: com.jgoodies.forms.layout.FormLayout
 at Method)
 at java.lang.ClassLoader.loadClass(
 at sun.misc.Launcher$AppClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 ... 3 more

Ian42: ~ >:

Any help would be appreciated!
1 comment

You need to tell maven jar plugin to add your project classpath to the manifest as described here:

PS Your problem is not really related to any kind of IDE (including IntelliJ IDEA of course) and I think it is better to post this kind of questions on websites like


Please sign in to leave a comment.