aspectj-maven-plugin

How to force compile error with aspectJ pointcut mismatch

こ雲淡風輕ζ 提交于 2019-12-19 11:36:34
问题 I have the following aspectJ pointcut: @Around(value="execution(* *(*,Map<String, Object>)) && @annotation(com.xxx.annotations.MyCustomAnnotation)") As you can see, this pointcut only matches methods, annotated with com.xxx.annotations.MyCustomAnnotation, which have 2 arguments - the first one is arbitrary and the second one must be of type Map<String, Object> . Is there a way to configure the aspectj-maven-plugin to force compilation errors if it find methods that are annotated with com.xxx

AspectJ + Junit + Maven - pointcut recognized in tests but NoSuchMethodError: aspectOf() exception thrown

房东的猫 提交于 2019-12-18 13:14:28
问题 I have followed almost all JUnit + Maven + AspectJ questions here and even I am pretty sure I have everything set properly, I am unable to test it. I have a Maven module with just one aspect: @Aspect public class AssertionAspect { @Pointcut("execution(@org.junit.Test * *())") public void testMethodEntryPoint() {} @Before("testMethodEntryPoint()") public void executeBeforeEnteringTestMethod() { System.out.println("EXECUTE ACTION BEFORE ENTERING TEST METHOD"); } @After("testMethodEntryPoint()")

AspectJ in Maven project, not working/weaving

最后都变了- 提交于 2019-12-18 04:26:12
问题 I am trying get the AspectJ weaving working in a simple Maven project, and not sure where it is going wrong : when I run the code using "mvn exec:java", I dont see expected output. I am sure the code is working, because I tried the same in STS, where it works fine. I just wanted to get the AspectJ working in a Maven project. Any hints to how to debug this kind of issues will be much appreciated. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema

Maven + AspectJ weaving for Java8

血红的双手。 提交于 2019-12-17 20:28:35
问题 I Cannot mvn package with the minimal sample below. Eclipse (Mars.2 Release 4.5.2) compiles and weaves without a problem. What do I have to do to make it work? The output: [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test --- [INFO] Changes detected - recompiling the module! [WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! [INFO] Compiling 2 source files to ...\workspace\test\target\classes [INFO] -----------------

Weave external aspect with new pointcut [duplicate]

偶尔善良 提交于 2019-12-12 02:53:47
问题 This question already has answers here : Aspect advising other aspects (4 answers) Closed 3 years ago . I'm pretty new to AOP in general, but I have the following problem. I have 2 projects. One containing an aspect that does some performance testing and another project which has a dependency to the previous one. What I'd like to achieve is weave the aspect from project 1, into another aspect of project 2. As such doing some performance testing on the aspect of project 2. I found out it's not

Maven AspectJ plugin non spring project won't work

主宰稳场 提交于 2019-12-11 18:49:36
问题 I have a project, which is NOT a spring application. I am trying to use AspectJ annotations in it. The Annotation classes are being referenced from another jar I have. I have mentioned my plugin section of POM below. My build succeeds but the console output of Maven never mentions anything about the AspectJ plugin and also the annotations don't work when I run my project. I have been trying to find out what's wrong for hours now but can't figure it out. <pluginManagement> <plugins> <plugin>

Spring Aop Error Can not build thisJoinPoint lazily for this advice

≡放荡痞女 提交于 2019-12-11 15:14:11
问题 Pointcut declaration: @Pointcut(value="com.someapp.someservice.someOperation() && args(t,req)",argNames="t,req") private void logOperationArg(final String t,final String req) { } Advice Declaration not compiling: @Before(value="logOperationArg(t,req)") public void logBeforeOperationAdvice(JoinPoint jp, final String t, final String req){ ... } When compiling Aspect with Aspectj-maven-plugin (1.5 version), have error "can not build thisJoinPoint lazily for this advice since it has no suitable

AspectJ advice does not fire in Maven multi-module setup

♀尐吖头ヾ 提交于 2019-12-05 21:25:00
I'm trying to do AOP with Aspectj, but I don't know why is not executing my aspect, it just runs the main class. Is the first time I do this, so I might be doing something wrong. This is my code: The Aspect: @Aspect public class YourAspect { @Pointcut("@annotation(yourAnnotationVariableName)") public void annotationPointCutDefinition(YourAnnotation yourAnnotationVariableName){ } @Pointcut("execution(* *(..))") public void atExecution(){} @Around("annotationPointCutDefinition(yourAnnotationVariableName) && atExecution()") public Object aroundAdvice(ProceedingJoinPoint joinPoint, YourAnnotation

Mvn clean install tomcat7:deploy fails with “invalid byte tag in constant pool”

蓝咒 提交于 2019-12-05 12:38:26
问题 Every time that I run mvn clean install tomcat7:deploy in the command prompt, it fails. When I open the generated log file, it says that there is an invalid byte tag in constant pool. The file that it specifies is java/lang/CharSequence.class. Here is the log: ---- AspectJ Properties --- AspectJ Compiler 1.6.9.RC3 built on Wednesday Jun 30, 2010 at 15:46:30 GMT ---- Dump Properties --- Dump file: ajcore.20141116.131622.157.txt Dump reason: org.aspectj.apache.bcel.classfile

Mvn clean install tomcat7:deploy fails with “invalid byte tag in constant pool”

两盒软妹~` 提交于 2019-12-03 22:22:02
Every time that I run mvn clean install tomcat7:deploy in the command prompt, it fails. When I open the generated log file, it says that there is an invalid byte tag in constant pool. The file that it specifies is java/lang/CharSequence.class. Here is the log: ---- AspectJ Properties --- AspectJ Compiler 1.6.9.RC3 built on Wednesday Jun 30, 2010 at 15:46:30 GMT ---- Dump Properties --- Dump file: ajcore.20141116.131622.157.txt Dump reason: org.aspectj.apache.bcel.classfile.ClassFormatException Dump on exception: true Dump at exit condition: abort ---- Exception Information --- org.aspectj