Official documentation instructs how to use kapt from Gradle and Maven. But how can I use kapt from command line, with kotlinc?
How to use kapt from command line (with kotlinc)?
1.6k views Asked by cubuspl42 At
1
There are 1 answers
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in SHELL
- passing text with \n as one argument in shell
- Delete the extra space after special character in all the lines of text file
- Calling a python function with options from shell script
- bc: prevent "divide by zero" runtime error on multiple operations
- schedule and automate sqoop import/export tasks
- How can launch an external process from java and still be able to interact with this process?
- Linux find files where mtime and ctime are not equal
- Find all files contained into directory named
- Quick way to remove all folders titled CVS in a directory and it's subdirectories?
- shell process not exiting on `exit` inside `$()`
- How to set environment variables with a forward slash in the key
- System 'bash -ic' stuck when I hit ctrl+c
- bash functions returns "command not found"
- Why does pattern "*.so?(.*)" produce a syntax error in a script but not on command line?
- retrieve plaintext password from file using bash command
Related Questions in KOTLIN
- Volatile properties in Kotlin?
- Using multiple JVM languages in the same project
- Kotlin - IntelliJ Project Setup
- Kotlin let analogue which returns the receiver
- Kotlin 'when' statement vs Java 'switch'
- Use Kotlin extension in android java class
- Kotlin stub/placeholder function for unimplemented code
- Partial class delegation in Kotlin
- SugarORM + Kotlin: Unresovled reference "listAll"
- Kotlin JS - string to number conversion?
- Where is the old Kotlin specification hosted?
- Kotlin JS - Accessing HTML DOM properties
- Access property delegate in Kotlin
- Kotlin-JS interop - using language constructs
- Does "internal" visibility modifier in Kotlin work yet?
Related Questions in KAPT
- How to implement abstract function in Enum constants
- Kotlin annotation processor: can't make it work
- Kapt not generating classes in Instant app feature module
- With 'kotlin-kapt' plugin, Android Studio doesnt provide specific errors about Dagger 2
- Android Studio fails refactoring "read-only" kapt generated code
- What is a kapt exception?
- Use kapt with spring-boot-configuration-processor in a gradle multi project
- Kapt: How to read annotation (and its parameters)
- How to solve missing InjectedFieldSignature Error implementing Dagger 2 in android?
- Execution failed for task ':libimgur:kaptKotlin'
- Android Studio Kapt error: app:kaptGenerateStubsDebugKotlin compileDebugJavaWithJavac jvm target compatibility should be set to the same Java version
- Execution failed for task ':app:kaptDebugKotlin' for kotlin
- the following options were not recognized by any processor: '[dagger.fastinit, dagger.hilt.android.internal
- Kapt task in error when adding jar built with openapi generator
- Kapt Kotlin incremental annotation processing not working
Related Questions in KOTLINC
- How do I run tests compiling a kotlin file in memory and check the result?
- Gradle not more detail for ':compileKotlin'
- Kotlinc include other jar files
- Annotation Processing: how to change annotation target in Kotlin code?
- Kotlin compile java 12 and kotlin inside Eclipse or command line
- How can kotlinc without gradle or IntelliJ IDEA take less than 10 seconds to compile Hello, World?
- How to compile and run a kotlin file which has dependencies on a jar from CLI?
- Does JVM use kotlinc for Kotlin?
- Documentation for the XML format for files referenced from the kotlinc -Xbuild-file argument
- Suppress Java warning when running kotlinc
- Does the kotlin REPL have code completion?
- How to use kapt from command line (with kotlinc)?
- How to open kotlin repl using kotlin-native-linux?
- kotlinc -script with multiple files
- How to configure the Kotlin bytecode inspector?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Add
tools.jarto Kotlin compilers' classpathAs of Kotlin version 1.1.3-2,
kotlincdoes not addtools.jarto compiler's classpath.tools.jaris required bykapt.As a workaround, you can patch
kotlinc.Edit line 79.
From:
To:
Note:
$JAVA_HOMEmust point to JDK, not JRE.Note: This is a hack.
Invoke
kotlincwith right argumentsReplace:
$MY_CLASSPATHwith your desired classpath/path/to/SomeAnnotationProcessor.jarwith actual path to some annotation processor./sources,./classesand./stubswith paths do directories where respective intermediate artifacts should be stored/path/to/MyKotlinFile.ktwith path to the Kotlin file(s) you want to compile$KOTLIN_HOMEwith the path to Kotlin's installation directory (you should already have this in your env)Note: -X arguments (advanced options) are non-standard and may be changed or removed without any notice
Note:
kapt's interface is undocumented. You can check the source code: https://github.com/JetBrains/kotlin/blob/master/plugins/kapt3/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt#L295This stuff was reverse-engineered from running
gradle build --debuginkotlin-examples/gradle/kotlin-dagger(https://github.com/JetBrains/kotlin-examples/tree/master/gradle/kotlin-dagger).This is just a starting point. I'm still not sure of a few things. Feel free to edit this answer.
Thanks to
runningcode: https://github.com/facebook/buck/issues/956#issuecomment-309080611If it wasn't obvious: this stuff sucks. JetBrains just assumed that CLI doesn't matter and they made the crucial interfaces undocumented / reserved for internal use.