This may take some initial explaining to justify what I did. I want to
make sure in my newbishness that I haven't gone and hacked a pom I
didn't need to.
<initial_explaination>
Service-Project (has java classes)
Configuration-Project (has java classes)
Monitoring-Project (has .java and .aj files)
Each project above has a pom in it.
Monitoring has the atypical aspectj pom setup, it compiles the aspects
and jar's them up. The Monitoring-Project has defined dependencies on
each of the other projects (<dependency>) as the aspects use classes
from both Service and Configuration. Monitoring builds/compiles/jar's
fine.
I then want to WEAVE the Monitoring-Project into both Service and
Configuration projects, but adding the Monitoring dependency to either
project causes a circular dependency. So I created two more projects
that simply takes the Monitoring jar and weaves it into each project.
</initial_explaination>
I have these projects
Service-Project (has java classes)
Configuration-Project (has java classes)
Monitoring-Project (has .java and .aj files)
Weave-Service (dep on Service proj. and Monitoring proj.)
- in the pom for this I have a <weaveDirectory> that points to the
Service proj. source and a <aspectLibrary> that points to the
Monitoring.jar via <groupId, artifactId>
- THIS WORKS to create a Service-Project whose sources have been
weaved with Monitoring.jar
Weave-Configuration (dep. on Configuration and Monitoring)
- same deal except points to Configuration etc
- FAILS with stack trace at end of this email.
Weave-Configuration works however if I do this in the pom.xml:
<configuration>
<forceAjcCompile>true</forceAjcCompile>
<source>1.5</source>
<target>1.5</target>
<aspectLibraries>
<aspectLibrary>
<groupId>com.monitoring</groupId>
<artifactId>Monitoring</artifactId>
</aspectLibrary>
</aspectLibraries>
<weaveDependencies>
<weaveDependency>
<groupId>com.config</groupId>
<artifactId>Configuration</artifactId>
</weaveDependency>
</weaveDependencies>
</configuration>
What I am doing is weaving two JAR's together. Because there is no
"source" involved with this I have to <forceAjcCompile> because
without source (according to the source code of the maven aspectj
plugin) the compiling/weaving won't be done.
Should weaving two jars via a pom be something Maven and the AspectJ
Maven plugin allow or has the stack trace below that I can't figure
out caused me to create an unnecessary hack here?
Stack Trace:
java.lang.NullPointerException
at
org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.getSourceFile(EclipseSourceContext.java:49)
at
org.aspectj.ajdt.internal.core.builder.EclipseSourceContext.makeSourceLocation(EclipseSourceContext.java:57)
at
org.aspectj.weaver.bcel.BcelShadow.getSourceLocation(BcelShadow.java:3359)
at
org.aspectj.weaver.bcel.BcelWorld.reportWeavingMessage(BcelWorld.java:197)
at org.aspectj.weaver.bcel.BcelWorld.reportMatch(BcelWorld.java:141)
at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:631)
at org.aspectj.weaver.Shadow.implement(Shadow.java:544)
at
org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:3147)
at
org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:490)
at
org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1687)
at
org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1631)
at
org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1394)
at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1180)
at
org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.weaveQueuedEntries(AjPipeliningCompilerAdapter.java:514)
at
org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.queueForWeaving(AjPipeliningCompilerAdapter.java:447)
at
org.aspectj.ajdt.internal.compiler.AjPipeliningCompilerAdapter.afterProcessing(AjPipeliningCompilerAdapter.java:432)
at
org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$after$org_aspectj_ajdt_internal_compiler_CompilerAdapter$5$6b855184(CompilerAdapter.aj:98)
at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:652)
at
org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:392)
at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:1021)
at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.performBuild(AjBuildManager.java:268)
at
org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:181)
at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
at org.aspectj.tools.ajc.Main.run(Main.java:371)
at org.aspectj.tools.ajc.Main.runMain(Main.java:248)
at
org.codehaus.mojo.aspectj.AbstractAjcCompiler.execute(AbstractAjcCompiler.java:405)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:600)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email