Bug 474018 - Aspects not applied when belonging to project opened in workspace
Summary: Aspects not applied when belonging to project opened in workspace
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: IDE (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-31 07:33 EDT by pascal Pochet CLA
Modified: 2015-08-07 11:45 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pascal Pochet CLA 2015-07-31 07:33:38 EDT
We have a multi-modules Maven project, one of the modules being a multi-modules project itself and made of jars containing Aspects.

MAIN (pom)
|- MODULE1 (jar)
|- MODULE2 (jar)
|- MODULE3 (war)
|- ASPECT_MODULE (pom)
|-- ASPECT_MOD1 (jar)
|-- ASPECT_MOD2 (jar)
|-- ASPECT_ALLMOD (über jar containing all the other aspect JARs)

In the MAIN project, the JAR modules depends on the final JAR (ASPECT_ALLMOD) containing the aspects and these aspects have to be applied. 
This is achieved thru the <aspectLibraries> of the maven-aspectj-plugin, and it's works perfectly when building the project under Maven.

However, when building the project under Eclipse (STS version based on Luna in our case), IF the sub-projects containing the Aspects (ASPECT_MODULE and its descendants) are opened in the workspace, then the Aspects are not applied and this is directly visible by the fact that the AspectJ markers disappear when looking at source code of any of the MODULE_x's class.

When looking at the AspectJ build under the Project->Properties, in the tab "Aspect Path", the referenced Aspect JAR (ASPECT_ALLMOD) is displayed with the icon of a folder when its project is opened in the workspace.
As soon as we close the project, the icon turn into a JAR one and everything works as expected.

It looks like the fact that the project's reference change of "nature" influences the behaviour of the AspectJ integration in Eclipse.
Comment 1 Andrew Clement CLA 2015-08-07 11:45:56 EDT
I think this is the maven tooling trying to be helpful.  Can you check the project settings and see if this changes the behavior?

For the dependent projects, open Project Properties, select 'maven' on the left - it should show the option "resolve dependencies from workspace projects" can you deselect that?