简体   繁体   English

如何使用maven-jar-plugin使用.class文件创建测试jar?

[英]How to use maven-jar-plugin to create a test-jar with .class files?

I have been trying to create a test-jar from a war project using the maven-jar-plugin. 我一直在尝试使用maven-jar-plugin从一个战争项目创建一个测试jar。 I have custom src folder which I want as a jar. 我有想要作为jar的自定义src文件夹。 The plugin does not compile the files in the folder and creates a jar with .java files. 该插件不会编译文件夹中的文件,而是使用.java文件创建一个jar。 How do I compile the java files before they are packaged in a jar as .class files ? 在将Java文件作为.class文件打包到jar中之前,如何编译它们?

<plugin>
   <groupId>org.apache.maven.plugins</groupId>
   <artifactId>maven-jar-plugin</artifactId>
   <version>2.4</version>
   <executions>
      <execution>
         <goals>
            <goal>test-jar</goal>
         </goals>
      </execution>
   </executions>
   <configuration>
      <testClassesDirectory>${project.basedir}/src/test/selenium</testClassesDirectory>   
   </configuration>
</plugin>

您是否尝试使用maven-compiler-plugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM