【问题标题】:Maven Invoker Skipping Test in GoalsMaven Invoker 在目标中跳过测试
【发布时间】:2017-02-20 07:12:16
【问题描述】:

下面是我的代码

InvocationRequest request = new DefaultInvocationRequest();
                            request.setPomFile(new File(pom.xml));
                            request.setGoals(Arrays.asList("clean", "install"));
                            Invoker invoker = new DefaultInvoker();
                            try {
                                invoker.execute(request);
                            } catch (MavenInvocationException e) {
                                e.printStackTrace();
                            }

当我调用 pom.xml 时,我想跳过我无法找到的测试。

如何在 setGoals 方法中设置跳过测试。

【问题讨论】:

    标签: java maven plugins


    【解决方案1】:

    您可以设置skipTests属性来实现它。

    Properties properties = new Properties();
    properties.setProperty("skipTests", "true");
    request.setProperties(properties);
    

    【讨论】:

      【解决方案2】:

      糟糕,快速修复找到了以下答案。

      request.setGoals(Arrays.asList("clean", "install","-Dmaven.test.skip=true"));
      

      谢谢

      【讨论】:

        【解决方案3】:
        猜你喜欢
        • 2013-06-11
        • 2014-09-03
        • 2021-04-30
        • 1970-01-01
        • 2016-05-09
        • 2013-07-07
        • 1970-01-01
        • 2013-04-30
        • 2017-05-31
        相关资源
        最近更新 更多