Arrow: Annotation processor doesn't work with maven

Created on 8 May 2018  路  13Comments  路  Source: arrow-kt/arrow

It seems that the annotation processor doesn't work in maven.

In particular, attempting to use the annotation processor, compilation fails with a null pointer exception thrown by arrow.instances.InstanceProcessor.onProcess(InstanceProcessor.kt:38), while trying to access the property generatedDir defined in its ancestor class me.eugeniomarletti.kotlin.processing.KotlinAbstractProcessor
error.txt
(See the details on the attached file)

I have created a simple project to demonstrate the problem.

I am not sure whether this is an actual bug or whether am I missing something in the maven configuration.
In any case probably it would be a good idea to add a section to the documentation of arrow detailing how to use annotation processing with maven

Most helpful comment

Indeed, problem does not appear when using korlin plugin 1.2.41 and by adding the companion object.
@Eternity-Yarr Thanks for the solution

Perhaps, it would be nice to have in the "Quick Start" page of the Arrow documentation a section for maven.

All 13 comments

It appears that this was fixed in next releases of kotlin plugin. I've created a pull request with changes to your repository which compiles successfully,

Indeed, problem does not appear when using korlin plugin 1.2.41 and by adding the companion object.
@Eternity-Yarr Thanks for the solution

Perhaps, it would be nice to have in the "Quick Start" page of the Arrow documentation a section for maven.

When using kotlin annotation processing plugin 1.3.0 and Arrow 0.8.0 I get the error:

[ERROR] Failed to execute goal org.jetbrains.kotlin:kotlin-maven-plugin:1.3.0:kapt (kapt) on project kapt-demo: Error while processing kapt options: Missing:
[ERROR] ----------
[ERROR] 1) com.github.aballano:MnemoniK:jar:1.0.0
[ERROR] 
[ERROR]   Try downloading the file manually from the project website.
[ERROR] 
[ERROR]   Then, install it using the command: 
[ERROR]       mvn install:install-file -DgroupId=com.github.aballano -DartifactId=MnemoniK -Dversion=1.0.0 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR]   Alternatively, if you host your own repository you can deploy the file there: 
[ERROR]       mvn deploy:deploy-file -DgroupId=com.github.aballano -DartifactId=MnemoniK -Dversion=1.0.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR] 
[ERROR]   Path to dependency: 
[ERROR]         1) org.jetbrains.kotlin:kotlin-annotation-processing-maven:jar:1.3.0
[ERROR]         2) io.arrow-kt:arrow-annotations-processor:jar:0.8.0
[ERROR]         3) com.github.aballano:MnemoniK:jar:1.0.0

At the same time, kotlin plugin 1.3.0 and 0.7.3 works as aspected.

Updated the https://github.com/routis/kaptdemo that should reproduce this issue

We changed the repositories needed for the project to include JitPack. Have you added it too?

@pakoito Thanks

        <repository>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>jitpack</id>
            <url>https://jitpack.io</url>
        </repository>

@routis close the ticket for now? :D

I'm having this problem too, using Gradle rather than Maven and having followed the Gradle-specific instructions (there's no mention of JitPack in them). In particular:

$ gradle build

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':kaptKotlin'.
> Could not resolve all task dependencies for configuration ':kapt'.
   > Could not find com.github.aballano:MnemoniK:1.0.0.
     Searched in the following locations:
       - https://repo.maven.apache.org/maven2/com/github/aballano/MnemoniK/1.0.0/MnemoniK-1.0.0.pom
       - https://repo.maven.apache.org/maven2/com/github/aballano/MnemoniK/1.0.0/MnemoniK-1.0.0.jar
       - https://jcenter.bintray.com/com/github/aballano/MnemoniK/1.0.0/MnemoniK-1.0.0.pom
       - https://jcenter.bintray.com/com/github/aballano/MnemoniK/1.0.0/MnemoniK-1.0.0.jar
     Required by:
         project : > io.arrow-kt:arrow-annotations-processor:0.8.1

Edit: nevermind, my fault, I see it mentions maven { url 'https://jitpack.io' } in the top-level README.

@TAGC is it fixed then?

Yeah.

@pakoito Should this be closed? They figured out the problem.

Closing!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jmfayard picture jmfayard  路  4Comments

JorgeCastilloPrz picture JorgeCastilloPrz  路  3Comments

vejeta picture vejeta  路  3Comments

JorgeCastilloPrz picture JorgeCastilloPrz  路  5Comments

1Jajen1 picture 1Jajen1  路  3Comments