PR: MPASPECTJ-15

Submitted by: Alexey Dashkevich
New property maven.aspectj.dest to define output folder for aspectj:compile goal.


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@390295 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
ltheussl 2006-03-31 01:22:16 +00:00
parent 8168fa6585
commit 94d66009c3
7 changed files with 58 additions and 9 deletions

View File

@ -2,7 +2,7 @@
<!-- <!--
/* /*
* Copyright 2001-2005 The Apache Software Foundation. * Copyright 2001-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -243,6 +243,18 @@
<j:if test="${(shouldWeave == 'true') and (pom.build.unitTestSourceDirectory != '')}"> <j:if test="${(shouldWeave == 'true') and (pom.build.unitTestSourceDirectory != '')}">
<j:choose>
<j:when test="${context.getVariable('maven.aspectj.dest') == null}">
<j:set var="maven.aspectj.dest" value="${maven.build.dest}"/>
</j:when>
<j:otherwise>
<attainGoal name="java:compile"/>
<ant:path id="build.dest" location="${maven.build.dest}"/>
<maven:addPath id="maven.dependency.classpath" refid="build.dest"/>
</j:otherwise>
</j:choose>
<maven:get var="maven.test.compile.src.set" <maven:get var="maven.test.compile.src.set"
plugin="maven-test-plugin" plugin="maven-test-plugin"
property="maven.test.compile.src.set"/> property="maven.test.compile.src.set"/>
@ -256,7 +268,7 @@
<aspectj:compile <aspectj:compile
sourcePathRefid="maven.test.compile.src.set" sourcePathRefid="maven.test.compile.src.set"
classpathRefid="testClasspath" classpathRefid="testClasspath"
destDir="${maven.test.dest}"/> destDir="${maven.aspectj.dest}"/>
</j:if> </j:if>

View File

@ -1,5 +1,5 @@
# ------------------------------------------------------------------- # -------------------------------------------------------------------
# Copyright 2001-2004 The Apache Software Foundation. # Copyright 2001-2006 The Apache Software Foundation.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -67,6 +67,8 @@ maven.aspectj.source = 1.3
# If true, display speed information during weaving. # If true, display speed information during weaving.
maven.aspectj.time = false maven.aspectj.time = false
# The directory for compiled classes. By default maven.build.dest used.
#maven.aspectj.dest=
# If true, produce binaries that can only be used as input for the -injars or -inpath option # If true, produce binaries that can only be used as input for the -injars or -inpath option
maven.aspectj.noweave=false maven.aspectj.noweave=false

View File

@ -1,6 +1,6 @@
<!-- <!--
/* /*
* Copyright 2004 The Apache Software Foundation. * Copyright 2004-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -42,4 +42,8 @@
<attainGoal name="clean"/> <attainGoal name="clean"/>
</goal> </goal>
<preGoal name="test:compile">
<attainGoal name="aspectj"/>
</preGoal>
</project> </project>

View File

@ -14,3 +14,4 @@
# limitations under the License. # limitations under the License.
# ------------------------------------------------------------------- # -------------------------------------------------------------------
maven.junit.fork=true maven.junit.fork=true
maven.aspectj.dest=target/test-classes

View File

@ -1,7 +1,7 @@
package org.apache.maven.aspectj; package org.apache.maven.aspectj;
/* ==================================================================== /* ====================================================================
* Copyright 2004 The Apache Software Foundation. * Copyright 2004-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,6 +18,9 @@ package org.apache.maven.aspectj;
*/ */
import junit.framework.TestCase; import junit.framework.TestCase;
import java.util.Enumeration;
import java.net.URL;
public class AspectTest extends TestCase public class AspectTest extends TestCase
{ {
@ -60,6 +63,23 @@ public class AspectTest extends TestCase
} }
} }
public void testTestDest() throws Exception
{
Enumeration enum = getClass().getClassLoader().getResources("org/apache/maven/aspectj/AspectTest.class" );
String testFile = getClass().getClassLoader().getResource( "org/apache/maven/aspectj/TestA.class" ).getFile();
int count = 0;
//check that aspect TestA placed only in the same folder that AspectTest
while ( enum.hasMoreElements() )
{
URL aspectURL = (URL) enum.nextElement();
assertEquals( aspectURL.getFile().substring( 0, aspectURL.getFile().indexOf( "/AspectTest.class" ) ),
testFile.substring( 0, testFile.indexOf( "/TestA.class" ) ) );
count++;
}
assertEquals( 1, count );
}
public void someMethod() public void someMethod()
{ {
} }

View File

@ -2,7 +2,7 @@
<!-- <!--
/* /*
* Copyright 2001-2005 The Apache Software Foundation. * Copyright 2001-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -28,6 +28,7 @@
</properties> </properties>
<body> <body>
<release version="4.0-SNAPSHOT" date="in SVN"> <release version="4.0-SNAPSHOT" date="in SVN">
<action dev="ltheussl" type="add" issue="MPASPECTJ-15" due-to="Alexey Dashkevich">New property <code>maven.aspectj.dest</code> to define output folder for <code>aspectj:compile</code> goal.</action>
<action dev="ltheussl" type="fix" issue="MPASPECTJ-14" due-to="Alexey Dashkevich">Unable to weave only sources defined in argument files. New property <code>maven.aspectj.src.argfilesOnly</code>.</action> <action dev="ltheussl" type="fix" issue="MPASPECTJ-14" due-to="Alexey Dashkevich">Unable to weave only sources defined in argument files. New property <code>maven.aspectj.src.argfilesOnly</code>.</action>
<action dev="ltheussl" type="add" issue="MPASPECTJ-23" due-to="Shinobu Kawai Yoshida">Add a report for the plugin.</action> <action dev="ltheussl" type="add" issue="MPASPECTJ-23" due-to="Shinobu Kawai Yoshida">Add a report for the plugin.</action>
<action dev="carlos" type="update" issue="MPASPECTJ-21">Upgraded to AspectJ 1.5.0</action> <action dev="carlos" type="update" issue="MPASPECTJ-21">Upgraded to AspectJ 1.5.0</action>

View File

@ -2,7 +2,7 @@
<!-- <!--
/* /*
* Copyright 2001-2005 The Apache Software Foundation. * Copyright 2001-2006 The Apache Software Foundation.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -71,6 +71,15 @@
</td> </td>
</tr> </tr>
<tr>
<td>maven.aspectj.dest</td>
<td>Yes</td>
<td>
The directory for compiled classes.
Defaults to <code>maven.build.dest</code>.
</td>
</tr>
<tr> <tr>
<td>maven.aspectj.sourceRootCopyFilter</td> <td>maven.aspectj.sourceRootCopyFilter</td>
<td>Yes</td> <td>Yes</td>