This sounds like a classic circular-dependency problem. How about the following solution, based on the Dependency Inversion Principle (http://www.objectmentor.com/publications/dip.pdf)?

1) Extract the aspect into a separate"component" with its own build step.
2) Define an interface for the services provided by the rest of your code base that your aspect needs. The interface is part of the aspect's component. The aspect needs a "setter" to associate to it an object that implements the interface.
3) Determine where in your code base (main()?) to invoke the "setter" to associate an implementing object with the aspect. (You could use dependency injection with Spring, for example.)
4) Build the aspect and weave the 3rd-party jar.
5) Build your code base.
6) At runtime, associate the implementing object with the aspect...
7) Rinse and repeat ;)

HTH,
dean

[EMAIL PROTECTED] wrote:
Hello,

I am trying to weave into a third party jar an aspect that depends on my local codebase, but I want to defer the compilation of my local codebase until a later time and simply reference the previously woven jar file. However, I am getting a compile error with that approach. The following ant target works fine, but weaves into the third party jar and compiles my local codebase at the same time:

<target name="weave.thirdparty.jar" depends="weave.setup">
  <iajc outjar="${woven_thirdparty_jar}" source="1.5" target="1.5" debug="on" verbose="true" 
XlintFile="${basedir}/xlint.properties" fork="true" maxmem="512m">
   <classpath>
    <pathelement location="${aspectj_runtime_jar}"/>
   </classpath>
   <sourceroots>
    <pathelement location="${thirdparty_advice_src}"/>
    <pathelement location="${monitored_codebase_src}"/>
   </sourceroots>
   <inpath>
    <pathelement location="${original_thirdparty_jar}"/>
   </inpath>
  </iajc>
 </target>

If I move the <pathelement location="${monitored_codebase_src}"/> element from <sourceroots> to <classpath> though, I get a compilation error about an unknown type from my local codebase when compiling one of the aspects I intend to introduce.

Does this appear to be a compiler defect to anyone?

Thanks,

Doug
  

_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users


-- 
Dean Wampler, Ph.D.
[EMAIL PROTECTED]  
http://www.aspectassoc.com  
http://www.aspectprogramming.com  
http://www.contract4j.org
I want my tombstone to say: 
   Unknown Application Error in Dean Wampler.exe. 
   Application Terminated.
   [Okay]    [Cancel]
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to