Weave test classes
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
1 parent
76928bea04
commit
de8723470b
5 files changed
+149
-66
No files matched your search
+113
-59
@@ -30,16 +30,87 @@
|
||||
|
||||
<project
|
||||
xmlns:j="jelly:core"
|
||||
xmlns:ant="jelly:ant">
|
||||
xmlns:ant="jelly:ant"
|
||||
xmlns:define="jelly:define"
|
||||
xmlns:test="test"
|
||||
xmlns:aspectj="aspectj">
|
||||
|
||||
<!--
|
||||
Taglib to compile aspects
|
||||
|
||||
Parameters:
|
||||
- sourcePathRefid
|
||||
- classpathRefid
|
||||
- destDir
|
||||
-->
|
||||
<define:taglib uri="aspectj">
|
||||
|
||||
<define:tag name="compile">
|
||||
|
||||
<ant:iajc
|
||||
fork="${maven.aspectj.fork}"
|
||||
incremental="${maven.aspectj.incremental}"
|
||||
destDir="${destDir}"
|
||||
sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
|
||||
debug="${maven.aspectj.debug}"
|
||||
emacssym="${maven.aspectj.emacssym}"
|
||||
verbose="${maven.aspectj.verbose}">
|
||||
|
||||
<j:if test="${context.getVariable('maven.aspectj.fork') == true}">
|
||||
<j:if test="${context.getVariable('maven.aspectj.maxmem') != null}">
|
||||
<ant:setProperty name="maxmem" value="${maven.aspectj.maxmem}" />
|
||||
</j:if>
|
||||
</j:if>
|
||||
|
||||
<ant:sourceroots>
|
||||
<ant:path refid="${sourcePathRefid}"/>
|
||||
<j:if test="${aspectSourcesPresent == 'true'}">
|
||||
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
|
||||
</j:if>
|
||||
</ant:sourceroots>
|
||||
|
||||
<ant:classpath>
|
||||
<ant:path refid="${classpathRefid}"/>
|
||||
<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>
|
||||
|
||||
|
||||
</define:tag>
|
||||
|
||||
</define:taglib>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Default goal.
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectj" description="Weave with AspectJ">
|
||||
<attainGoal name="aspectj:compile"/>
|
||||
</goal>
|
||||
<goal name="aspectj" description="Weave with AspectJ"
|
||||
prereqs="aspectj:test-compile"/>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
@@ -87,69 +158,52 @@
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Weave aspect classes
|
||||
Weave classes
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectj:compile" prereqs="aspectj:init"
|
||||
description="Weave with AspectJ">
|
||||
description="Weave classes with AspectJ">
|
||||
|
||||
<j:if test="${shouldWeave == 'true'}">
|
||||
|
||||
<ant:iajc
|
||||
fork="${maven.aspectj.fork}"
|
||||
incremental="${maven.aspectj.incremental}"
|
||||
destDir="${maven.build.dest}"
|
||||
sourceRootCopyFilter="${maven.aspectj.sourceRootCopyFilter}"
|
||||
debug="${maven.aspectj.debug}"
|
||||
emacssym="${maven.aspectj.emacssym}"
|
||||
verbose="${maven.aspectj.verbose}"
|
||||
source="${maven.aspectj.source}"
|
||||
time="${maven.aspectj.time}">
|
||||
|
||||
<j:if test="${context.getVariable('maven.aspectj.fork') == true}">
|
||||
<j:if test="${context.getVariable('maven.aspectj.maxmem') != null}">
|
||||
<ant:setProperty name="maxmem" value="${maven.aspectj.maxmem}" />
|
||||
</j:if>
|
||||
</j:if>
|
||||
|
||||
<ant:sourceroots>
|
||||
<ant:path refid="maven.compile.src.set"/>
|
||||
<j:if test="${aspectSourcesPresent == 'true'}">
|
||||
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
|
||||
</j:if>
|
||||
</ant:sourceroots>
|
||||
|
||||
<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>
|
||||
<!-- Weave classes -->
|
||||
<aspectj:compile
|
||||
sourcePathRefid="maven.compile.src.set"
|
||||
classpathRefid="maven.dependency.classpath"
|
||||
destDir="${maven.build.dest}"/>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
<!--
|
||||
========================================================================
|
||||
Weave test classes
|
||||
========================================================================
|
||||
-->
|
||||
<goal name="aspectj:test-compile" prereqs="aspectj:compile"
|
||||
description="Weave tests with AspectJ">
|
||||
|
||||
<j:if test="${shouldWeave == 'true'}">
|
||||
|
||||
<!-- By calling a goal from the test plugin we ensure that all its
|
||||
properties are loaded and are thus accessible from this plugin -->
|
||||
<test:dependency-handle/>
|
||||
<j:set var="testPlugin" value="${pom.getPluginContext('maven-test-plugin')}"/>
|
||||
|
||||
<!-- Weave test classes -->
|
||||
<ant:path id="testClasspath">
|
||||
<ant:path refid="maven.dependency.classpath"/>
|
||||
<ant:pathelement path="${plugin.getDependencyPath('junit')}"/>
|
||||
</ant:path>
|
||||
|
||||
<aspectj:compile
|
||||
sourcePathRefid="maven.test.compile.src.set"
|
||||
classpathRefid="testClasspath"
|
||||
destDir="${maven.test.dest}"/>
|
||||
|
||||
</j:if>
|
||||
|
||||
</goal>
|
||||
|
||||
</project>
|
||||
+15
-4
@@ -78,12 +78,18 @@
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Carlos Sanchez</name>
|
||||
<id>carlos</id>
|
||||
<email>carlossg@users.sourceforge.net</email>
|
||||
<organization/>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
<role>Documentation</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
<contributors>
|
||||
<contributor>
|
||||
<name>Carlos Sanchez</name>
|
||||
<email>carlossg@users.sourceforge.net</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Charlie Harvey</name>
|
||||
<email>sbzoom@yahoo.com</email>
|
||||
@@ -100,5 +106,10 @@
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -28,6 +28,9 @@
|
||||
</properties>
|
||||
<body>
|
||||
<release version="3.1-SNAPSHOT" date="in CVS">
|
||||
<action dev="carlos" type="add" issue="MPASPECTJ-6">
|
||||
Weave test classes
|
||||
</action>
|
||||
<action dev="carlos" type="add" issue="MPASPECTJ-10">
|
||||
Added "Compiling aspect sources" section to xdoc
|
||||
</action>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<name>aspectj</name>
|
||||
<description>
|
||||
This is the default goal of the plugin and simply attains
|
||||
the <code>aspectj:compile</code> goal.
|
||||
the <code>aspectj:test-compile</code> goal.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
@@ -41,6 +41,12 @@
|
||||
Weaves project classes and dependency libraries.
|
||||
</description>
|
||||
</goal>
|
||||
<goal>
|
||||
<name>aspectj:test-compile</name>
|
||||
<description>
|
||||
Weaves project test classes after calling <code>aspectj:compile</code>.
|
||||
</description>
|
||||
</goal>
|
||||
</goals>
|
||||
</body>
|
||||
</document>
|
||||
+11
-2
@@ -128,11 +128,20 @@
|
||||
add the following to your maven.xml file.
|
||||
</p>
|
||||
<source>
|
||||
<![CDATA[
|
||||
<![CDATA[
|
||||
<preGoal name="java:compile">
|
||||
<attainGoal name="aspectj"/>
|
||||
</preGoal>
|
||||
]]>
|
||||
</source>
|
||||
<p>If you don't want to weave test classes use the following code instead.
|
||||
</p>
|
||||
<source>
|
||||
<![CDATA[
|
||||
<preGoal name="java:compile">
|
||||
<attainGoal name="aspectj:compile"/>
|
||||
</preGoal>
|
||||
]]>
|
||||
]]>
|
||||
</source>
|
||||
</section>
|
||||
|
||||
|
||||
Reference in new issue
Block a user