项目作者: serpro69

项目描述 :
An example showing how to do compile-time weaving of Kotlin classes with aspectj and maven
高级语言: Java
项目地址: git://github.com/serpro69/kotlin-aspectj-maven-example.git
创建时间: 2019-06-22T06:57:13Z
项目社区:https://github.com/serpro69/kotlin-aspectj-maven-example

开源协议:MIT License

下载


An example project showing that it’s possible to do compile-time weaving of Kotlin classes with AspectJ.

Motivation

I was looking into how to make Kotlin (and possibly a mixed Kotlin-Java) project and AspectJ work together.
Looking up things on the web didn’t help much as most of the resources focus on Java not Kotlin when it comes to AOP,
and where Kotlin is mentioned people have been mostly saying that it does not work out of the box.

I’ve tried to make a sample project where I would be able to create an aspect, weave the classes at compile time using
maven as build tool, and verify the results in a test class. This is basically the main objective of this repo.

Maven plugin for AspectJ

I have tried using aspectj-maven-plugin
but it does not seem to be working with Kotlin + Java,
and jcabi-maven-plugin plugin which seems to be working for my purposes.

Running tests

The project uses maven wrapper hence there’s no need to have a local maven installation on your machine.

To execute tests run $ ./mvnw clean test (or $ mvnw.cmd if you’re using Windows command line).