Skip to main content



      Home
Home » Language IDEs » AspectJ » aspectj : how to compile only required files using (how to compile only required files )
aspectj : how to compile only required files using [message #1074024] Thu, 25 July 2013 20:23 Go to next message
Eclipse UserFriend
Hi,
I am new to AspectJ. I am working on a legacy web project which has hundreds of file. I have written an aspect to capture the query call. So, I require to weave only DAO class. Is there any way I can instruct the aspectj compiler to only weave the required files.
For example, i want have the dao weave under different dao pakes as below:
com.xyx.p1.dao
com.xyz.p2.dao
com.zzz.p3.dao

So is there any way that i can write the expression so that asjpectj compiler would weave only the files within the package ending with *.dao

Re: aspectj : how to compile only required files using [message #1074059 is a reply to message #1074024] Thu, 25 July 2013 22:34 Go to previous messageGo to next message
Eclipse UserFriend
You should use the within pointcut for this:

pointcut targetPackages() : within(com.xyx.p1.dao..*.*) || 
        within(com.xyx.p2.dao..*.*) || <etc...>;


And then use this pointcut with your other advice to ensure that the compiler scopes the target of other advice properly. Kind of like this:

before() : targetPackages() && <someotherpointcuts> {
  // do sumpin
}
Re: aspectj : how to compile only required files using [message #1074309 is a reply to message #1074059] Fri, 26 July 2013 09:26 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Andrew for the reply. But I want to do something as below:
Match the package Starting with say "com.xyz" and followed by anything and then ending with "dao". Can I write expression for such case in the pointcut.
Re: aspectj : how to compile only required files using [message #1074361 is a reply to message #1074309] Fri, 26 July 2013 11:12 Go to previous messageGo to next message
Eclipse UserFriend
True, the pointcut could be simplified like this

ointcut targetPackages() : within(com..*.dao..*.*);
Re: aspectj : how to compile only required files using [message #1074455 is a reply to message #1074361] Fri, 26 July 2013 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I tried with that and it works. But even with this AspectJ compiler tries to weave all the classes present in the src directory. Is there any way I can specify compiler to weave only the required packages and skip trying to weave others.
Re: aspectj : how to compile only required files using [message #1074457 is a reply to message #1074455] Fri, 26 July 2013 17:04 Go to previous message
Eclipse UserFriend
What is the problem with trying to weave all classes? If aspects don't apply to them, they will not be changed. Is it taking too long?
Previous Topic:Demand base logging on production
Next Topic:Plug-in to send data to excel?
Goto Forum:
  


Current Time: Fri May 16 00:59:12 EDT 2025

Powered by FUDForum. Page generated in 0.03576 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top