vmassol     2004/05/07 12:19:10

  Modified:    aspectj/xdocs changes.xml goals.xml index.xml properties.xml
               aspectj  project.xml plugin.jelly plugin.properties
  Log:
  Applied patch from Carlos Sanchez. It's an almost complete rewrite of the 2.0 
version of the plugin that is using AspectJ 1.2rc1 which allows bytecode weaving of 
directories.
  
  Revision  Changes    Path
  1.10      +8 -1      maven-plugins/aspectj/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/changes.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- changes.xml       1 May 2004 09:20:21 -0000       1.9
  +++ changes.xml       7 May 2004 19:19:10 -0000       1.10
  @@ -24,9 +24,16 @@
       <author email="[EMAIL PROTECTED]">dIon Gillard</author>
       <author email="[EMAIL PROTECTED]">Vincent Massol</author>
       <author email="[EMAIL PROTECTED]">Jason van Zyl</author>
  +    <author email="[EMAIL PROTECTED]">Carlos Sanchez</author>
     </properties>
     <body>
  -    <release version="2.1" date="in CVS">
  +    <release version="3.0" date="in CVS">
  +      <action dev="vmassol" type="update" issue="MPASPECTJ-8" due-to="Carlos 
Sanchez" due-to-email="[EMAIL PROTECTED]">
  +        Another almost complete rewrite of the plugin. The plugin is now
  +        using AspectJ 1.2rc1 and allows weaving at class level (instead of
  +        at jar level which was a bad idea introduced in version 2.0 of the 
  +        plugin). It also supports weaving of dependent libraries.
  +      </action>
       </release>
       <release version="2.0" date="2004-03-10">
         <action dev="vmassol" type="add">Complete rewrite of the plugin. Now using 
AspectJ 1.1 and performing binary weaving on jar generated by the
  
  
  
  1.5       +16 -34    maven-plugins/aspectj/xdocs/goals.xml
  
  Index: goals.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/goals.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- goals.xml 4 Mar 2004 18:00:22 -0000       1.4
  +++ goals.xml 7 May 2004 19:19:10 -0000       1.5
  @@ -1,4 +1,5 @@
   <?xml version="1.0"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  @@ -20,45 +21,26 @@
   <document>
   
     <properties>
  -    <title>Maven AspectJ Plug-in Goals</title>
  +    <title>Maven AspectJ plugin Goals</title>
       <author email="[EMAIL PROTECTED]">dIon Gillard</author>
  +    <author email="[EMAIL PROTECTED]">Carlos Sanchez</author>
     </properties>
   
     <body>
  -    <section name="Goals">
  -<p>Todo. For the time being, please refer to the plugin.jelly file
  -in the aspectj plugin directory.</p>
  -<!--
  -      <table>
  -        <tr><th>Goal</th><th>Description</th></tr>
  -        <tr>
  -          <td>aspectj</td>
  -          <td>
  +    <goals>
  +      <goal>
  +        <name>aspectj</name>
  +        <description>
               This is the default goal of the plugin and simply attains
               the <code>aspectj:compile</code> goal.
  -          </td>
  -        </tr>
  -        <tr>
  -          <td>aspectj:compile</td>
  -          <td>
  -            Compiles source code as found in the
  -<source><![CDATA[
  -<build>
  -  <aspectSourceDirectory>...</aspectSourceDirectory>
  -</build>
  -]]>
  -</source>
  -            element from your
  -           <a href="http://maven.apache.org/reference/project-descriptor.html";>
  -           project descriptor</a>
  -           <p>
  -             Code is only recompiled if any of the source is newer than
  -             the jar file
  -           </p>
  -          </td>
  -        </tr>
  -      </table>
  --->
  -    </section>
  +        </description>
  +      </goal>
  +      <goal>
  +        <name>aspectj:compile</name>
  +        <description>
  +            Weaves project classes and dependency libraries.
  +        </description>
  +      </goal>
  +    </goals>
    </body>
   </document>
  
  
  
  1.4       +151 -13   maven-plugins/aspectj/xdocs/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/index.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- index.xml 4 Mar 2004 18:00:22 -0000       1.3
  +++ index.xml 7 May 2004 19:19:10 -0000       1.4
  @@ -1,4 +1,5 @@
   <?xml version="1.0"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  @@ -20,27 +21,20 @@
   <document>
   
     <properties>
  -    <title>Maven AspectJ Plug-in</title>
  +    <title>Maven AspectJ plugin</title>
       <author email="[EMAIL PROTECTED]">dIon Gillard</author>
       <author email="[EMAIL PROTECTED]">Vincent Massol</author>
  +    <author email="[EMAIL PROTECTED]">Carlos Sanchez</author>
     </properties>
   
     <body>
       <section name="Maven AspectJ Plug-in">
         <p>
  -        AspectJ plugin for Maven. It offers the following features:
  +        AspectJ plugin for Maven. It offers the ability to
  +        weave aspects on the classes generated and dependency libraries.
  +        This also includes the ability to add dependencies on libraries
  +        with aspects.
         </p>
  -      <ul>
  -        <li>
  -          Ability to automatically weave aspects on the jar generated
  -          by the jar plugin. This also includes the ability to add 
  -          dependencies on reusable aspect libraries located in your Maven
  -          repository.          
  -        </li>
  -        <li>
  -          Ability to generate and deploy a reusable aspect jar.
  -        </li>
  -      </ul>
         <p> 
           For more information on the functionality provided by this plugin,
           please see the <a href="goals.html">Goals</a> document.
  @@ -51,5 +45,149 @@
           document.
         </p>
       </section>
  +    <section name="Installing">
  +      <p>
  +        To install or update the plugin do the following:<br/>
  +        <code>maven plugin:download -DgroupId=maven 
