Is there a way to get the archive section of the maven-jar-plugin to include 
test scope dependencies in the classpath?  I'm trying to use the test-jar goal 
to create a test jar alongside my main jar.  I've used two different executions 
of the maven-dependency-plugin to put dependencies with runtime scope in one 
folder and those with test scope in another.  I'm pointing the execution with 
the plain jar goal at the former folder, while pointing my jar execution with 
the test-jar goal at the latter folder.  It works great, except that the test 
jar's maifext.txt only includes the runtime scope dependencies in the classpath.

Here is code to illustrate:

     <plugin>
       <artifactId>maven-dependency-plugin</artifactId>
       <version>2.8</version>
       <executions>
         <execution>
           <id>runtime_copy</id>
           <phase>package</phase>
           <goals>
             <goal>copy-dependencies</goal>
           </goals>
           <configuration>
             <outputDirectory>${project.build.directory}/lib</outputDirectory>
             <includeScope>runtime</includeScope>
           </configuration>
         </execution>
         <execution>
           <id>test_copy</id>
           <phase>package</phase>
           <goals>
            <goal>copy-dependencies</goal>
           </goals>
           <configuration>
             
<outputDirectory>${project.build.directory}/libTest</outputDirectory>
             <includeScope>test</includeScope>
           </configuration>
         </execution>
       </executions>
     </plugin>
     <plugin>
       <artifactId>maven-jar-plugin</artifactId>
       <version>2.5</version>
       <executions>
         <execution>
           <id>default-jar</id>
           <phase>package</phase>
           <goals>
             <goal>jar</goal>
           </goals>
           <configuration>
             <archive>
               <manifest>
                 <mainClass>path.in.main.program</mainClass>
                 <addClasspath>true</addClasspath>
                 <classpathPrefix>lib/</classpathPrefix>
               </manifest>
             </archive>
           </configuration>
         </execution>
         <execution>
           <id>default-cli</id>
           <goals>
             <goal>test-jar</goal>
           </goals>
           <configuration>
             <archive>
               <manifest>
                 
<mainClass>Path.to.generic.main.class.in.test.scoped.jar</mainClass>
                 <addClasspath>true</addClasspath>
                 <classpathPrefix>libTest/</classpathPrefix>
               </manifest>
             </archive>
           </configuration>
         </execution>
       </executions>
     </plugin>

When I try to run the executable test jar, I get a class not found exception, 
since the jar containing my generic main function does not exist in the 
classpath, even though it does exist it the test scoped directory.

JOHN CHESSHIR
Software Developer
[acxiom]

Acxiom Corporation - Global Product Engineering
EML   [email protected]<mailto:[email protected]>
TEL    501.342.2224
MBL   501.977.3181
450 Corporate Drive, 2nd Floor, Conway, AR, 72032, USA
www.acxiom.com<http://www.acxiom.com/>

[Friend Us on Facebook]<http://www.facebook.com/acxiomcorp>  [Link Us on 
LinkedIn] <http://www.linkedin.com/groupRegistration?gid=2901735>   [Follow Us 
on Twitter] <http://twitter.com/acxiom>

***************************************************************************
The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally
privileged.

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.
****************************************************************************

Reply via email to