Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1?
Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1? [message #43399] Fri, 29 October 2004 00:52 Go to next message
Eclipse UserFriend
Originally posted by: srobertson.nvisia.com

I've been able to "sorta" get this to work, and am wondering if anyone
has any ideas on a better approach.

The basic question is this: How can I cleanly setup a separate aspect
project which gets woven into a series of Web and Java projects (roughly
20). I'm willing to convert the "target" projects to have an aspect
nature, but would prefer that their compiled classes be woven in place,
in their bin directory. These projects are configured as a series of
web modules and java "project utility jars" in WSAD-speak, and it's
important that that be left unchanged.

I've been playing around with adding the aspect source directory as a
"linked directory" into each of the non-aspect-containing projects.
This works, but 1) causes the aspects to appear in each and every
project's compile target dir, and 2) ajdt gets understandably confused.

Another approach is discussed at
http://dev.eclipse.org/mhonarc/lists/ajdt-dev/msg00324.html and Mike was
kind enough to send along his build file for it. But drawbacks seem to
be that 1) because the weaving is done outside of ajdt, the visualizer
and annotations don't work properly and 2) it doesn't seem to place
classes in the right package structure.

I'm stumbling around on this, so if anyone has any hard-earned wisdom to
share, or even just a link, I'd really appreciate it.

Thanks,

