How to do a Simple AspectJ Project using Web Services and ANT

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to do a Simple AspectJ Project using Web Services and ANT

Florian Requin
This post was updated on .
Bonjour,

I want to create a simple AspectJ project using ANT and one web service and AspectJ 1.6.
When I run my project with ANT, I have no error for the compilation, for the execution :  the webservice work  but the script with AspectJ doesn't work .
 
Someone has a idea why that don't work ?

Source file :
build.xml
HelloWorldService.java
LogAspect.aj
There is here all the project from eclipse :
ant_aspectj_webservice.zip

Thank you .

Florian.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Simple AspectJ Project using Web Services and ANT

Andy Clement
Hi Florian,

On a quick look at the aspect, it is a bit odd that it specifies the parameter value to the method in the pointcut:
before(): execution(public * WebService.HelloWorldService.echo("yop") ){
I wouldn’t expect that to work - I’m surprised it compiles since when I try I get an error:

no match for this type name: foo [Xlint:invalidAbsoluteTypeName]
before(): execution(* n("foo")) {}
                        ^^
[Xlint:invalidAbsoluteTypeName]

Your other advice against the logHellow() pointcut looks reasonable to me, and the pointcut for that looks right:

  pointcut logHellow() : execution(  *  WebService.HelloWorldService.Hellow(..));
  after() : logHellow() { 
    System.out.println("APRES  Hellow"); 
  }
In your ant script I see a section that compiles the source code for the class “target compile” and a section that compiles the aspect “target compileAJ” but I don’t see anything that weaves them together, am I overlooking it?  Are you trying to use loadtime weaving or compile time weaving?

If compiling time weaving (weaving as you compile), I’d expect either the java source and AspectJ source to be compiled together by iajc, or I’d expect the compileAJ step to be fed the compiled java class files as input (using an ‘inpath’ setting perhaps) and then it would weave into them and produce a woven copy.

If you are loadtime weaving then I’d expect to sea an aop.xml file somewhere naming the aspect and then the app server to be launched with the AspectJ weaver java agent. I find compile time weaving easier to get my head around, but as I say I don’t quite see that happening here. Are you getting warnings at compile time that your advice does not match anywhere? I’d expect that for the compileAJ task (although I’d also expect a compile time error about that pointcut which specifies a string literal in the pointcut expression).

cheers,
Andy

On Feb 17, 2016, at 7:34 AM, Florian Requin <[hidden email]> wrote:

Bonjour,

I want to create a simple AspectJ project using ANT and one web service and
AspectJ 1.6.
When I run my project with ANT, I have no error for the compilation, for the
execution :  the webservice work  but the script with AspectJ doesn't work .

Someone has a idea why that don't work ?

Source file :
build.xml <http://aspectj.2085585.n4.nabble.com/file/n4652026/build.xml>  
HelloWorldService.java
<http://aspectj.2085585.n4.nabble.com/file/n4652026/HelloWorldService.java>  
LogAspect.aj
<http://aspectj.2085585.n4.nabble.com/file/n4652026/LogAspect.aj>  
There is here all the project from eclipse :
ant_aspectj_webservice.zip
<http://aspectj.2085585.n4.nabble.com/file/n4652026/ant_aspectj_webservice.zip>  

Thank you .

Florian.




--
View this message in context: http://aspectj.2085585.n4.nabble.com/Simple-AspectJ-Project-using-Web-Services-and-ANT-tp4652026.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Loading...