-DartifactId=maven-aspectj-plugin -Dversion=&lt;version&gt;</code>
  +      </p>
  +    </section>
  +
  +    <section name="Using aspects from other libraries">
  +      <p>You must tell Maven what aspects you want to weave project classes with
  +      in addition to the source aspects in your project. This is achieved by 
  +      specifying meta-information in the POM, using the
  +      <code>aspectj.weaveWith</code> property 
  +      </p>
  +      <source>
  +          <![CDATA[
  +          <dependency>
  +            <groupId>groupid</groupId>
  +            <artifactId>jarid</artifactId>
  +            <version>jarversion</version>
  +            <properties>
  +              <aspectj.weaveWith>true</aspectj.weaveWith>
  +            </properties>
  +          </dependency>
  +          ]]>
  +      </source>
  +    </section>
  +
  +    <section name="Weaving classes from other libraries">
  +      <p>You must tell Maven what libraries you want to weave with project aspects
  +      or aspect libraries. This is achieved by 
  +      specifying meta-information in the POM, using the
  +      <code>aspectj.weaveInto</code> property 
  +      </p>
  +      <source>
  +         <![CDATA[
  +          <dependency>
  +            <groupId>groupid</groupId>
  +            <artifactId>jarid</artifactId>
  +            <version>jarversion</version>
  +            <properties>
  +                <aspectj.weaveInto>true</aspectj.weaveInto>
  +            </properties>
  +          </dependency>
  +          ]]>
  +      </source>
  +    </section>
  +
  +    <section name="Creating a deployable file">
  +      <p>If you are creating a deployable file like a war you
  +      need to add the aspectjrt library to your dependencies so it
  +      gets included in the file. You shouldn't need to add it for
  +      other operations.
  +      </p>
  +      <source>
  +          <![CDATA[
  +           <dependency>
  +             <groupId>aspectj</groupId>
  +             <artifactId>aspectjrt</artifactId>
  +             <version>1.2rc1</version>
  +             <url>http://www.eclipse.org/aspectj</url>
  +             <properties>
  +                <war.bundle>true</war.bundle>
  +             </properties>
  +           </dependency>
  +          ]]>
  +      </source>
  +    </section>
  +    
  +    <section name="Calling AspectJ goal automatically">
  +      <p>If you want to call the aspectj goal every time you compile
  +      add the following to your maven.xml file.
  +      </p>
  +      <source>
  +          <![CDATA[
  +           <preGoal name="java:compile">
  +             <attainGoal name="aspectj:compile"/>
  +           </preGoal>
  +          ]]>
  +      </source>
  +    </section>
  +
  +    <section name="Sample project">
  +      <source>
  +          <![CDATA[
  +<?xml version="1.0" encoding="UTF-8"?>
  +
  +<project>
  +
  +    <pomVersion>3</pomVersion>
  +    <groupId>examples</groupId>
  +    <id>example-with-aspects</id>
  +    <currentVersion>1.0</currentVersion>
  +
  +    <dependencies>
  +        <dependency>
  +            <groupId>company-jars</groupId>
  +            <artifactId>jar-one</artifactId>
  +            <version>1.0</version>
  +            <properties>
  +                <war.bundle>true</war.bundle>
  +            </properties>
  +        </dependency>
  +        <dependency>
  +            <groupId>company-aspects</groupId>
  +            <artifactId>example-aspects</artifactId>
  +            <version>1.0</version>
  +            <properties>
  +                <aspectj.weaveWith>true</aspectj.weaveWith>
  +            </properties>
  +        </dependency>
  +        <dependency>
  +            <groupId>company-jars</groupId>
  +            <artifactId>jar-two</artifactId>
  +            <version>1.0</version>
  +            <properties>
  +                <aspectj.weaveInto>true</aspectj.weaveInto>
  +            </properties>
  +        </dependency>
  +
  +        <!-- if you are creating a deployable file like a war you
  +             need to add the aspectjrt library -->
  +
  +        <dependency>
  +            <groupId>aspectj</groupId>
  +            <artifactId>aspectjrt</artifactId>
  +            <version>1.2rc1</version>
  +            <url>http://www.eclipse.org/aspectj</url>
  +            <properties>
  +                <war.bundle>true</war.bundle>
  +            </properties>
  +        </dependency>
  +
  +    </dependencies>
  +
  +    <build>
  +        <sourceDirectory>src/java</sourceDirectory>
  +        <aspectSourceDirectory>src/aspectj</aspectSourceDirectory>
  +    </build>
  +
  +</project>
  +          ]]>
  +      </source>
  +    </section>
  +
    </body>
   </document>
  
  
  
  1.6       +28 -83    maven-plugins/aspectj/xdocs/properties.xml
  
  Index: properties.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/xdocs/properties.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- properties.xml    4 Mar 2004 18:00:22 -0000       1.5
  +++ properties.xml    7 May 2004 19:19:10 -0000       1.6
  @@ -1,4 +1,5 @@
   <?xml version="1.0" encoding="ISO-8859-1"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  @@ -20,127 +21,71 @@
   <document>
   
     <properties>
  -    <title>Maven AspectJ Plugin Properties</title>
  +    <title>Maven AspectJ plugin Properties</title>
       <author email="[EMAIL PROTECTED]">dIon Gillard</author>
       <author email="[EMAIL PROTECTED]">Vincent Massol</author>
  +    <author email="[EMAIL PROTECTED]">Carlos Sanchez</author>
     </properties>
   
     <body>
       <section name="Maven AspectJ Plugin Settings">
  -<p>Todo. For the time being, please refer to the plugin.properties file
  -in the aspectj plugin directory.</p>
  -<!--
  -
         <table>
  +      
           <tr>
             <th>Property name</th>
             <th>Optional?</th>
             <th>Description</th>
           </tr>
  +        
           <tr>
  -          <td>maven.aspectj.ajc.option.emacssym</td>
  -          <td>Yes</td>
  -          <td>
  -            When set to <code>on</code>, instructs the AspectJ compiler
  -            to generate emacs symbols.  Users taking advantage of the
  -            AspectJ-emacs minor mode will want to specify this option.
  -            The default value is <code>off</code>.
  -          </td>
  -        </tr>
  -        <tr>
  -          <td>maven.compile.debug</td>
  -          <td>Yes</td>
  -          <td>
  -            Specifies whether to include debugging information in the
  -            compiled class files; the default value is <code>on</code>.
  -            Used by the "java:compile" goal.
  -          </td>
  -        </tr>
  -        <tr>
  -          <td>maven.compile.deprecation</td>
  -          <td>Yes</td>
  -          <td>
  -            Specifies whether source should be compiled with deprecation
  -            information; the default value is <code>off</code>.  Used by
  -            the "java:compile" goal.
  -          </td>
  -        </tr>
  -        <tr>
  -          <td>maven.compile.optimize</td>
  -          <td>Yes</td>
  -          <td>
  -            Specifies whether source should be compiled with optimization; the
  -            default value is <code>off</code>.  
  -            Used by the "java:compile" goal.
  -          </td>
  -        </tr>
  -        <tr>
  -          <td>maven.compile.src.set</td>
  +          <td>maven.aspectj.sourceRootCopyFilter</td>
             <td>Yes</td>
             <td>
  -            The source directories maven uses to compile java code.
  +            List of resource files to exclude when copying resources
  +            from the input jar to the weaved output jar.<br/>
  +            Default <code>**/CVS/*,**/*.java,**/*.aj</code>
             </td>
           </tr>
  +
           <tr>
  -          <td>pom.build.sourceModifications</td>
  +          <td>maven.aspectj.emacssym</td>
             <td>Yes</td>
             <td>
  -            This property is the list of the
  -                     <source><![CDATA[
  -<build>
  -  <sourceModification>
  -    <sourceModification>
  -      <className></className>
  -      <excludes>
  -        <exclude></exclude>
  -      </excludes>
  -    </sourceModification>
  -  </sourceModification>
  -</build>
  -]]></source>
  -           source modifications in your
  -           <a href="http://maven.apache.org/reference/project-descriptor.html";>
  -           project descriptor</a>. This property is used during compilation to 
exclude or
  -           include classes from compilation depending on whether a named class is 
available
  +            If true, emit .ajesym symbol files for Emacs support.<br/>
  +            Default <code>no</code>
             </td>
           </tr>
  -      </table>
  -    </section>
  -    <section name="Other properties used">
  -      <table>
  -        <tr>
  -          <th>Property name</th>
  -          <th>Optional?</th>
  -          <th>Description</th>
  -        </tr>
  +
           <tr>
  -          <td>sourcesPresent</td>
  +          <td>maven.aspectj.debug</td>
             <td>Yes</td>
             <td>
  -            This property is set by Maven to indicate the presence of
  -            Java source code for compilation. The plugin only attempts
  -            to compile AspectJ code if there is java source present.
  +            If true, run in debug mode.<br/>
  +            Default <code>false</code>
             </td>
           </tr>
  +
           <tr>
  -          <td>maven.build.dest</td>
  +          <td>maven.aspectj.verbose</td>
             <td>Yes</td>
             <td>
  -            The destination directory for compiled code
  +            If true, emit compiler status messages during the compile.<br/>
  +            Default <code>false</code>
             </td>
           </tr>
  +
           <tr>
  -          <td>maven.dependency.classpath</td>
  +          <td>maven.aspectj.incremental</td>
             <td>Yes</td>
             <td>
  -            This property holds the Ant <code>path</code> of all the dependent jar
  -            files listed in the <code>dependencies</code> block of your 
  -            <a href="http://maven.apache.org/reference/project-descriptor.html";>
  -            project descriptor</a>
  +            Incremental mode: Build once, then recompile only required source
  +            files when user provides input.<br/>
  +            Default <code>false</code>
             </td>
           </tr>
  +
         </table>
  --->
       </section>
  +
     </body>
   </document>
  
  
  
  1.30      +16 -12    maven-plugins/aspectj/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/project.xml,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- project.xml       2 May 2004 13:30:28 -0000       1.29
  +++ project.xml       7 May 2004 19:19:10 -0000       1.30
  @@ -23,9 +23,9 @@
     <pomVersion>3</pomVersion>
     <id>maven-aspectj-plugin</id>
     <name>Maven AspectJ Plug-in</name>
  -  <currentVersion>2.1-SNAPSHOT</currentVersion>
  +  <currentVersion>3.0-SNAPSHOT</currentVersion>
     <description/>
  -  <shortDescription>Eclipse Plugin for AspectJ</shortDescription>
  +  <shortDescription>AspectJ Plugin for Maven</shortDescription>
     <url>http://maven.apache.org/reference/plugins/aspectj/</url>
     
<issueTrackingUrl>http://jira.codehaus.org/BrowseProject.jspa?id=10320</issueTrackingUrl>
     <siteDirectory>/www/maven.apache.org/reference/plugins/aspectj/</siteDirectory>
  @@ -46,8 +46,8 @@
         <tag>MAVEN_ASPECTJ_2_0</tag>
       </version>
       <version>
  -      <id>2.1</id>
  -      <name>2.1</name>
  +      <id>3.0</id>
  +      <name>3.0</name>
         <tag>HEAD</tag>
       </version>
     </versions>
  @@ -74,22 +74,26 @@
         </roles>
       </developer>
     </developers>
  +  <contributors>
  +    <contributor>
  +      <name>Carlos Sanchez</name>
  +      <email>[EMAIL PROTECTED]</email>
  +    </contributor>
  +    <contributor>
  +      <name>Charlie Harvey</name>
  +      <email>[EMAIL PROTECTED]</email>
  +    </contributor>
  +  </contributors>
     <dependencies>
       <dependency>
         <groupId>aspectj</groupId>
         <artifactId>aspectjrt</artifactId>
  -      <version>1.1.0</version>
  -      <properties>
  -        <classloader>root</classloader>
  -      </properties>
  +      <version>1.2rc1</version>
       </dependency>
       <dependency>
         <groupId>aspectj</groupId>
         <artifactId>aspectjtools</artifactId>
  -      <version>1.1.0</version>
  -      <properties>
  -        <classloader>root</classloader>
  -      </properties>
  +      <version>1.2rc1</version>
       </dependency>
     </dependencies>
   </project>
  
  
  
  1.9       +84 -176   maven-plugins/aspectj/plugin.jelly
  
  Index: plugin.jelly
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/plugin.jelly,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- plugin.jelly      4 Mar 2004 18:00:21 -0000       1.8
  +++ plugin.jelly      7 May 2004 19:19:10 -0000       1.9
  @@ -1,4 +1,5 @@
   <?xml version="1.0"?>
  +
   <!-- 
   /*
    * Copyright 2001-2004 The Apache Software Foundation.
  @@ -17,59 +18,33 @@
    */
    -->
   
  -
   <!--
     =============================================================================
  -    AspectJ plugin for Maven. It offers 2 main features:
  -    - Ability to automatically weave aspects defined in 
  -      ${pom.build.aspectSourceDirectory}. This feature has no goal and is
  -      triggered automatically when the jar:jar goal is invoked if the 
  -      ${maven.aspectj.autoweave} property is set to true.
  -    - Generate a reusable aspect jar, by creating a jar of the aspects found 
  -      in ${pom.build.aspectSourceDirectory}. This is invoked through the
  -      aspectj:jar goal.
  -      
  -    TODO:
  -    - Need to add back the ajdoc goal
  -    - Try to find a solution to weave at the class level instead of at the jar
  -      level as some other plugins (like the war one) do not go through the
  -      jar:jar goal (they stop at the java:compile step).    
  -    - Add goals/properties xdoc documentation
  -    - Add other iajc attributes as plugin properties
  -    - Add a aspectj:jar-deploy goal
  +  AspectJ plugin for Maven.
  +
  +  TODO:
  +  - Need to add back the ajdoc goal
  +  - Add other iajc attributes as plugin properties
     =============================================================================
   -->
   
   <project
     xmlns:j="jelly:core"
  -  xmlns:ant="jelly:ant"
  -  xmlns:util="jelly:util">
  +  xmlns:ant="jelly:ant">
   
     <!--
  -     ========================================================================
  -       Default goal.
  -     ========================================================================
  +    ========================================================================
  +    Default goal.
  +    ========================================================================
     -->
  -  <goal name="aspectj" prereqs="aspectj:weave"
  -      description="Weave aspects in project jar"/>
  -
  -  <!--
  -     ========================================================================
  -       Automatic weaving on jar:jar if the ${maven.aspectj.autoweave} 
  -       property is set to true.
  -     ========================================================================
  -  -->
  -  <postGoal name="jar:jar">
  -    <attainGoal name="aspectj:init"/>
  -    <j:if test="${autoWeave == 'true'}">
  -      <attainGoal name="aspectj:weave-internal"/>
  -    </j:if>
  -  </postGoal>
  +  <goal name="aspectj" description="Weave with AspectJ">
  +      <attainGoal name="aspectj:compile"/>
  +  </goal>
   
     <!--
  -     ========================================================================
  -       Init AspectJ Ant task and global initializations.
  -     ========================================================================
  +    ========================================================================
  +    Init AspectJ Ant task and global initializations.
  +    ========================================================================
     -->
     <goal name="aspectj:init">
   
  @@ -79,155 +54,88 @@
         </ant:classpath>
       </ant:taskdef>
   
  -    <ant:available property="aspectSourcesPresent"
  -        file="${pom.build.aspectSourceDirectory}"/>
  +    <j:set var="shouldWeave" value="false"/>
  +
  +    <!-- Are there aspect sources -->
  +    <ant:available property="aspectSourcesPresent" 
