我在运行maven项目的单元测试时遇到问题。
该项目曾经是一个pom。我将它分成三个poms。
我的maven是这样的。这些poms中有三个看起来都像这样。
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>client</artifactId>
<version>1.0</version>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>base-pom</artifactId>
<relativePath>../../build/shared/pom.xml</relativePath>
<version>1.0</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
<forkMode>never</forkMode>
<useFile>false</useFile>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
....
</dependencies>
顶级pom是:
<groupId>com.mycompany</groupId>
<artifactId>project</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<modules>
<module>modules/shared</module>
<module>modules/client</module>
<module>modules/adapter</module>
</modules>
所有模块共享的父POM是:
<groupId>com.mycompany</groupId>
<artifactId>base-pom</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<parent>
<groupId>com.mycompany</groupId>
<artifactId>mycompany-parent</artifactId>
<version>1.0.8</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.sourceEncoding>UTF-8</project.reporting.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
...
</dependencyManagement>
当只有一个POM时它用于工作。这是什么问题?
非常感谢