0

I have a Netbeans 8.0.2 Java project using Maven. I wish to produce a JAR with all dependencies included. I have seen similar questions but none of which seem to have a the solution that said I am new to it.

This is what i have added to the pom.xml (excluding dependencies etc.) from what I have read online but still no luck.

<properties>
     <mainClass>com.oss.nia.startup</mainClass>
</properties>

<build>
    <plugins>
<plugin>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <phase>install</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/lib</outputDirectory>
            </configuration>
        </execution>
    </executions>
</plugin>
<plugin>
    <artifactId>maven-jar-plugin</artifactId>
    <configuration>
        <archive>
            <manifest>
                <addClasspath>true</addClasspath>
                <classpathPrefix>lib/</classpathPrefix>
                <mainClass>${mainClass}</mainClass>
            </manifest>
        </archive>
    </configuration>
</plugin>
    </plugins>
</build>
DevilCode
  • 1,054
  • 3
  • 35
  • 61
  • 1
    Possible duplicate of [Building a fat jar using maven](http://stackoverflow.com/questions/16222748/building-a-fat-jar-using-maven) – Tunaki Mar 02 '16 at 11:41
  • You could use Spring-Boot, which handles that for you http://stackoverflow.com/a/27185508/1329813 – Ben Mar 05 '16 at 14:20

0 Answers0