【问题标题】:webstart-maven-plugin including test scoped dependencieswebstart-maven-plugin 包括测试范围的依赖项
【发布时间】:2015-03-31 19:40:23
【问题描述】:

在一个多模块项目中,我在 ProjectA 的 pom 中依赖于 ProjectB(主要和测试)配置为

    <dependency>
        <groupId>com.company</groupId>
        <artifactId>ProjectB</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>com.company</groupId>
        <artifactId>ProjectB</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>test-jar</type>
    </dependency>

当我尝试使用 webstart-maven-plugin 打包项目时,test-jar 会从 lib 目录中排除。有没有办法包含它?

插件日志包含这一行,表示正在跳过 test-jar 依赖项。

[DEBUG] artifact axis:axis-wsdl4j:jar:1.5.1:compile doesn't contain the main class: com.company.ui.ApplicationWindow
[INFO] Skipping artifact of type test-jar for lib
[DEBUG] artifact com.jgoodies:jgoodies-looks:jar:2.5.3:compile doesnt contain the main class: com.company.ui.ApplicationWindow

谢谢。

【问题讨论】:

  • 您在 include 标记中使用的坐标似乎与依赖项不匹配,我可以看到一个 :tests: 不存在于依赖定义。
  • @Tome 我添加了 tests 作为依赖项定义的一部分(作为分类器),但最初指定它仍然失败。
  • 看看那里:mojo.codehaus.org/webstart/webstart-maven-plugin/…,尤其是关于include标签的那句话:注意这里只能指定groupId和artifactId。由于 Include/ExcludesArtifactFilter 的限制
  • 谢谢@Tome。当我只指定 groupid 和 artifactid 时,我只得到主 jar 而不是测试。不是我想要的结果,但至少我可以专注于其他地方。
  • 尝试将 compile 添加到您的依赖项定义中。我猜这可能在dependencyManagement中的某处设置为test,所以强制它compile也可以帮助

标签: java maven maven-webstart-plugin


【解决方案1】:

翻遍源码后发现不能包含test-jar。该插件将仅包含“jar”和“ejb-client”类型的依赖项。

无论如何,我决定通过将测试类作为源文件夹包含在主 jar 中来解决我的问题。

【讨论】:

    猜你喜欢
    • 2011-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-05
    • 2017-01-29
    • 2023-03-24
    • 1970-01-01
    相关资源
    最近更新 更多