我有一个maven web应用程序,它使用带有junit 5和mockito的spring框架进行测试。我在src / test / java文件夹中放了两个测试类,用testUT1命名(有一个简单的单元测试)和TestIT,它使用mockitoextension来运行DAO集成测试。通过右键单击它们运行eclipse中的测试类并运行为junit测试工作并产生正确的结果。但是,maven clean然后安装或测试运行0测试。我找不到原因?
以下是我的POM中的属性和构建选项,用于配置junit 5和maven surefire插件:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<service-layer-version>1.0</service-layer-version>
<hibernate.version>5.2.16.Final</hibernate.version>
<servlet.version>3.1.0</servlet.version>
<maven-surefire-plugin.version>2.21.0</maven-surefire-plugin.version>
<junit-platform.version>1.1.0</junit-platform.version>
<junit-jupiter.version>5.1.0</junit-jupiter.version>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>process</id>
<phase>generate-sources</phase><!-- this is actually the default, could be omitted -->
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/generated-sources/metamodel</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>${hibernate.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>**/Test*.java</include>
<include>**/Test*.kt</include>
<include>**/Tests*.java</include>
<include>**/Tests*.kt</include>
</includes>
<properties>
<includeTags>junit5</includeTags>
<excludeTags>integration-test</excludeTags>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>