GreenDao freemaker.jar is missing

蹲街弑〆低调 提交于 2019-12-21 08:24:38

问题


I just downloaded the new jar file for GreenDao in order to create my DB for the app I'm building.

After going through all the process of modeling my entities and the connections between them, I tried to run the generator project but got this error for the line that generated the DB:

Exception in thread "main" java.lang.NoClassDefFoundError: freemarker/template/ObjectWrapper
    at com.glide.talk.glide.model.generator.Model.main(Model.java:29)
Caused by: java.lang.ClassNotFoundException: freemarker.template.ObjectWrapper
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    ... 1 more

The line this happened in is: new DaoGenerator().generateAll(schema, src); and I have in the buildpath and in the lib folder only the greendao-generator-1.3.0.jar file.

Any thoughts or solutions will be very helpful.

p.s. is it ok to use the freemaker.jar that was in version 1.2?

EDIT: for now, I downloaded this version from sourceforge and am hoping this is actually what I need to use.


回答1:


I had a similar problem and downloaded the jar from http://mvnrepository.com/artifact/org.freemarker/freemarker which worked out well.

When you take a look at build.gradle in the DaoGenerator-project, you'll find a dependency that points exactly to this artifact. I guess using gradle to build your project automatically downloads these dependencies just like maven does. If you do not wish to use either, it's probably fine to download and include the artifacts manually.




回答2:


I had the same error but i was trying to compile the greendao-generator at my main project, but you must create a java module for greenDao then it will not ask for the freemarker.

use greendao-generator inside the java module and greendao inside main project

you may follow this tutorial GreenDao and Android Studio tutorial



来源:https://stackoverflow.com/questions/16634219/greendao-freemaker-jar-is-missing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!