- Allowed weaving to a different directory than ${maven.build.dest}
- Fixed AspectWerkzC usage. I was wrongly weaving all dependent jars... :-) I believe the plugin now works for Attribdef offline mode. I haven't tried the other use cases. git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@114592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -185,8 +185,6 @@
|
||||
<!-- TODO: only run aspectc if sources are newer than target
|
||||
XML definition file -->
|
||||
|
||||
<ant:mkdir dir="${maven.aspectwerkz.weave.build.dir}"/>
|
||||
|
||||
<!-- Transforming Ant path structure into a list of dirs that can be used
|
||||
to define an Ant fileset. We're using <pathconvert> to automatically
|
||||
separate dirs with a known delimiter independently of any
|
||||
@@ -206,10 +204,11 @@
|
||||
classSrc="${maven.aspectwerkz.build.dest}"/>
|
||||
</j:if>
|
||||
|
||||
<!-- AspectC currently has a bug in that it creates a java.lang.Object class file in the output directory. Until
|
||||
this is fixed, we need to remove that files. Otherwise, AspectWerkc will try to instrument it, which will
|
||||
lead to an error... -->
|
||||
<ant:delete file="${maven.aspectwerkz.weave.build.dir}/java/lang/Object.class"/>
|
||||
<!-- AspectC currently has a bug in that it creates a java.lang.Object
|
||||
class file in the output directory. Until this is fixed, we need to
|
||||
remove that files. Otherwise, AspectWerkc will try to instrument it,
|
||||
which will lead to an error... -->
|
||||
<ant:delete file="${maven.aspectwerkz.aspectc.build.dir}/java/lang/Object.class"/>
|
||||
|
||||
</j:if>
|
||||
|
||||
@@ -227,32 +226,49 @@
|
||||
|
||||
<!-- TODO: Add support for extension classes -->
|
||||
|
||||
<!-- Create a path for the -cp parameter of the AspectWerkzC class -->
|
||||
<ant:path id="aspectwerkzc.cp">
|
||||
<!-- Search for aspect libraries to weave to the source code. These are
|
||||
defined as dependencies in project.xml -->
|
||||
<j:forEach var="artifact" items="${pom.artifacts}">
|
||||
<j:set var="dep" value="${artifact.dependency}"/>
|
||||
<j:if test="${dep.getProperty('aspectwerkz.library') == 'true'}">
|
||||
<ant:pathelement location="${artifact.path}"/>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
</ant:path>
|
||||
<ant:property name="aspectwerkzcp" refid="aspectwerkzc.cp"/>
|
||||
|
||||
<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.classloader.preprocessor"
|
||||
value="${aspectwerkz.classloader.preprocessor}"/>
|
||||
|
||||
<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 value="-haltOnError"/>
|
||||
|
||||
<ant:arg file="${maven.aspectwerkz.weave.build.dir}"/>
|
||||
<j:if test="${!empty(aspectwerkzcp)}">
|
||||
<ant:arg line="-cp ${aspectwerkzcp}"/>
|
||||
</j:if>
|
||||
|
||||
<!-- If using the attribdef mode, weave classes generated by aspectc -->
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
|
||||
<ant:arg file="${maven.aspectwerkz.aspectc.build.dir}"/>
|
||||
</j:if>
|
||||
|
||||
<!-- TODO: Add support for xmldef mode -->
|
||||
|
||||
<!-- Search for aspect libraries to weave to the source code. These are
|
||||
defined as dependencies in project.xml -->
|
||||
<j:forEach var="artifact" items="${pom.artifacts}">
|
||||
<j:set var="dep" value="${artifact.dependency}"/>
|
||||
<j:if test="${dep.getProperty('aspectwerkz.library') == 'true'}">
|
||||
<ant:arg file="${artifact.path}"/>
|
||||
</j:if>
|
||||
</j:forEach>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
<ant:pathelement location="${plugin.getDependencyPath('ant:ant')}"/>
|
||||
@@ -264,6 +280,14 @@
|
||||
|
||||
</ant:java>
|
||||
|
||||
<!-- Copy weaved classes to target directory -->
|
||||
<ant:mkdir dir="${maven.aspectwerkz.weave.build.dir}"/>
|
||||
<j:if test="${context.getVariable('maven.aspectwerkz.mode') == 'attribdef'}">
|
||||
<ant:copy todir="${maven.aspectwerkz.weave.build.dir}">
|
||||
<ant:fileset dir="${maven.aspectwerkz.aspectc.build.dir}"/>
|
||||
</ant:copy>
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
@@ -281,6 +305,8 @@
|
||||
<define:tag name="aspectc">
|
||||
|
||||
<ant:echo>Parsing [${javaSrc}] using [${classSrc}] ...</ant:echo>
|
||||
|
||||
<ant:mkdir dir="${maven.aspectwerkz.aspectc.build.dir}"/>
|
||||
|
||||
<ant:java dir="${maven.build.dir}" failonerror="true" fork="true"
|
||||
classname="org.codehaus.aspectwerkz.attribdef.definition.AspectC">
|
||||
@@ -295,8 +321,8 @@
|
||||
<!-- Path to classes dir -->
|
||||
<ant:arg file="${classSrc}"/>
|
||||
|
||||
<!-- (optional) Path to where weaved classes will be generated -->
|
||||
<ant:arg file="${maven.aspectwerkz.weave.build.dir}"/>
|
||||
<!-- (optional) Path to where aspectc result will be put -->
|
||||
<ant:arg file="${maven.aspectwerkz.aspectc.build.dir}"/>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="classpath.main"/>
|
||||
|
||||
@@ -21,6 +21,9 @@ maven.aspectwerkz.definition.validate = false
|
||||
# Verbose mode
|
||||
maven.aspectwerkz.verbose = false
|
||||
|
||||
# Classloader to use for class files weaving
|
||||
aspectwerkz.classloader.preprocessor = org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor
|
||||
|
||||
# (optional) The AW plugin looks for source files in ${pom.sourceDirectory}.
|
||||
# It also supports all source directories added to the ${maven.compile.src.set}
|
||||
# Ant path variable. Moreover, if you wish to keep non-production aspects in a
|
||||
@@ -38,6 +41,9 @@ maven.aspectwerkz.verbose = false
|
||||
# Location of the XML definition file.
|
||||
maven.aspectwerkz.definition.file.src = ${basedir}/conf/aspectwerkz.xml
|
||||
|
||||
# Location where aspectc results will be generated.
|
||||
maven.aspectwerkz.aspectc.build.dir = ${maven.build.dir}/aspectwerkz/aspectc
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# xmldef mode properties
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -47,7 +53,8 @@ maven.aspectwerkz.definition.file.src = ${basedir}/conf/aspectwerkz.xml
|
||||
# used in "xmldef" mode.
|
||||
maven.aspectwerkz.definition.file.build = ${maven.build.dir}/aspectwerkz.xml
|
||||
|
||||
# TODO: explain property here
|
||||
# If set to "no", prevents org.codehaus.aspectwerkz and related classes
|
||||
# (jexl, trove, dom4j...) from being instrumented.
|
||||
maven.aspectwerkz.transform.filter = no
|
||||
|
||||
# (optional). Definition file to be merged with the main definition file.
|
||||
|
||||
@@ -5,3 +5,4 @@
|
||||
maven.aspectwerkz.verbose = true
|
||||
maven.aspectwerkz.src.dir = ${basedir}/src/aspectwerkz
|
||||
maven.aspectwerkz.build.dest = ${maven.build.dir}/aspectwerkz/classes
|
||||
maven.aspectwerkz.weave.build.dir = ${maven.build.dir}/aspectwerkz/weaved
|
||||
|
||||
@@ -104,6 +104,14 @@
|
||||
<code>maven.aspectwerkz.build.dest = ${maven.build.dir}/aspectwerkz/classes</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>aspectwerkz.classloader.preprocessor</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Classloader to use for class files weaving. Defaults to
|
||||
<code>org.codehaus.aspectwerkz.transform.AspectWerkzPreProcessor</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@@ -122,6 +130,14 @@
|
||||
<code>${basedir}/conf/aspectwerkz.xml</code>.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>maven.aspectwerkz.aspectc.build.dir</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
Location where aspectc results will be generated. Defaults to
|
||||
<code>${maven.build.dir}/aspectwerkz/aspectc</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
@@ -163,7 +179,9 @@
|
||||
<td>maven.aspectwerkz.transform.filter</td>
|
||||
<td>Yes</td>
|
||||
<td>
|
||||
TODO: explain property here. Defaults to <code>no</code>.
|
||||
If set to "no", prevents <code>org.codehaus.aspectwerkz</code> and
|
||||
related classes (jexl, trove, dom4j...) from being instrumented.
|
||||
Defaults to <code>no</code>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user