file="${pom.build.aspectSourceDirectory}"/>
   
  -    <!-- Decide whether there is anything to weave -->
  -    <j:forEach var="artifact" items="${pom.artifacts}">
  -      <j:set var="dep" value="${artifact.dependency}"/>
  -      <j:if test="${dep.type == 'aspect'}">
  -        <j:set var="aspectLibrariesPresent" value="true"/>
  -      </j:if>
  -    </j:forEach>
  -    <ant:condition property="shouldWeave">
  -      <ant:or>
  -        <ant:isset property="aspectSourcesPresent"/>
  -        <ant:isset property="aspectLibrariesPresent"/>
  -      </ant:or>
  -    </ant:condition>
  -    
  -    <!-- Decide whether auto weave is on -->    
  -    <ant:condition property="autoWeave">
  -      <ant:and>
  -        <ant:isset property="shouldWeave"/>
  -        <ant:istrue value="${maven.aspectj.autoweave}"/>
  -      </ant:and>
  -    </ant:condition>
  +    <!-- If there aren't aspect sources check if there are aspect libraries -->
  +    <j:if test="${aspectSourcesPresent == null}">
  +      <j:forEach var="artifact" items="${pom.artifacts}">
  +        <j:set var="dep" value="${artifact.dependency}"/>
  +        <j:if test="${dep.getProperty('aspectj.weaveWith')=='true' and 
