如何启动本地库的annotationProcessing(kapt)? [英] How start annotationProcessing (kapt) for local library?

查看:56
本文介绍了如何启动本地库的annotationProcessing(kapt)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了用于注释处理的小型库.使用Gradle将其编译为jar文件,然后添加到android项目中.在build.gradle应用程序lvl中,我添加了:

I write small library for annotation processing. Compile it to jar file with Gradle and add to android project. In build.gradle app lvl i added:

dependencies {

  //...
    compile files('/Users/I/Documents/Projects/my/test2/build/libs/codelib-0.3.jar')
}

android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true

但是如果我构建项目,则不会生成Java类.在另一个Java项目(不是android!)中,所有完美的作品(对于构建,我使用命令 gradle assemble )和文件都会创建.对于在另一个依赖项(匕首,滑行)中的注解处理,我使用"kotlin-kapt",他在那里工作得很好,但他显然不是本地人.

But if i build the project java classes not genered. In another java project (not android!) all perfect works (for build i use command gradle assemble) and files creates. For annotationProcessing in another dependencies (dagger, glide) i use 'kotlin-kapt' and he works fine for there, but he not local obviously.

推荐答案

Kapt对其注释处理器使用单独的配置,即 kapt .您还需要将JAR添加到该配置中:

Kapt uses a separate configuration for its annotation processors, namely kapt. You need to add your JAR to that configuration as well:

dependencies {
     // ...

     kapt files('/Users/I/Documents/Projects/my/test2/build/libs/codelib-0.3.jar')
}

这篇关于如何启动本地库的annotationProcessing(kapt)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