How to Package Maven Project as JAR with Dependencies - OSUCartography/MapComposer GitHub Wiki

In your pom.xml file, within the build > plugins > plugin node, add the following xml:

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>edu.oregonstate.carto.mapcomposer.server.Main</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>

In <mainClass>, you specify the main class you want executed when you execute the JAR file.

Then, right click your project and select Custom > Goals....

Type the following and then click OK:

clean package assembly:single

clean package assembly:single

Now, the jar with the necessary dependencies will be located in your target directory.

⚠️ **GitHub.com Fallback** ⚠️