- 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
192 lines
7.3 KiB
XML
192 lines
7.3 KiB
XML
<?xml version="1.0"?>
|
|
|
|
<!--
|
|
=============================================================================
|
|
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
|
|
xmlns:ant="jelly:ant"
|
|
xmlns:j="jelly:core"
|
|
xmlns:util="jelly:util">
|
|
|
|
<!--
|
|
========================================================================
|
|
Init.
|
|
========================================================================
|
|
-->
|
|
<goal name="aspectwerkz:init">
|
|
|
|
<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')}"/>
|
|
<ant:pathelement location="${plugin.getDependencyPath('dom4j:dom4j')}"/>
|
|
<ant:pathelement location="${plugin.getDependencyPath('trove:trove')}"/>
|
|
</path>
|
|
|
|
</goal>
|
|
|
|
<!--
|
|
========================================================================
|
|
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 (xml-defined aspects)">
|
|
|
|
<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:sysproperty key="aspectwerkz.definition.validate"
|
|
value="${maven.aspectwerkz.definition.validate}"/>
|
|
|
|
<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:java>
|
|
|
|
</j:if>
|
|
|
|
</goal>
|
|
|
|
<!--
|
|
========================================================================
|
|
Weave aspects at build time (offline mode). Works for both "xmldef"
|
|
and "attribdef" modes.
|
|
========================================================================
|
|
-->
|
|
<goal name="aspectwerkz:weave"
|
|
prereqs="aspectwerkz:aspectc,aspectwerkz:aspectwerkc"
|
|
description="Weave aspects (offline mode)"/>
|
|
|
|
<!--
|
|
========================================================================
|
|
Weave "attribdef" aspects at build time (offline mode).
|
|
========================================================================
|
|
-->
|
|
<goal name="aspectwerkz:aspectc" prereqs="aspectwerkz:init,java:compile">
|
|
|
|
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
|
|
|
|
<!-- 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: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>
|
|
|
|
</j:if>
|
|
|
|
</goal>
|
|
|
|
</project>
|