0
我在Maven項目工作裏面我是用一個自定義的jar文件編譯使用的jar文件,我包括在pom.xml中作爲Maven的:從系統
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-migrations</artifactId>
<scope>system</scope>
<version>0.7.0</version>
<systemPath>${basedir}/dropwizard-migrations-0.7.0.jar</systemPath>
</dependency>
但mvn package
後和編譯我越來越NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError: io/dropwizard/migrations/MigrationsBundle
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at in.myGroupID.Artifact.game.myApplication.initialize(myApplication.java:48)
at io.dropwizard.Application.run(Application.java:70)
at in.myGroupID.Artifact.game.myApplication.main(myApplication.java:44)
Caused by: java.lang.ClassNotFoundException: io.dropwizard.migrations.MigrationsBundle
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 15 more
[this]的可能重複(http://stackoverflow.com/questions/5692256/maven-best-way-of-linking-custom-external-jar-to-my-project)。 並查看[this](http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/)以及在本地資源庫中安裝jar。 –