title: Pass command-line argument javaagent with maven exec plugin
body: <p>I have a caching app in Java and I need to put objects of different size in cache. The problem is that I didn't really know how to count the size of a custom object and I've found the solution - to use the library: http://mvnrepository.com/artifact/com.googlecode.sizeofag/sizeofag/1.0.0. 
  To run the program using the library I need to specify command-line argument -javaagent. So, how can I do it if I'm using maven???</p>
  
  <p><br /></p>
  
  <p>The program is simple: </p>
  
  <pre><code>protected static Boolean b;
  public static void main( String[] args )
  {
      System.out.println(SizeOfAgent.sizeOf(b));
  }
  </code></pre>
  
  <p>This is the output:</p>
  
  <pre><code>0
  Can not access instrumentation environment.
  Please check if jar file containing SizeOfAgent class is 
  specified in the java's "-javaagent" command line argument.
  </code></pre>
  
  <p><br />P.S. I know, that such kind of question already exists, but it has no proper answer.</p>