1

New to Maven projects and having some trouble here. Right now I've for a pom.xml with a few external dependencies included, and they all seem to be included in compilation when I run mvn package just fine. I'm trying to create an executable jar that I can call to run a specific Java class' main function, so my plugins section looks like

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>java/</classpathPrefix>
                        <mainClass>example.path.here.MainClass</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
    </plugins>
</build>

Once I try to execute that jar, however, I get a NoClassDefFound error on classes imported in the java file that were included in the dependencies. Any idea what I'm missing here?

Note that I'm just trying to run this from the command line

0 Answers0