title: How can I use different JARs for compiling and testing in maven?
body: <p>I compile my programm against javaee-api. But for Junit testing I must use a specific implementation like glassfish's javaee.jar to avoid errors like <em>java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/Persistence</em> (see also <a href="http://forums.sun.com/thread.jspa?threadID=5320401" rel="noreferrer">1</a>).</p>
  
  <p>So avoid using methods, that are only available in glassfish implementation, I want to compile my artifact with the general api, but run junit with the implementation jar. But both provide equal named classes and inferfaces, so the class loader gets in trouble.</p>
  
  <p>What is the best way to solve this problem? Can I solve this problem with maven?</p>
  
  <p>Thanks a lot</p>