dep.type=='jar'}">
  +          <j:set var="aspectLibrariesPresent" value="true"/>
  +          <j:break/>
  +        </j:if>
  +        <j:if test="${dep.getProperty('aspectj.weaveInto')=='true' and 
dep.type=='jar'}">
  +          <j:set var="aspectLibrariesPresent" value="true"/>
  +          <j:break/>
  +        </j:if>
  +      </j:forEach>
  +    </j:if>
  +
  +    <j:if test="${(aspectSourcesPresent == 'true') || (aspectLibrariesPresent == 
'true')}">
  +      <j:set var="shouldWeave" value="true"/>
  +    </j:if>
   
     </goal>
   
     <!--
  -     ========================================================================
  -       Weave aspects in project jar
  -     ========================================================================
  +    ========================================================================
  +    Weave aspect classes
  +    ========================================================================
     -->
  -  <goal name="aspectj:weave" 
  -      prereqs="aspectj:init,jar:jar,aspectj:weave-internal"
  -      description="Weave aspects in project jar"/>
  -
  -  <!-- Private goal used to that when the jar:jar postgoal is called we don't
  -       have to call aspectj:init and jar:jar twice -->
  -  <goal name="aspectj:weave-internal">
  +  <goal name="aspectj:compile" prereqs="aspectj:init"
  +    description="Weave with AspectJ">
   
       <j:if test="${shouldWeave == 'true'}">
   
  -      <!-- Only weave if input jar has been modified. This is needed for
  -           the case when the user does a second run without changing 
  -           sources -->
  -      <ant:uptodate property="weaveNotRequired" 
  -          targetfile="${maven.aspectj.injar.nonweaved}">
  -        <ant:srcfiles dir="${pom.build.sourceDirectory}"/>
  -        <ant:srcfiles dir="${pom.build.aspectSourceDirectory}"/>
  -      </ant:uptodate>
  -
  -      <j:if test="${weaveNotRequired == null}">
  -    
  -        <!-- Rename input jar file to a temporary name so that we can use the 
  -             same name for the outjar -->
  -        <move file="${maven.aspectj.outjar}" 
  -          tofile="${maven.aspectj.injar.nonweaved}"/>
  -
  -        <!-- fork to avoid BCEL library version conflict with maven -->
  -        <ant:iajc fork="true" debug="${maven.aspectj.debug}"
  -            outjar="${maven.aspectj.outjar}"
  -            injars="${maven.aspectj.injar.nonweaved}"
  -            copyInjars="true"
  -            sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilters}"
  -            emacssym="${maven.aspectj.emacssym}">         
  -
  -          <ant:forkclasspath>
  -            <ant:pathelement 
path="${plugin.getDependencyPath('aspectj:aspectjtools')}"/>
  -          </ant:forkclasspath>
  -
  -          <ant:sourceroots>
  +      <ant:iajc fork="false"
  +          incremental="{maven.aspectj.incremental}"
  +          destDir="${maven.build.dest}"
  +          sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
  +          debug="${maven.aspectj.debug}"
  +          emacssym="${maven.aspectj.emacssym}"
  +          verbose="${maven.aspectj.verbose}">
  +
  +        <ant:sourceroots>
  +          <ant:path refid="maven.compile.src.set"/>
  +          <j:if test="${aspectSourcesPresent == 'true'}">
               <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
  -          </ant:sourceroots>
  +          </j:if>
  +        </ant:sourceroots>
   
  -          <ant:classpath>
  -            <ant:path refid="maven.dependency.classpath"/>
  -            <ant:pathelement 
path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  -          </ant:classpath>
  -
  -          <!-- Look for aspect libraries to use for weaving -->
  -          <ant:aspectpath>
  -            <j:forEach var="artifact" items="${pom.artifacts}">
  -              <j:set var="dep" value="${artifact.dependency}"/>
  -              <j:if test="${dep.type == 'aspect'}">
  -                <ant:pathelement location="${artifact.path}"/>
  -              </j:if>
  -            </j:forEach>
  -          </ant:aspectpath>
  +        <ant:classpath>
  +          <ant:path refid="maven.dependency.classpath"/>
  +          <ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  +          <ant:pathelement path="${maven.build.dest}"/>
  +        </ant:classpath>
  +
  +        <!-- Look for aspect libraries to use for weaving -->
  +        <ant:aspectpath>
  +          <j:forEach var="artifact" items="${pom.artifacts}">
  +            <j:set var="dep" value="${artifact.dependency}"/>
  +            <j:if test="${dep.getProperty('aspectj.weaveWith')=='true'}">
  +              <ant:echo>Weaving with: ${dep.artifactId}</ant:echo>
  +              <ant:pathelement location="${artifact.path}"/>
  +            </j:if>
  +          </j:forEach>
  +        </ant:aspectpath>
  +
  +        <!-- Look for libraries for weaving into -->
  +        <ant:inpath>
  +          <j:forEach var="artifact" items="${pom.artifacts}">
  +            <j:set var="dep" value="${artifact.dependency}"/>
  +            <j:if test="${dep.getProperty('aspectj.weaveInto')=='true'}">
  +              <ant:echo>Weaving into: ${dep.artifactId}</ant:echo>
  +              <ant:pathelement location="${artifact.path}"/>
  +            </j:if>
  +          </j:forEach>
  +        </ant:inpath>
   
  -        </ant:iajc>
  -      </j:if>
  -    </j:if>
  -        
  -  </goal>
  -
  -  <!--
  -     ========================================================================
  -       Generate a jar of reusable aspects found in 
  -       ${pom.build.aspectSourceDirectory}. This jar can then be uploaded to
  -       the remote repository to serve as reusable aspects for other projects.
  -     ========================================================================
  -  -->
  -  <goal name="aspectj:jar" prereqs="aspectj:init"
  -      description="Generate reusable aspect jar">
  +      </ant:iajc>
   
  -    <j:if test="${shouldWeave == 'true'}">
  -
  -      <!-- Only regenerate jar if aspect files have been modified. -->
  -      <ant:uptodate property="jarNotRequired" 
  -          targetfile="${maven.aspectj.library}">
  -        <ant:srcfiles dir="${pom.build.aspectSourceDirectory}"/>
  -      </ant:uptodate>
  -
  -      <j:if test="${jarNotRequired == null}">
  -        <!-- fork to avoid BCEL library version conflict with maven -->
  -        <ant:iajc fork="true" debug="${maven.aspectj.debug}"
  -            outjar="${maven.aspectj.library}"
  -            sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilters}"
  -            emacssym="${maven.aspectj.emacssym}">
  -          <ant:forkclasspath>
  -            <ant:pathelement 
