4

So, I'm trying to use AspectJ's load time weaving in a Maven project built with IntelliJ. I've read that I need to add "-javaagent:/aspectjweaver.jar" as a VM argument. I'm just wondering how I would do that in IntelliJ, when aspectjweaver.jar is a dependency managed by Maven and loaded via my pom.xml?

Thanks.

Edit: Clarifying this on request.

The AspectJ usage is one example of what I'm actually asking. For load-time weaving with AspectJ, you need to add "-javaagent:/aspectjweaver.jar" as a VM argument.

However, I'm using Maven to provide my aspectjweaver.jar dependency. So how do I specify the path to it in that argument if Maven is managing it? Do I use my m2 directory? I'm ultimately going to use the Maven Assembly Plugin to put all dependencies in one jar, so in that case, do I need to figure out the path in the assembled jar?

craigmiller160
  • 5,751
  • 9
  • 41
  • 75
  • Maven runs it's plugins in the same JVM as the one you start. Most likely you want a plugin for AspectJ written for maven. This won't need to weave maven, but rather the code generated. – Peter Lawrey Mar 13 '16 at 18:53
  • Take a look here: http://www.mojohaus.org/aspectj-maven-plugin/index.html – khmarbaise Mar 13 '16 at 19:00
  • I can't tell from the question what you actually want help with. You ask about how to do something with intellij, but then talk about maven. I can tell you how to add a jvm argument to intellij but the other commenters have assumed that you need help with maven. Can you clarify? – Software Engineer Mar 14 '16 at 15:59
  • Just clarified. Thanks for noticing my lack of clarity. – craigmiller160 Mar 14 '16 at 22:23
  • Perhaps this might help you http://stackoverflow.com/questions/14777909/specify-javaagent-argument-with-maven-exec-plugin – Em Ae Mar 14 '16 at 22:33

0 Answers0