[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Aspects in dependent projects in Eclipse
|
Hi Matthias-
You asked how to develop aspects for a separate Java project in Eclipse.
(We really need to get IDE support in AJDT for simple inter-project
dependencies like this, or at least document the approaches below
in the AJDT user guide.)
Given Eclipse Java project P and AspectJ project A, try one of these:
(A) Create a source folder in A that links to sources in P.
Also add all dependencies of P to A.
(B) Like (A), but instead of linked source folders, set up the
inpath of A to include the output directory of P.
(C) Set up another AspectJ project, AP, which either
(1) puts A output dir on the aspectpath and P output directory
on the inpath; or
(2) uses linked source folders to include A and P sources
(along with other aspects in AP).
(D) Have no relationship between A and P, but have a run
configuration that does load-time weaving. There are different
ways to do this, depending on your VM. See the aj.bat script,
or set the following properties:
java.system.class.loader=org.aspectj.weaver.WeavingURLClassLoader
aj.class.path=...
aj.aspect.path=...
(D) only works if you don't need P to compile or weave A, and
is usable only if you don't need any IDE support across A and P.
Factors to consider:
- For any of these, the run configuation needs to be set up from
the master project (e.g., A in (A) or AP in (C)). As you noted,
a run configuration from P would not include the aspects.
- If you want A to target more than P, then (A) and (B) don't work.
- When using binary input for inpath or aspectpath, AJDT might
not navigate to join points in associated sources. (I haven't
tried this in a while.)
- When using linked source folders, the linked source essentially
gets compiled again for each link. Sometimes I close the source
project and just work in the master/linking project, including
editing linked sources.
- If you know that the code in P is not changing, it's usually
faster to use binary input than source input. In incremental
mode, if a file doesn't change it's not recompiled, so there
should be no difference -- except that in AspectJ, when an aspect
changes, all files are recompiled, and you pay a penalty for
using source rather than .class files.
I personally tend to work with linked source folders, because
I tend to be changing both A and P at the same time. So I use
(A) normally, or (C)(2) if I have a standard set of aspects
to apply along with other aspects to another Java project.
Hope this helps.
Wes
> ------------Original Message------------
> From: Matthias Orgler <Matthias@xxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Mar-2-2005 11:32 AM
> Subject: [aspectj-users] Aspects in dependent projects in Eclipse
>
> Hi,
>
> I'm new to AspectJ and plan to do the following task:
>
> 1) I have an existing Eclipse project (regular, i.e. NOT AspectJ),
> which
> I want to modify without touching it
> 2) I created a new AspectJ project and made it dependent on the first
> one
> 3) I created a join point for a method in the first project
>
> Here's the problem:
>
> The AJDT outline browser shows the join point and advice, but it
> doesn't
> resolve the target of the join point in the first project. When I run
> the first project, it is obviously not aware of AspectJ (since it's a
> regular java project) and so ignores my advices.
>
> Question:
>
> How can I create join points for an existing Eclipse project without
> modifying this original project?
>
> Thanks for your help,
>
> Matthias
>
> --
> Matthias Orgler
>
> Detecon Inc.
> 400 S. El Camino Real, Suite 500
> San Mateo, CA 94402
>
> Phone: +1 (650) 401 5212
> Mobile: +1 (650) 430 7533
> Skype: callto://morgler
> Email: Matthias@xxxxxxxxx
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>