简体   繁体   English

DropwizardAppRule和maven-failsafe-plugin

[英]DropwizardAppRule and maven-failsafe-plugin

This is my DropwizardAppRule in MyAppIT.java class: 这是我DropwizardAppRule在MyAppIT.java类:

@ClassRule
public static final DropwizardAppRule<MyConfiguration> RULE =
        new DropwizardAppRule<>(MyApplication.class, YAML_PATH);

This would return the LocalPort my local Dropwizard App is running on: 这将返回我的本地Dropwizard应用运行的LocalPort

RULE.getLocalPort()

When running in IntelliJ , it returns 9998 and all tests pass but when I do mvn clean install or mvn verify from the command line, it throws a NullPointerException and I see a bunch of Connection refused errors. IntelliJ运行时,它返回9998并通过所有测试,但是当我从命令行执行mvn clean installmvn verify ,它将引发NullPointerException并且我看到一堆Connection refused错误。

ERROR! javax.ws.rs.ProcessingException: java.net.ConnectException: Connection refused

Here is my maven-failsafe-plugin config: 这是我的maven-failsafe-plugin配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-failsafe-plugin</artifactId>
    <version>2.18.1</version>
    <configuration>
        <includes>
            <include>MyAppIT.java</include>
        </includes>
        <systemProperties>
            <property>
                <name>test.environment</name>
                <value>${test.environment}</value>
            </property>
        </systemProperties>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
            </goals>
        </execution>
    </executions>
</plugin>

It seems as if the DropwizardAppRule isn't even starting (since the port is null). 似乎DropwizardAppRule甚至没有启动(因为端口为null)。 What am I missing? 我想念什么?

I included MyAppIT.java to the maven-surefire-plugin and it worked: 我将MyAppIT.java包含到了maven-surefire-plugin surefire maven-surefire-plugin ,它的工作原理是:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>2.19.1</version>
    <configuration>
        <includes>
            <include>MyAppIT.java</include>
        </includes>
    </configuration>
</plugin>

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

相关问题 未找到插件“maven-failsafe-plugin:2.22.1” - Plugin 'maven-failsafe-plugin:2.22.1' not found maven-failsafe-plugin未运行集成测试 - maven-failsafe-plugin not running integration tests 并行测试运行期间maven-failsafe-plugin中的错误 - Error in maven-failsafe-plugin during parallel tests running maven-failsafe-plugin 不支持 JUnit5 中的固定并行性 - maven-failsafe-plugin not honoring fixed parallelism in JUnit5 如何在Maven-Failsafe-plugin中添加集成前和集成后阶段 - how to add pre and post integration phase to maven-failsafe-plugin maven-failsafe-plugin应该在POM的后代执行吗? - Should maven-failsafe-plugin be executed in descendants of POM where it is specified? inmemdb-maven-plugin和maven-failsafe-plugin数据库表创建问题 - inmemdb-maven-plugin and maven-failsafe-plugin database table creation issue 无法执行目标org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify(verify) - Failed to execute goal org.apache.maven.plugins:maven-failsafe-plugin:2.12:verify (verify) Maven 构建和 maven-failsafe-plugin - 分叉的 VM 没有正确说再见就终止了 - Maven build and maven-failsafe-plugin - The forked VM terminated without properly saying goodbye 为什么 maven-failsafe-plugin 没有显示执行的宁静测试? - why maven-failsafe-plugin doesn't show serenity tests executed?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM