Maven 1.x AspectJ Plugin

Add property that define output folder for aspectj:compile goal.

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 3.2
  • Fix Version/s: 4.0
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    5

Description

It will be good to have property for destination folder for compiled sources. It will be very helpful when you have aspects only for unit tests and don't wont to have weaved classes in classes folder.

I propose to use property with name "maven.aspectj.dest" that by default will set to "maven.build.dest".

I have attached patch where added proposed property and test case that use this property.

Activity

Hide
Carlos Sanchez added a comment -

If you could provide a patch in unified diff format it would be faster to fix.

Show
Carlos Sanchez added a comment - If you could provide a patch in unified diff format it would be faster to fix.
Hide
Alexey Dashkevich added a comment -

Required patch attached.

Show
Alexey Dashkevich added a comment - Required patch attached.
Hide
Carlos Sanchez added a comment -

An improved patch.
This needs a bit more of thinking, e.g. if you change the dest dir you need to change the classpath to add it.
What's your use case, aspects that you only want to use when testing?

Show
Carlos Sanchez added a comment - An improved patch. This needs a bit more of thinking, e.g. if you change the dest dir you need to change the classpath to add it. What's your use case, aspects that you only want to use when testing?
Hide
Alexey Dashkevich added a comment -

I will describe situation when destination property will be helpful. For example we have project with following structure:

project

  • src
     
      -aspects
       
    • BusinessObjectAspect (weave methods that use connection to dummy functionality)
      -java
       
    • BusinessObject (has functionality that make connection to database)
      -test
     
    • BusinessObjectTest (test for BusinessObject functionality)

I want to use BusinessObjectAspect for my test but I don't wont to include into JAR weaved classes and aspects. So with current version of plugin I need to make following in my own maven.xml:
<postGoal name="test:compile">
<j:set var="tmp" value="${maven.build.dest}"/>
<j:set var="maven.build.dest" value="${maven.test.dest}"/>
<attainGoal name="aspectj:compile"/>
<j:set var="maven.build.dest" value="${tmp}"/>
</postGoal>

I will attach new patch where I take in account changes in class path. And I will create test case that use plugin with applied patch for MPASPECTJ-14. In this case I can create more demonstrative test.

Show
Alexey Dashkevich added a comment - I will describe situation when destination property will be helpful. For example we have project with following structure: project
  • src
     
      -aspects
       
    • BusinessObjectAspect (weave methods that use connection to dummy functionality)
      -java
       
    • BusinessObject (has functionality that make connection to database)
      -test
     
    • BusinessObjectTest (test for BusinessObject functionality)
I want to use BusinessObjectAspect for my test but I don't wont to include into JAR weaved classes and aspects. So with current version of plugin I need to make following in my own maven.xml: <postGoal name="test:compile"> <j:set var="tmp" value="${maven.build.dest}"/> <j:set var="maven.build.dest" value="${maven.test.dest}"/> <attainGoal name="aspectj:compile"/> <j:set var="maven.build.dest" value="${tmp}"/> </postGoal> I will attach new patch where I take in account changes in class path. And I will create test case that use plugin with applied patch for MPASPECTJ-14. In this case I can create more demonstrative test.
Hide
Alexey Dashkevich added a comment -

I have attached new patch (mpaspectj-15.txt) where I take in account changes in class path. Could you, please, review it.

Show
Alexey Dashkevich added a comment - I have attached new patch (mpaspectj-15.txt) where I take in account changes in class path. Could you, please, review it.
Hide
Carlos Sanchez added a comment -

Could you try to see if this works?

<preGoal name="test:compile">
<attainGoal name="aspectj"/>
</preGoal>

<postGoal name="test:test">
<attainGoal name="clean"/>
<attainGoal name="java:compile"/>
</postGoal>

Show
Carlos Sanchez added a comment - Could you try to see if this works? <preGoal name="test:compile"> <attainGoal name="aspectj"/> </preGoal> <postGoal name="test:test"> <attainGoal name="clean"/> <attainGoal name="java:compile"/> </postGoal>

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: