You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by vm...@apache.org on 2003/09/21 23:22:02 UTC
cvs commit: maven/src/plugins-build/aspectj plugin.properties project.xml plugin.jelly
vmassol 2003/09/21 14:22:01
Modified: src/plugins-build/aspectj/xdocs properties.xml changes.xml
goals.xml index.xml
src/plugins-build/aspectj plugin.properties project.xml
plugin.jelly
Log:
Complete rewrite of the plugin. Now using AspectJ 1.1 and performing binary weaving on jar generated by the <code>jar:jar</code> goal. Also supports creation and weaving-in of reusable aspect libraries.
Revision Changes Path
1.4 +6 -0 maven/src/plugins-build/aspectj/xdocs/properties.xml
Index: properties.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/xdocs/properties.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- properties.xml 26 May 2003 15:43:49 -0000 1.3
+++ properties.xml 21 Sep 2003 21:22:01 -0000 1.4
@@ -4,10 +4,15 @@
<properties>
<title>Maven AspectJ Plugin Properties</title>
<author email="dion@multitask.com.au">dIon Gillard</author>
+ <author email="vmassol@pivolis.com">Vincent Massol</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>
@@ -117,6 +122,7 @@
</td>
</tr>
</table>
+-->
</section>
</body>
</document>
1.3 +8 -1 maven/src/plugins-build/aspectj/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/xdocs/changes.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- changes.xml 21 Sep 2003 13:33:28 -0000 1.2
+++ changes.xml 21 Sep 2003 21:22:01 -0000 1.3
@@ -3,15 +3,22 @@
<properties>
<title>Changes</title>
<author email="dion@multitask.com.au">dIon Gillard</author>
+ <author email="vmassol@pivolis.com">Vincent Massol</author>
</properties>
<body>
+ <release version="2.0" date="in CVS">
+ <action dev="vmassol" type="add">
+ Complete rewrite of the plugin. Now using AspectJ 1.1 and performing
+ binary weaving on jar generated by the <code>jar:jar</code> goal. Also
+ supports creation and weaving-in of reusable aspect libraries.
+ </action>
+ </release>
<release version="1.1" date="2003-09-21">
<action dev="dion" type="add">
Added documentation for navigation, changes, properties and goals
</action>
</release>
-
<release version="1.0" date="2002-07-16">
<action dev="jvanzyl" type="add">
Original release for Maven 1.0-beta6
1.3 +4 -0 maven/src/plugins-build/aspectj/xdocs/goals.xml
Index: goals.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/xdocs/goals.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- goals.xml 19 Mar 2003 05:54:17 -0000 1.2
+++ goals.xml 21 Sep 2003 21:22:01 -0000 1.3
@@ -8,6 +8,9 @@
<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>
@@ -37,6 +40,7 @@
</td>
</tr>
</table>
+-->
</section>
</body>
</document>
1.2 +13 -2 maven/src/plugins-build/aspectj/xdocs/index.xml
Index: index.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/xdocs/index.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.xml 24 Jan 2003 03:44:37 -0000 1.1
+++ index.xml 21 Sep 2003 21:22:01 -0000 1.2
@@ -4,14 +4,25 @@
<properties>
<title>Maven AspectJ Plug-in</title>
<author email="dion@multitask.com.au">dIon Gillard</author>
+ <author email="vmassol@pivolis.com">Vincent Massol</author>
</properties>
<body>
<section name="Maven AspectJ Plug-in">
<p>
- This plugin provides the basic facilities for compiling
- code using AspectJ.
+ AspectJ plugin for Maven. It offers the following features:
</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.
1.2 +29 -1 maven/src/plugins-build/aspectj/plugin.properties
Index: plugin.properties
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/plugin.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- plugin.properties 26 May 2003 15:43:49 -0000 1.1
+++ plugin.properties 21 Sep 2003 21:22:01 -0000 1.2
@@ -1 +1,29 @@
-maven.aspectj.ajc.option.emacssym=no
+# -------------------------------------------------------------------
+# 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
+
+# If true, emit .ajesym symbol files for Emacs support
+maven.aspectj.emacssym = no
+
+# 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
1.18 +9 -12 maven/src/plugins-build/aspectj/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/project.xml,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- project.xml 21 Sep 2003 13:47:23 -0000 1.17
+++ project.xml 21 Sep 2003 21:22:01 -0000 1.18
@@ -5,7 +5,7 @@
<pomVersion>3</pomVersion>
<id>maven-aspectj-plugin</id>
<name>Maven AspectJ Plug-in</name>
- <currentVersion>1.1</currentVersion>
+ <currentVersion>2.0-SNAPSHOT</currentVersion>
<description/>
<shortDescription>Eclipse Plugin for AspectJ</shortDescription>
<url>http://maven.apache.org/reference/plugins/aspectj/</url>
@@ -20,6 +20,11 @@
<name>1.1</name>
<tag>MAVEN_ASPECTJ_1_1</tag>
</version>
+ <version>
+ <id>2.0</id>
+ <name>2.0</name>
+ <tag>HEAD</tag>
+ </version>
</versions>
<developers>
<developer>
@@ -57,23 +62,15 @@
<dependency>
<groupId>aspectj</groupId>
<artifactId>aspectjrt</artifactId>
- <version>1.0.6</version>
- <properties>
- <classloader>root</classloader>
- </properties>
- </dependency>
- <dependency>
- <groupId>aspectj</groupId>
- <artifactId>aspectj-ant</artifactId>
- <version>1.0.6</version>
+ <version>1.1.0</version>
<properties>
<classloader>root</classloader>
</properties>
</dependency>
<dependency>
<groupId>aspectj</groupId>
- <artifactId>aspectj-tools</artifactId>
- <version>1.0.6</version>
+ <artifactId>aspectjtools</artifactId>
+ <version>1.1.0</version>
<properties>
<classloader>root</classloader>
</properties>
1.5 +180 -106 maven/src/plugins-build/aspectj/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/aspectj/plugin.jelly,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- plugin.jelly 26 May 2003 15:43:49 -0000 1.4
+++ plugin.jelly 21 Sep 2003 21:22:01 -0000 1.5
@@ -1,132 +1,206 @@
<?xml version="1.0"?>
-<project xmlns:j="jelly:core"
- xmlns:ant="jelly:ant"
- xmlns:util="jelly:util">
-
- <!--==================================================================-->
- <!-- Compile all source code, weaving the Aspects -->
- <!--==================================================================-->
- <goal name="aspectj"
- description="Compile code with AspectJ"
- prereqs="aspectj:compile"/>
-
- <goal name="aspectj:compile"
- description="Compile code with AspectJ">
-
- <j:if test="${sourcesPresent == 'true'}">
+<!--
+ =============================================================================
+ 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.
+ =============================================================================
+-->
+
+<project
+ xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant"
+ xmlns:util="jelly:util">
+
+ <!--
+ ========================================================================
+ 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>
- <ant:taskdef name="ajc" classname="org.aspectj.tools.ant.taskdefs.Ajc"/>
+ <!--
+ ========================================================================
+ Init AspectJ Ant task and global initializations.
+ ========================================================================
+ -->
+ <goal name="aspectj:init">
+
+ <ant:taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
+ <ant:classpath>
+ <ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjtools')}"/>
+ </ant:classpath>
+ </ant:taskdef>
- <ant:available property="aspectSourcesPresent"
+ <ant:available property="aspectSourcesPresent"
file="${pom.build.aspectSourceDirectory}"/>
- <ant:uptodate property="aspectj.compile.notRequired"
- targetfile="${maven.build.dir}/${maven.final.name}.jar">
+ <!-- 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>
+
+ </goal>
+
+ <!--
+ ========================================================================
+ Weave aspects in project jar
+ ========================================================================
+ -->
+ <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">
+
+ <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}"/>
- <j:if test="${aspectSourcesPresent == 'true'}">
- <ant:srcfiles dir="${pom.build.aspectSourceDirectory}"/>
- </j:if>
+ <ant:srcfiles dir="${pom.build.aspectSourceDirectory}"/>
</ant:uptodate>
- <j:set var="aspectjCompileNotRequired" value="${aspectj.compile.notRequired}"/>
- <j:if test="${aspectjCompileNotRequired == null}">
+ <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:pathelement location="${pom.build.aspectSourceDirectory}"/>
+ </ant:sourceroots>
- <j:set
- var="ajcEmacssymFlag"
- value="${maven.aspectj.ajc.option.emacssym}"/>
-
- <ant:ajc
- destdir="${maven.build.dest}"
- excludes="**/package.html"
- debug="${maven.compile.debug}"
- deprecation="${maven.compile.deprecation}"
- optimize="${maven.compile.optimize}"
- emacssym="${ajcEmacssymFlag}">
-
- <ant:src>
- <ant:path refid="maven.compile.src.set"/>
- <j:if test="${aspectSourcesPresent == 'true'}">
- <ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
- </j:if>
- </ant:src>
-
- <j:forEach var="sm" items="${pom.build.sourceModifications}">
- <ant:available property="classPresent" classname="${sm.className}"/>
- <j:if test="${classPresent != 'true'}">
- <j:forEach var="exclude" items="${sm.excludes}">
- <ant:exclude name="${exclude}"/>
- </j:forEach>
- </j:if>
- </j:forEach>
-
<ant:classpath>
<ant:path refid="maven.dependency.classpath"/>
- <ant:pathelement path="${maven.build.dest}"/>
<ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
</ant:classpath>
- </ant:ajc>
- </j:if>
+ <!-- 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>
- </j:if>
-
+ </ant:iajc>
+ </j:if>
+ </j:if>
+
</goal>
- <goal name="aspectj:ajdoc" description="Javadoc source using ajdoc">
-
- <j:if test="${sourcesPresent == 'true'}">
-
- <ant:taskdef name="ajdoc" classname="org.aspectj.tools.ant.taskdefs.Ajdoc" />
+ <!--
+ ========================================================================
+ 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">
+
+ <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>
- <ant:available property="aspectSourcesPresent"
- file="${pom.build.aspectSourceDirectory}"/>
-
- <!-- retrieve various javadoc plugin vars -->
- <util:tokenize var="javadocVarList" delim=",">
- maven.javadoc.author,maven.javadoc.destdir,
- maven.javadoc.links,maven.javadoc.maxmemory,
- maven.javadoc.private,maven.javadoc.stylesheet,
- maven.javadoc.use,maven.javadoc.version
- </util:tokenize>
-
- <j:forEach var="javadocVar" items="${javadocVarList}">
- <j:set var="javadocVar" value="${javadocVar.trim()}" />
- <j:set var="${javadocVar}"
- value="${pom.getPluginContext('maven-javadoc-plugin').getVariable(javadocVar)}"/>
- </j:forEach>
-
- <ant:ajdoc packagenames="${pom.package}.*"
- destdir="${maven.javadoc.destdir}"
- author="${maven.javadoc.author}"
- private="${maven.javadoc.private}"
- version="${maven.javadoc.version}"
- use="${maven.javadoc.use}"
- windowtitle="${title}"
- doctitle="${title}"
- bottom="${copyright}"
- stylesheetfile="${maven.javadoc.stylesheet}">
-
- <j:forEach var="link" items="${links}">
- <ant:link href="${link.trim()}"/>
- </j:forEach>
+ <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:path location="${maven.build.dest}"/>
<ant:pathelement path="${plugin.getDependencyPath('aspectj:aspectjrt')}"/>
</ant:classpath>
-
- <ant:sourcepath>
- <ant:path refid="maven.compile.src.set"/>
- <j:if test="${aspectSourcesPresent == 'true'}">
- <pathelement location="${pom.build.aspectSourceDirectory}"/>
- </j:if>
- </ant:sourcepath>
-
- </ant:ajdoc>
-
+ </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>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org