java - Gradle and Maven compile my project but I am getting NoClassFoundError -
i trying compile project uses gradle , maven. project use library on local maven repository. library referenced in gradle , maven:
gradle:
dependencies{ compile 'cf.charly1811.java.utils:mimetype:1.0' }
maven:
<!-- dependencies --> <dependencies> <dependency> <groupid>cf.charly1811.java.utils</groupid> <artifactid>mimetype</artifactid> <version>1.0</version> </dependency> </dependencies>
when try compile project using mvn clean package
or gradle clean jar
success. error arises when mimetype class called:
exception in thread "thread-4" java.lang.noclassdeffounderror: cf/charly1811/java/utils/mimetype @ cf.charly1811.java.web.requesthandlerthread.process(requesthandlerthread.java:120) @ cf.charly1811.java.web.requesthandlerthread.handlerequest(requesthandlerthread.java:85) @ cf.charly1811.java.web.requesthandlerthread.run(requesthandlerthread.java:64) caused by: java.lang.classnotfoundexception: cf.charly1811.java.utils.mimetype @ java.net.urlclassloader$1.run(unknown source) @ java.net.urlclassloader$1.run(unknown source) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(unknown source) @ java.lang.classloader.loadclass(unknown source) @ sun.misc.launcher$appclassloader.loadclass(unknown source) @ java.lang.classloader.loadclass(unknown source) ... 3 more
i don't know causing error... please help.
edit: mimetype pom.xml:
<project> <modelversion>4.0.0</modelversion> <name>mimetype</name> <description>library type of file</description> <groupid>cf.charly1811.java.utils</groupid> <artifactid>mimetype</artifactid> <version>1.0</version> <licenses> <license> <name>apache license, version 2.0</name> <url>http://www.apache.org/licenses/license-2.0.txt</url> <distribution>repo</distribution> <comments>a business-friendly oss license</comments> </license> </licenses> </project>
httpserver (main project) pom.xml
<project> <modelversion>4.0.0</modelversion> <name>httpserver</name> <description>a simple http server written in java</description> <groupid>cf.charly1811.java.web</groupid> <artifactid>httpserver</artifactid> <version>1.0</version> <!-- dependencies --> <dependencies> <dependency> <groupid>cf.charly1811.java.utils</groupid> <artifactid>mimetype</artifactid> <version>1.0</version> </dependency> </dependencies> <!-- license --> <licenses> <license> <name>private use</name> <url>http://choosealicense.com/licenses/no-license/</url> <comments>this software private use only</comments> </license> </licenses> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-jar-plugin</artifactid> <configuration> <archive> <manifest> <addclasspath>true</addclasspath> <mainclass>cf.charly1811.java.main</mainclass> </manifest> </archive> </configuration> </plugin> </plugins> </build> </project>
edit forgot clarify 1 thing: use intellij idea. when try compile project using "run" compile , don't error. happen when use gradle or maven compile project
try mvn clean install
try compile classes , try save generated jar of project in local repository if problem occurs should able resolve otherwise post see
Comments
Post a Comment