Including AspectJ Breaks Kotlin Project


#1

The thread AOP and Kotlin got me interested in AOP. I tried creating an example project using AspectJ. However, once I include AspectJ, none of my classes are found. In fact, removing AspectJ still does not remove my broken build.

Steps to reproduce:

  1. Create a new Maven project without archetype.
  2. Enable auto-import
  3. Add Framework Support for Kotlin (Java)
  4. Create a simple main File

fun main(args : Array<String>) {   println("Hello, world.") }

  5. Add AspectJ via Maven as follows:

<properties>   <aspectj.version>1.7.3</aspectj.version> </properties>

<dependencies>
  <!-- AOP -->
  <dependency>
  <groupId>org.aspectj</groupId>
  <artifactId>aspectjrt</artifactId>
  <version>${aspectj.version}</version>
  </dependency>
</dependencies>

<build>
  <plugins>
  <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>aspectj-maven-plugin</artifactId>
           <version>1.5</version>
           <executions>
           <execution>
                   <goals>
                   <goal>compile</goal>
                   <goal>test-compile</goal>
                   </goals>
           </execution>
           </executions>
  </plugin>
  </plugins>
</build>


  6. Verify the Facet for AspectJ has been automatically detected.
  7. Run and verify that a NoClassDefException is thrown.

From here I tried to reverse the broken build by:

  1. Removing AspectJ from my Maven and from my Facets
  2. Rebuild and make the project

I’m using IntelliJ 13 with Kotlin plugin 0.6.1617 and my project is configured with JDK 7 and enabled Java 7 features.

I have attached a project at step 7 of the above error scenario. I would appreciate every help in getting my build to work again and solutions to working with AspectJ and Kotlin.

Cheers,

Christian



KotlinTest.7z.zip (6.06 KB)

#2

Works for me, AspectJ support disabled