在创建jar时使用maven pom:test-jar有时会说JAR将为空 - 没有内容被标记为包含 [英] using maven pom while creating jar:test-jar some times it says JAR will be empty - no content was marked for inclusion

查看:1919
本文介绍了在创建jar时使用maven pom:test-jar有时会说JAR将为空 - 没有内容被标记为包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过 jar:test-jar 创建带有测试类的jar时,有时会说:

While creating jar with test classes by jar:test-jar sometimes it says:


JAR将为空 - 没有内容被标记为包含!

JAR will be empty - no content was marked for inclusion!

Test-jar不包含任何测试类。但是有时会使用所有测试类创建正确的测试jar。

Test-jar doesn't contain any test classes. But sometimes correct test jar is created with all test classes.

我需要在我的pom中提到以获得测试模块jar而不运行测试类(仅编译) )

关于maven pom需要什么maven命令

what maven command needed with respect to maven pom

推荐答案

我得到了回答:

mvn clean install -DskipTests

Add this in your pom.xml

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
          <goal>single</goal>
        </goals>
      </execution>
    </executions>
    <configuration>
      <descriptorRefs>
        <descriptorRef>jar-with-dependencies</descriptorRef>
      </descriptorRefs>
    </configuration>
  </plugin>

这篇关于在创建jar时使用maven pom:test-jar有时会说JAR将为空 - 没有内容被标记为包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