Stu
Re: Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1? [message #43431 is a reply to message #43399] Fri, 29 October 2004 10:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mchapman.uk.ibm.com

One possible alternative, if you do convert your projects to AspectJ
projects, is to have your aspect project create an output jar (instead of
classes in /bin), and then have your target projects import this as an
injar.

If going down this route, it's important to make sure you understand
the difference between inpath and aspectpath etc, and Adrian's helpfully
written this up here:

http://www.aspectprogrammer.org/blogs/adrian/2004/10/three_p aths_sta.html

Now, newer versions of AJDT making specifying input jars easier, but it
is possible with 1.1.4. All the relevant options can be found on each
project's property page, under the "AspectJ Compiler" tab. Also the
handling of project dependencies is better with newer versions of AJDT, so
you might need to do more manual rebuilding after making changes.

Hope that helps,

Matt.

On Thu, 28 Oct 2004 19:52:22 -0500, Stu Robertson wrote:
> I've been able to "sorta" get this to work, and am wondering if anyone has
> any ideas on a better approach.
>
> The basic question is this: How can I cleanly setup a separate aspect
> project which gets woven into a series of Web and Java projects (roughly
> 20). I'm willing to convert the "target" projects to have an aspect
> nature, but would prefer that their compiled classes be woven in place, in
> their bin directory. These projects are configured as a series of web
> modules and java "project utility jars" in WSAD-speak, and it's important
> that that be left unchanged.
>
> I've been playing around with adding the aspect source directory as a
> "linked directory" into each of the non-aspect-containing projects. This
> works, but 1) causes the aspects to appear in each and every project's
> compile target dir, and 2) ajdt gets understandably confused.
>
> Another approach is discussed at
> http://dev.eclipse.org/mhonarc/lists/ajdt-dev/msg00324.html and Mike was
> kind enough to send along his build file for it. But drawbacks seem to be
> that 1) because the weaving is done outside of ajdt, the visualizer and
> annotations don't work properly and 2) it doesn't seem to place classes in
> the right package structure.
>
> I'm stumbling around on this, so if anyone has any hard-earned wisdom to
> share, or even just a link, I'd really appreciate it.
>
> Thanks,
>
> Stu
Re: Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1? [message #43620 is a reply to message #43431] Mon, 01 November 2004 16:25 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: srobertson.nvisia.com

Thanks Matt. I'll give that a try. That article was helpful, as were the
rest of his articles on the site (loved the belgium presentation, looking
forward to the book :-). To make sure I understand correctly, the aspects
will be woven into whatever classes in the other projects (specified in
the INPATH) are targeted by the pointcuts. The "enhanced" classes will
appear in the aspect project bin folder, which I'll then jar up and make
available to the other projects. So in reality, there will be two copies
in the EAR of each class to which aspects have been applied. I'll have to
make sure the aspect jar appears in the classpath before the jars the
pristine classes are in. Is this right?

I've had better luck with the latest M1 build under Eclipse 3.0. I'm
going to try doing the aspect work in WSAD 6 (ok, RAD 6) with 1.2M1, but
running the tests under WSAD 5.1 in the WAS 4.0 test environment, which
we're using in production, and which also isn't available in the RAD build
I have.

Thanks again,

Stu

Matt Chapman wrote:

> One possible alternative, if you do convert your projects to AspectJ
> projects, is to have your aspect project create an output jar (instead of
> classes in /bin), and then have your target projects import this as an
> injar.

> If going down this route, it's important to make sure you understand
> the difference between inpath and aspectpath etc, and Adrian's helpfully
> written this up here:

> http://www.aspectprogrammer.org/blogs/adrian/2004/10/three_p aths_sta.html

> Now, newer versions of AJDT making specifying input jars easier, but it
> is possible with 1.1.4. All the relevant options can be found on each
> project's property page, under the "AspectJ Compiler" tab. Also the
> handling of project dependencies is better with newer versions of AJDT, so
> you might need to do more manual rebuilding after making changes.

> Hope that helps,

> Matt.

> On Thu, 28 Oct 2004 19:52:22 -0500, Stu Robertson wrote:
> > I've been able to "sorta" get this to work, and am wondering if anyone has
> > any ideas on a better approach.
> >
> > The basic question is this: How can I cleanly setup a separate aspect
> > project which gets woven into a series of Web and Java projects (roughly
> > 20). I'm willing to convert the "target" projects to have an aspect
> > nature, but would prefer that their compiled classes be woven in place, in
> > their bin directory. These projects are configured as a series of web
> > modules and java "project utility jars" in WSAD-speak, and it's important
> > that that be left unchanged.
> >
> > I've been playing around with adding the aspect source directory as a
> > "linked directory" into each of the non-aspect-containing projects. This
> > works, but 1) causes the aspects to appear in each and every project's
> > compile target dir, and 2) ajdt gets understandably confused.
> >
> > Another approach is discussed at
> > http://dev.eclipse.org/mhonarc/lists/ajdt-dev/msg00324.html and Mike was
> > kind enough to send along his build file for it. But drawbacks seem to be
> > that 1) because the weaving is done outside of ajdt, the visualizer and
> > annotations don't work properly and 2) it doesn't seem to place classes in
> > the right package structure.
> >
> > I'm stumbling around on this, so if anyone has any hard-earned wisdom to
> > share, or even just a link, I'd really appreciate it.
> >
> > Thanks,
> >
> > Stu
One more thing... the general case of multi-project aspect INPATHs [message #43652 is a reply to message #43620] Mon, 01 November 2004 16:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: srobertson.nvisia.com

Matt, there's a general issue here that I'd be curious to hear your and
the other ajdt developers' thoughts on.

In enterprise apps I've seen, a common application Eclipse/WSAD structure
is to have an application broken up into numerous separate eclipse
projects. Obviously there's at least one each for the EAR and WAR
modules. Frequently there are quite a few others, which become project
utility jars in the EAR at deployment. These are broken out for several
reasons, such as different teams develop them or to keep MVC and interface
dependencies in order. The challenge then is to find a way to use aspects
in this environment so these cross-cutting concerns can be addressed
across multiple projects.

What I like about the approach you suggested is that the woven classes
will be done within ajdt, as opposed to doing this with ant outside of the
IDE. But it still seems somewhat clunky. We're applying aspects in a
separate step, outside of the builder of the projects owning the code
being woven, and placing the woven classes into a jar ahead of the
originals inside the EAR. Is there a way to do this so that the aspects
are woven by the builders of the projects themselves? I would think this
would make the aspects visible from within the editors of the original
class files, so developers could see the visual hints as they work.

Anyway, not sure I've stated the question very clearly. In general, my
impression is that the documentation and examples on the ajdt site are
geared towards a single Eclipse project. This seems like the simple case
to me, and personally I haven't seen this often "in the field," rightly or
wrongly.

Thanks for the exciting work your team is doing.

Stu
Re: One more thing... the general case of multi-project aspect INPATHs [message #43690 is a reply to message #43652] Mon, 01 November 2004 22:05 Go to previous message
Eclipse UserFriend
Originally posted by: mchapman.uk.ibm.com

Stu, I think the approach I suggested does what you are looking for, let
me try to expand on it a bit further. With the aspect project, you go to
its project properties, AspectJ tab, and put in say myaspectlib.jar in the
"output jar" field. From now on, whenever that project is built, the
generated classes go only into this jar file (and not into the project's
bin directory).

Then for the projects that want to make use of this aspect library, make
them AspectJ projects, and go to project properties, AspectJ AspectPath
tab (as in AJDT 1.1.11 onwards), and add the myaspectlib.jar from the
aspect project. Now whenever these projects are built, they are built with
the AspectJ compiler, which will compile the classes in the project, and
weave in the aspects from the aspect path, putting the output in the
project's output directory as normal.

> Anyway, not sure I've stated the question very clearly. In general, my
> impression is that the documentation and examples on the ajdt site are
> geared towards a single Eclipse project. This seems like the simple
> case to me, and personally I haven't seen this often "in the field,"
> rightly or wrongly.

I agree completely, much of our focus is on getting newcomers started. I
think we still need to continue that, but there is a rapidly growing
number of people going beyond these first steps into more real world
scenarios, and we certainly plan to address this area more in the near
future. You might also like to consider writing up your own experiences so
that others can learn from them.

Regards,

Matt.
Re: Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1? [message #584493 is a reply to message #43399] Fri, 29 October 2004 10:44 Go to previous message
Matt Chapman is currently offline Matt ChapmanFriend
Messages: 429
Registered: July 2009
Senior Member
One possible alternative, if you do convert your projects to AspectJ
projects, is to have your aspect project create an output jar (instead of
classes in /bin), and then have your target projects import this as an
injar.

If going down this route, it's important to make sure you understand
the difference between inpath and aspectpath etc, and Adrian's helpfully
written this up here:

http://www.aspectprogrammer.org/blogs/adrian/2004/10/three_p aths_sta.html

Now, newer versions of AJDT making specifying input jars easier, but it
is possible with 1.1.4. All the relevant options can be found on each
project's property page, under the "AspectJ Compiler" tab. Also the
handling of project dependencies is better with newer versions of AJDT, so
you might need to do more manual rebuilding after making changes.

Hope that helps,

Matt.

On Thu, 28 Oct 2004 19:52:22 -0500, Stu Robertson wrote:
> I've been able to "sorta" get this to work, and am wondering if anyone has
> any ideas on a better approach.
>
> The basic question is this: How can I cleanly setup a separate aspect
> project which gets woven into a series of Web and Java projects (roughly
> 20). I'm willing to convert the "target" projects to have an aspect
> nature, but would prefer that their compiled classes be woven in place, in
> their bin directory. These projects are configured as a series of web
> modules and java "project utility jars" in WSAD-speak, and it's important
> that that be left unchanged.
>
> I've been playing around with adding the aspect source directory as a
> "linked directory" into each of the non-aspect-containing projects. This
> works, but 1) causes the aspects to appear in each and every project's
> compile target dir, and 2) ajdt gets understandably confused.
>
> Another approach is discussed at
> http://dev.eclipse.org/mhonarc/lists/ajdt-dev/msg00324.html and Mike was
> kind enough to send along his build file for it. But drawbacks seem to be
> that 1) because the weaving is done outside of ajdt, the visualizer and
> annotations don't work properly and 2) it doesn't seem to place classes in
> the right package structure.
>
> I'm stumbling around on this, so if anyone has any hard-earned wisdom to
> share, or even just a link, I'd really appreciate it.
>
> Thanks,
>
> Stu
Re: Strategy for multi-project aspects with 1.1.4 in Eclipse 2.1? [message #584588 is a reply to message #43431] Mon, 01 November 2004 16:25 Go to previous message
Eclipse UserFriend
Originally posted by: srobertson.nvisia.com

Thanks Matt. I'll give that a try. That article was helpful, as were the
rest of his articles on the site (loved the belgium presentation, looking
forward to the book :-). To make sure I understand correctly, the aspects
will be woven into whatever classes in the other projects (specified in
the INPATH) are targeted by the pointcuts. The "enhanced" classes will
appear in the aspect project bin folder, which I'll then jar up and make
available to the other projects. So in reality, there will be two copies
in the EAR of each class to which aspects have been applied. I'll have to
make sure the aspect jar appears in the classpath before the jars the
pristine classes are in. Is this right?

I've had better luck with the latest M1 build under Eclipse 3.0. I'm
going to try doing the aspect work in WSAD 6 (ok, RAD 6) with 1.2M1, but
running the tests under WSAD 5.1 in the WAS 4.0 test environment, which
we're using in production, and which also isn't available in the RAD build
I have.

Thanks again,

Stu

Matt Chapman wrote:

> One possible alternative, if you do convert your projects to AspectJ
> projects, is to have your aspect project create an output jar (instead of
> classes in /bin), and then have your target projects import this as an
> injar.

> If going down this route, it's important to make sure you understand
> the difference between inpath and aspectpath etc, and Adrian's helpfully
> written this up here:

> http://www.aspectprogrammer.org/blogs/adrian/2004/10/three_p aths_sta.html

> Now, newer versions of AJDT making specifying input jars easier, but it
> is possible with 1.1.4. All the relevant options can be found on each
> project's property page, under the "AspectJ Compiler" tab. Also the
> handling of project dependencies is better with newer versions of AJDT, so
> you might need to do more manual rebuilding after making changes.

> Hope that helps,

> Matt.

> On Thu, 28 Oct 2004 19:52:22 -0500, Stu Robertson wrote:
> > I've been able to "sorta" get this to work, and am wondering if anyone has
> > any ideas on a better approach.
> >
> > The basic question is this: How can I cleanly setup a separate aspect
> > project which gets woven into a series of Web and Java projects (roughly
> > 20). I'm willing to convert the "target" projects to have an aspect
> > nature, but would prefer that their compiled classes be woven in place, in
> > their bin directory. These projects are configured as a series of web
> > modules and java "project utility jars" in WSAD-speak, and it's important
> > that that be left unchanged.
> >
> > I've been playing around with adding the aspect source directory as a
> > "linked directory" into each of the non-aspect-containing projects. This
> > works, but 1) causes the aspects to appear in each and every project's
> > compile target dir, and 2) ajdt gets understandably confused.
> >
> > Another approach is discussed at
> > http://dev.eclipse.org/mhonarc/lists/ajdt-dev/msg00324.html and Mike was
> > kind enough to send along his build file for it. But drawbacks seem to be
> > that 1) because the weaving is done outside of ajdt, the visualizer and
> > annotations don't work properly and 2) it doesn't seem to place classes in
> > the right package structure.
> >
> > I'm stumbling around on this, so if anyone has any hard-earned wisdom to
> > share, or even just a link, I'd really appreciate it.
> >
> > Thanks,
> >
> > Stu
One more thing... the general case of multi-project aspect INPATHs [message #584602 is a reply to message #43620] Mon, 01 November 2004 16:57 Go to previous message
Eclipse UserFriend
Originally posted by: srobertson.nvisia.com

Matt, there's a general issue here that I'd be curious to hear your and
the other ajdt developers' thoughts on.

In enterprise apps I've seen, a common application Eclipse/WSAD structure
is to have an application broken up into numerous separate eclipse
projects. Obviously there's at least one each for the EAR and WAR
modules. Frequently there are quite a few others, which become project
utility jars in the EAR at deployment. These are broken out for several
reasons, such as different teams develop them or to keep MVC and interface
dependencies in order. The challenge then is to find a way to use aspects
in this environment so these cross-cutting concerns can be addressed
across multiple projects.

What I like about the approach you suggested is that the woven classes
will be done within ajdt, as opposed to doing this with ant outside of the
IDE. But it still seems somewhat clunky. We're applying aspects in a
separate step, outside of the builder of the projects owning the code
being woven, and placing the woven classes into a jar ahead of the
originals inside the EAR. Is there a way to do this so that the aspects
are woven by the builders of the projects themselves? I would think this
would make the aspects visible from within the editors of the original
class files, so developers could see the visual hints as they work.

Anyway, not sure I've stated the question very clearly. In general, my
impression is that the documentation and examples on the ajdt site are
geared towards a single Eclipse project. This seems like the simple case
to me, and personally I haven't seen this often "in the field," rightly or
wrongly.

Thanks for the exciting work your team is doing.

Stu
Re: One more thing... the general case of multi-project aspect INPATHs [message #584619 is a reply to message #43652] Mon, 01 November 2004 22:05 Go to previous message
Matt Chapman is currently offline Matt ChapmanFriend
Messages: 429
Registered: July 2009
Senior Member
Stu, I think the approach I suggested does what you are looking for, let
me try to expand on it a bit further. With the aspect project, you go to
its project properties, AspectJ tab, and put in say myaspectlib.jar in the
"output jar" field. From now on, whenever that project is built, the
generated classes go only into this jar file (and not into the project's
bin directory).

Then for the projects that want to make use of this aspect library, make
them AspectJ projects, and go to project properties, AspectJ AspectPath
tab (as in AJDT 1.1.11 onwards), and add the myaspectlib.jar from the
aspect project. Now whenever these projects are built, they are built with
the AspectJ compiler, which will compile the classes in the project, and
weave in the aspects from the aspect path, putting the output in the
project's output directory as normal.

> Anyway, not sure I've stated the question very clearly. In general, my
> impression is that the documentation and examples on the ajdt site are
> geared towards a single Eclipse project. This seems like the simple
> case to me, and personally I haven't seen this often "in the field,"
> rightly or wrongly.

I agree completely, much of our focus is on getting newcomers started. I
think we still need to continue that, but there is a rapidly growing
number of people going beyond these first steps into more real world
scenarios, and we certainly plan to address this area more in the near
future. You might also like to consider writing up your own experiences so
that others can learn from them.

Regards,

Matt.
Previous Topic:ajdt freezes on Mac OS X
Next Topic:New development builds for Eclipse 3.0 *and* 3.1M2
Goto Forum:
  


Current Time: Tue Mar 19 09:32:02 GMT 2024

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

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

Back to the top