Frage

Is it possible to have a Scala Maven project and weave AspectJ aspects at compile-time within the Scala classes?

I've been able to get load-time weaving to work but so far no success with compile-time.

The aspects are simply not woven into the Scala classes. From what I understand, compile-time weaving requires a specific Java compiler (AspectJ Compiler aka ajc). It is my understanding that ajc cannot compile Scala.

Is there an ajc equivalent for Scala? Or perhaps another way to get compile-time weaving to work with Scala?

War es hilfreich?

Lösung 2

How about using AJC's -inpath switch? It accepts .class files in directories or JARs and weaves into them. Your Scala compiles to .class files, so that ought to work. No doubt you have the AJC docs, but here's a link.

Andere Tipps

Answer 1 isn't true compile-time weaving - it's binary weaving of already-compiled classes. It wouldn't work, for instance, if your scala classes needed the aspects to compile properly. I think the issue of compile-time weaving in scala is still an open question.

We agree with the assessment by the original poster that ajc is unlikely to know how to compile scala.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top