Add Maven Plugin for Aspect

Reading time ~1 minute

Trying to add spring aop to my S2SH practice project. Somehow, my advice can’t be called at all, though my configuration is totally correct.

After some googling finally find out need to add aspect plugin for maven and dependency.

Dependency:

    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>1.8.7</version>
    </dependency>

Plugin:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>aspectj-maven-plugin</artifactId>
        <version>1.8</version>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>       <!-- use this goal to weave all your main classes -->
              <goal>test-compile</goal>  <!-- use this goal to weave all your test classes -->
            </goals>
          </execution>
        </executions>
      </plugin>

Reference: codehaus-mojo document

comments powered by Disqus

我想如何死去

## 前言最近一直在思考,到底人生的意义是什么,什么支持我每天起床?我的喜好是什么?然而并没有什么进展。刚刚突然想到,如果反着过来会怎么样呢?我对我的最后一天的幻想也在脑海中linger了很久。而且在写的过程,发现随着内容的慢慢丰富,好像也可以启发我如何走到这一天。## 正...… Continue reading

覆巢之下(1)

Published on July 31, 2023

尚未锦衣,何以还乡

Published on December 15, 2019