path="${plugin.getDependencyPath('aspectj:aspectjtools')}"/>
  -          </ant:forkclasspath>
  -          <ant:sourceroots>
  -            <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
  -          </ant:sourceroots>
  -          <ant:classpath>
  -            <ant:path refid="maven.dependency.classpath"/>
  -            <ant:pathelement 
path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
  -          </ant:classpath>
  -        </ant:iajc>
  -      </j:if>
       </j:if>
     </goal>
     
  -  <!--
  -     ========================================================================
  -       Install the reusable aspects in the local repository.
  -     ========================================================================
  -  -->
  -  <goal name="aspectj:jar-install" prereqs="aspectj:jar"
  -      description="Install reusable aspect jar in local repository">
  -
  -    <j:if test="${shouldWeave == 'true'}">
  -      <ant:property name="aspectdir__" 
value="${maven.repo.local}/${pom.artifactDirectory}/aspects"/>
  -      <ant:mkdir dir="${aspectdir__}"/>    
  -      <ant:copy file="${maven.aspectj.library}" overwrite="true"
  -        todir="${aspectdir__}"/>
  -    </j:if>
  -    
  -  </goal>
  -    
   </project>
  
  
  
  1.4       +9 -18     maven-plugins/aspectj/plugin.properties
  
  Index: plugin.properties
  ===================================================================
  RCS file: /home/cvs/maven-plugins/aspectj/plugin.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- plugin.properties 4 Mar 2004 18:00:21 -0000       1.3
  +++ plugin.properties 7 May 2004 19:19:10 -0000       1.4
  @@ -18,21 +18,9 @@
   # Default properties for the AspectJ Plugin
   # -------------------------------------------------------------------
   
  -# If true, aspects located in ${pom.build.aspectSourceDirectory} will be
  -# weaved into the project java sources automatically upon invocation of
  -# the jar:jar goal.
  -maven.aspectj.autoweave = false
  -
  -# Name of the output jar containing the weaved aspects
  -maven.aspectj.outjar = ${maven.build.dir}/${maven.final.name}.jar
  -
  -# Name of non-weaved jar. The non-weaved jar (a.k.a input jar) will be
  -# moved to this name so that the new weaved jar can reuse the same name
  -maven.aspectj.injar.nonweaved = ${maven.build.dir}/${maven.final.name}-notweaved.jar
  -
  -# List of resource files to exclude when copying resources from the input jar
  -# to the weaved output jar
  -maven.aspectj.sourceRootCopyFilters = **/CVS/*,**/*.java,**/*.aj
  +# List of resource files to exclude when copying resources from the input 
  +# jar to the weaved output jar
  +maven.aspectj.sourceRootCopyFilter = **/CVS/*,**/*.java,**/*.aj
   
   # If true, emit .ajesym symbol files for Emacs support
   maven.aspectj.emacssym = no
  @@ -40,6 +28,9 @@
   # If true, run in debug mode
   maven.aspectj.debug = false
   
  -# Name of the output jar of reusable aspects. Used only in the
  -# aspectj:jar goal
  -maven.aspectj.library = 
${maven.build.dir}/${pom.artifactId}-aspects-${pom.currentVersion}.jar
  +# If true, emit compiler status messages during the compile. 
  +maven.aspectj.verbose = false
  +
  +# incremental mode: Build once, then recompile only required source files 
  +# when user provides input.
  +maven.aspectj.incremental = false
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to