- Ok, I think I now better understand how AW works. The plugin should be in a workable state for attribdef style. It has not been fully tested for xmldef style yet.
- The next step is probably to add support for executing java applications using the different AW bootstrapping mechanisms git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114510 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -3,6 +3,13 @@
|
||||
<!--
|
||||
=============================================================================
|
||||
AspectWerkz plugin for Maven.
|
||||
|
||||
Definition: AW supports 2 types of Aspects/Advice/Pointcuts definition:
|
||||
- xmldef : Advice are defined as extending *Advice classes (BeforeAdvice,
|
||||
AroundAdvice, etc). Custom javadoc attributes can be used to
|
||||
link code to weave with advices.
|
||||
- attribdef: Advices and pcds are defined purely using custom javadoc
|
||||
attributes (@Execute, @Aspect, etc).
|
||||
=============================================================================
|
||||
-->
|
||||
<project
|
||||
@@ -19,6 +26,26 @@
|
||||
|
||||
<ant:mkdir dir="${maven.build.dir}"/>
|
||||
|
||||
<!-- Location of the XML definition file. If "xmldef" mode is used, then
|
||||
the location of thus file is the location where attributec has
|
||||
generated its xml file
|
||||
(i.e. ${maven.aspectwerkz.build.definition.file}). If "attribdef"
|
||||
mode is used then this property should point to its source
|
||||
location. -->
|
||||
<j:choose>
|
||||
<j:when test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
|
||||
<j:set var="maven.aspectwerkz.definition.file"
|
||||
value="${maven.aspectwerkz.definition.file.build}"/>
|
||||
</j:when>
|
||||
<j:when test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
|
||||
<j:set var="maven.aspectwerkz.definition.file"
|
||||
value="${maven.aspectwerkz.definition.file.src}"/>
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<ant:fail>Valid values for [maven.aspectwerkz.mode] are [xmldef] and [attribdef] only.</ant:fail>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
<path id="classpath.main">
|
||||
<ant:pathelement location="${maven.dependency.classpath}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz')}"/>
|
||||
@@ -30,72 +57,134 @@
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Compile AW javadoc attributes.
|
||||
Compile javadoc attributes and generate an XML definition file. Used
|
||||
only in xmldef mode.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectwerkz:attributec" prereqs="aspectwerkz:init"
|
||||
description="Compile AspectWerkz javadoc attributes">
|
||||
description="Compile AspectWerkz javadoc attributes (xml-defined aspects)">
|
||||
|
||||
<!-- TODO: only run attributeC if sources are newer than target
|
||||
XML definition file -->
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
|
||||
|
||||
<!-- TODO: only run attributeC if sources are newer than target
|
||||
XML definition file -->
|
||||
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.metadata.AttributeC">
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.metadata.AttributeC">
|
||||
|
||||
<ant:sysproperty key="aspectwerkz.definition.validate"
|
||||
value="${maven.aspectwerkz.definition.validate}"/>
|
||||
<ant:sysproperty key="aspectwerkz.definition.validate"
|
||||
value="${maven.aspectwerkz.definition.validate}"/>
|
||||
|
||||
<ant:arg file="${maven.aspectwerkz.src.dir}"/>
|
||||
<ant:arg file="${maven.aspectwerkz.build.definition.file}"/>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.definition.merge.file') != null}">
|
||||
<ant:arg line="-m ${maven.aspectwerkz.definition.merge.file}"/>
|
||||
</j:if>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.uuid') != null}">
|
||||
<ant:arg line="-u ${maven.aspectwerkz.uuid}"/>
|
||||
</j:if>
|
||||
<ant:arg file="${maven.aspectwerkz.src.dir}"/>
|
||||
<ant:arg file="${maven.aspectwerkz.definition.file}"/>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.definition.file.merge') != null}">
|
||||
<ant:arg line="-m ${maven.aspectwerkz.definition.file.merge}"/>
|
||||
</j:if>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.uuid') != null}">
|
||||
<ant:arg line="-u ${maven.aspectwerkz.uuid}"/>
|
||||
</j:if>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('jrexx:jrexx')}"/>
|
||||
</ant:classpath>
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('jrexx:jrexx')}"/>
|
||||
</ant:classpath>
|
||||
|
||||
</ant:java>
|
||||
</ant:java>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Tranform source code by weaving aspects to them (offline mode).
|
||||
Weave aspects at build time (offline mode). Works for both "xmldef"
|
||||
and "attribdef" modes.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectwerkz:transform"
|
||||
prereqs="aspectwerkz:init,aspectwerkz:attributec,java:compile"
|
||||
description="Weave aspects to sources (offline mode)">
|
||||
<goal name="aspectwerkz:weave"
|
||||
prereqs="aspectwerkz:aspectc,aspectwerkz:aspectwerkc"
|
||||
description="Weave aspects (offline mode)"/>
|
||||
|
||||
<!-- TODO: Add support for extension classes -->
|
||||
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC">
|
||||
<!--
|
||||
========================================================================
|
||||
Weave "attribdef" aspects at build time (offline mode).
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectwerkz:aspectc" prereqs="aspectwerkz:init,java:compile">
|
||||
|
||||
<ant:sysproperty key="aspectwerkz.transform.verbose"
|
||||
value="${maven.aspectwerkz.transform.verbose}"/>
|
||||
<ant:sysproperty key="aspectwerkz.transform.filter"
|
||||
value="${maven.aspectwerkz.transform.filter}"/>
|
||||
<ant:sysproperty key="aspectwerkz.definition.file"
|
||||
value="${maven.aspectwerkz.definition.file}"/>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
|
||||
|
||||
<ant:arg value="-verify"/>
|
||||
<ant:arg file="${maven.build.dest}"/>
|
||||
<!-- TODO: only run aspectc if sources are newer than target
|
||||
XML definition file -->
|
||||
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.attribdef.definition.AspectC">
|
||||
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.verbose') == 'true'}">
|
||||
<ant:arg value="-verbose"/>
|
||||
</j:if>
|
||||
|
||||
<!-- Path to source dir -->
|
||||
<ant:arg file="${maven.aspectwerkz.src.dir}"/>
|
||||
|
||||
<!-- Path to classes dir -->
|
||||
<ant:arg file="${maven.build.dest}"/>
|
||||
|
||||
<!-- (optional) Path to where weaved classes will be generated -->
|
||||
<ant:arg file="${maven.aspectwerkz.build.dir}"/>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('qdox:qdox')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
|
||||
</ant:classpath>
|
||||
|
||||
</ant:java>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Weave "xmldef" aspects at build time (offline mode).
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectwerkz:aspectwerkc"
|
||||
prereqs="aspectwerkz:init,aspectwerkz:attributec,java:compile">
|
||||
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'xmldef'}">
|
||||
|
||||
<!-- TODO: Add support for extension classes -->
|
||||
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.compiler.AspectWerkzC">
|
||||
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.verbose') == 'true'}">
|
||||
<ant:sysproperty key="aspectwerkz.transform.verbose" value="true"/>
|
||||
</j:if>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
|
||||
</ant:classpath>
|
||||
<ant:sysproperty key="aspectwerkz.transform.filter"
|
||||
value="${maven.aspectwerkz.transform.filter}"/>
|
||||
<ant:sysproperty key="aspectwerkz.definition.file"
|
||||
value="${maven.aspectwerkz.definition.file}"/>
|
||||
|
||||
<ant:arg value="-verify"/>
|
||||
|
||||
<ant:arg file="${maven.aspectwerkz.build.dir}"/>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('aspectwerkz:aspectwerkz-core')}"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('bcel:bcel')}"/>
|
||||
</ant:classpath>
|
||||
|
||||
</ant:java>
|
||||
</ant:java>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
|
||||
@@ -1,22 +1,52 @@
|
||||
#============================================================================
|
||||
# Properties for the AspectWerkz plugin for Maven
|
||||
# ===========================================================================
|
||||
|
||||
# AW supports 2 types of Aspects/Advice/Pointcuts definition:
|
||||
# - xmldef : Advice are defined as extending *Advice classes (BeforeAdvice,
|
||||
# AroundAdvice, etc). Custom javadoc attributes can be used to
|
||||
# link code to weave with advices.
|
||||
# - attribdef: Advices and pcds are defined purely using custom javadoc
|
||||
# attributes (@Execute, @Aspect, etc).
|
||||
# You need to tell the plugin how you have defined your AW
|
||||
# Aspects/Advices/Pointcuts. The 2 valid values are "xmldef" and "attribdef".
|
||||
maven.aspectwerkz.mode = attribdef
|
||||
|
||||
# Location of AW sources
|
||||
maven.aspectwerkz.src.dir = ${basedir}/src/main
|
||||
|
||||
# Location of the AW XML definition file that will be created by the
|
||||
# attribute compilation (when calling <aspectwerkz:attributeC>).
|
||||
maven.aspectwerkz.build.definition.file = ${maven.build.dir}/aspectwerkz.xml
|
||||
# Location where weaved classes will be generated.
|
||||
maven.aspectwerkz.build.dir = ${maven.build.dest}
|
||||
|
||||
# Decide whether definition validation is turned on or off.
|
||||
maven.aspectwerkz.definition.validate = false
|
||||
|
||||
maven.aspectwerkz.definition.file = ${maven.aspectwerkz.build.definition.file}
|
||||
# Verbose mode
|
||||
maven.aspectwerkz.verbose = false
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# attribdef mode properties
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Location of the XML definition file.
|
||||
maven.aspectwerkz.definition.file.src = ${basedir}/conf/aspectwerkz.xml
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# xmldef mode properties
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Location of the AW XML definition file that will be created by the
|
||||
# attribute compilation (when calling <aspectwerkz:attributeC>). This is only
|
||||
# used in "xmldef" mode.
|
||||
maven.aspectwerkz.definition.file.build = ${maven.build.dir}/aspectwerkz.xml
|
||||
|
||||
# TODO: explain property here
|
||||
maven.aspectwerkz.transform.filter = no
|
||||
maven.aspectwerkz.transform.verbose = no
|
||||
|
||||
# (optional). Definition file to be merged with the main definition file.
|
||||
# Used by the <aspectwerkz:attributeC> goal.
|
||||
# maven.aspectwerkz.definition.merge.file =
|
||||
# Used by the <aspectwerkz:attributeC> goal. Only for "xmldef" mode.
|
||||
# maven.aspectwerkz.definition.file.merge =
|
||||
|
||||
# (optional). UUID to use. If not specified a default one will be automatically
|
||||
# generated. Used by the <aspectwerkz:attributeC> goal.
|
||||
# generated. Used by the <aspectwerkz:attributeC> goal. Only for "xmldef" mode.
|
||||
# maven.aspectwerkz.uuid =
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<goal name="testPlugin">
|
||||
<attainGoal name="clean"/>
|
||||
<attainGoal name="aspectwerkz:transform"/>
|
||||
<attainGoal name="aspectwerkz:weave"/>
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
@@ -2,7 +2,4 @@
|
||||
# P R O J E C T P R O P E R T I E S
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
maven.aspectwerkz.uuid = test
|
||||
maven.aspectwerkz.definition.merge.file = ${basedir}/conf/aspectwerkz.xml
|
||||
maven.aspectwerkz.definition.validate = true
|
||||
maven.aspectwerkz.transform.verbose = yes
|
||||
maven.aspectwerkz.verbose = true
|
||||
|
||||
@@ -10,13 +10,16 @@
|
||||
<goal>
|
||||
<name>aspectwerkz:attributec</name>
|
||||
<description>
|
||||
Compile AspectWerkz javadoc attributes.
|
||||
Compile AspectWerkz javadoc attributes for xml-defined aspects
|
||||
(i.e. <code>maven.aspectwerkz.mode = xmldef</code>).
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>aspectwerkz:transform</name>
|
||||
<name>aspectwerkz:weave</name>
|
||||
<description>
|
||||
Weaves aspects on byte code (offline mode).
|
||||
Weave aspects at build time (offline mode). Works for both "xmldef"
|
||||
(<code>maven.aspectwerkz.mode = xmldef</code>) and "attribdef"
|
||||
(<code>maven.aspectwerkz.mode = attribdef</code>) modes.
|
||||
</description>
|
||||
</goal>
|
||||
</goals>
|
||||
|
||||
@@ -6,29 +6,51 @@
|
||||
<author email="vmassol@apache.org">Vincent Massol</author>
|
||||
</properties>
|
||||
<body>
|
||||
<section name="AspectWerkz properties">
|
||||
<section name="AspectWerkz generic properties">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.mode</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
AW supports 2 types of Aspects/Advice/Pointcuts definition:
|
||||
<ul>
|
||||
<li>
|
||||
<strong>xmldef</strong>: Advice are defined as extending
|
||||
*Advice classes (BeforeAdvice, AroundAdvice, etc). Custom
|
||||
javadoc attributes can be used to link code to weave with
|
||||
advices.
|
||||
</li>
|
||||
<li>
|
||||
<strong>attribdef</strong>: Advices and pcds are defined
|
||||
purely using custom javadoc attributes (@Execute, @Aspect,
|
||||
etc).
|
||||
</li>
|
||||
</ul>
|
||||
You need to tell the plugin how you have defined your AW
|
||||
Aspects/Advices/Pointcuts. The 2 valid values are
|
||||
<code>xmldef</code> and <code>attribdef</code>.
|
||||
The default value is <code>attribdef</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.src.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location of aspect sources. Default location is
|
||||
<code>${basedir}/src/aspectwerkz</code>.
|
||||
<code>${basedir}/src/main</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.build.definition.file</td>
|
||||
<td>maven.aspectwerkz.build.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location of the AW XML definition file that will be created by the
|
||||
attribute compilation (when calling the
|
||||
<code>aspectwerkz:attributeC</code> goal). Defaults to
|
||||
<code>${maven.build.dir}/aspectwerkz.xml</code>.
|
||||
Location where weaved classes will be generated. Default to
|
||||
<code>${maven.build.dest}</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -40,7 +62,54 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.definition.merge.file</td>
|
||||
<td>maven.aspectwerkz.verbose</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Decide whether to use verbose output or not during execution of
|
||||
this plugin's goals. Defaults to <code>false</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section name="AspectWerkz properties specific to 'attribdef' mode">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.definition.file.src</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location of the XML definition file. Default to
|
||||
<code>${basedir}/conf/aspectwerkz.xml</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section name="AspectWerkz properties specific to 'xmldef' mode">
|
||||
<table>
|
||||
<tr>
|
||||
<th>Property</th>
|
||||
<th>Optional?</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.definition.file.build</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location of the AW XML definition file that will be created by the
|
||||
attribute compilation (when calling the
|
||||
<code>aspectwerkz:attributec</code> goal). This is only used in
|
||||
<code>xmldef</code> mode. Defaults to
|
||||
<code>${maven.build.dir}/aspectwerkz.xml</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.definition.file.merge</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Definition file to be merged with the main definition file.
|
||||
@@ -55,6 +124,13 @@
|
||||
automatically generated. This property is not defined by default.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.transform.filter</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
TODO: explain property here. Defaults to <code>no</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user