Hello All,
Some days ago I have started to use aspectj plugin for compilation
aspects. I use aspects only for tests. I have following structure in
project:
-src
|
aspectj - aspect sources
|
java - application sources
|
test - test sources
I have an "lst" file where defined what files should be compiled with
aspects e.g.:
com/toplinkmapping/UserRoleAspect.java
../java/com/toplinkmapping/UserRole.java
I want compile only files that defined in "lst" file and place classes
into test-classes folder. In project.properties I have defined
following properties:
maven.aspectj.source=1.4
maven.aspectj.argfiles=src/aspectj/aspects.lst
But when I have executed aspectj:compile I have error because this
task try to compile files from aspects.lst file and then from src/java
folder. And error occur because in aspects.lst defined files from java source
folder.
I have resolved this problem in my maven.xml by following way:
<postGoal name="test:compile">
<ant:path id="build.dest" location="${maven.build.dest}"/>
<maven:addPath id="maven.dependency.classpath" refid="build.dest"/>
<ant:path id="maven.compile.src.set"/>
<attainGoal name="aspectj:compile"/>
</postGoal>
So as you can see I have overwrite "maven.compile.src.set" path that
not so good. I think it will be good if will be introduced new property
like "maven.aspectj.src.set" for definition of source directories that
need to be compiled with aspect sources (It can be
"maven.compile.src.set" by default). Or maybe changes in plugin script
are more prefer e.g.:
from
<ant:sourceroots>
<ant:path refid="${sourcePathRefid}"/>
<j:if test="${aspectSourcesPresent and weaveAspectSources}">
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
</j:if>
</ant:sourceroots>
to
<ant:sourceroots>
<j:if test="${aspectSourcesPresent and weaveAspectSources}">
<ant:path refid="${sourcePathRefid}"/>
<ant:pathelement location="${pom.build.aspectSourceDirectory}"/>
</j:if>
</ant:sourceroots>
Also In plugin doesn't exist property for definition output folder. It
will be good have property like "maven.aspectj.dest" (It can be
"maven.build.dest" by default). Because I want to compile my aspects
into test-classes folder and I need to do following in maven.xml:
<postGoal name="test:compile">
<j:set var="tmp" value="${maven.build.dest}"/>
<j:set var="maven.build.dest" value="${maven.test.dest}"/>
<ant:path id="build.dest" location="${tmp}"/>
<maven:addPath id="maven.dependency.classpath" refid="build.dest"/>
<ant:path id="maven.compile.src.set"/>
<attainGoal name="aspectj:compile"/>
<j:set var="maven.build.dest" value="${tmp}"/>
</postGoal>
It works but I have to overwrite "maven.compile.src.set" path and now
I can't run following command:
maven test clean war:war
It is not so critical but not elegant as can be. Maybe somebody can
help me adjust my project?
Thank you.
--
With best regards and wishes,
Alexey mailto:[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]