0

I'm stuck with the following problem: my plugin adda certain annotations to certain classes after they are compiled. I need AspectJ plugin to process them. So my plugin runs before AspectJ plugin. My plugin adds annotations but then AspectJ plugin rewrites classes (as far as I understand it compiles sources not processing classes). So I want somehow to force AspectJ plugin not to rewrite and process my annotations somehow or some other way for my annotations not to dissappear.

Thanks for any help!

UPDATE: Any plugin weaving binaries will be very helpful.

Dmitry Senkovich
  • 5,521
  • 8
  • 37
  • 74

1 Answers1

1

Finally I've found a solution. There is such an awesome plugin as jcabi-maven-plugin! Here is its configuration:

       <plugin>
            <groupId>com.jcabi</groupId>
            <artifactId>jcabi-maven-plugin</artifactId>
            <version>0.14.1</version>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>ajc</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

This plugin weaves binaries. So I solved my problem simply inserting my plugin configuration before this one. Also this cool thing work even in the presence of aspectj-maven-plugin. You can configure jcabi-maven-plugin to run after aspectj-maven-plugin and everything will work (for me at least)!

UPDATE: removed plugin repository

Dmitry Senkovich
  • 5,521
  • 8
  • 37
  • 74
  • 1
    You don't need to use `1.0-SNAPSHOT` version. [0.14.1](http://plugin.jcabi.com/index.html) is the latest stable version, which will do everything you need as good as a snapshot one :) – yegor256 May 23 '17 at 11:53
  • @yegor256 thanks a lot, it will make the configuration at my diploma work even more beautiful! – Dmitry Senkovich May 23 '17 at 12:02