我对multimodule maven项目有一个奇怪的问题。它由几个模块(16个模块)组成,有三个模块无法一起成功构建(让我们将它们命名为A,B,C),因为C失败了。当我从项目中删除模块A或B时,构建成功。当只构建A,B,C时,构建也是成功的(我使用 mvn -pl A,B,C clean install )。最奇怪的是只在Mac上观察到的问题。模块A,B,C中的每一个都包含几个JBehave功能测试。故事由集成测试阶段的jbehave-maven-plugin启动。每个故事都测试由cargo-maven-plugin部署的SOAP Web服务。以下是jbehave嵌入代码:
public class SampleEmbedder extends Embedder {
@Override
public EmbedderControls embedderControls() {
return new EmbedderControls().doIgnoreFailureInStories(true).doIgnoreFailureInView(true);
}
@Override
public Configuration configuration() {
Class<? extends SampleEmbedder> embedderClass = this.getClass();
return new MostUsefulConfiguration()
.useStoryLoader(new LoadFromClasspath(embedderClass.getClassLoader()))
.useStoryReporterBuilder(new StoryReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromClass(embedderClass))
.withDefaultFormats()
.withFormats(CONSOLE, TXT, HTML, XML)
.withCrossReference(new CrossReference()))
.useParameterConverters(new ParameterConverters()
.addConverters(new DateConverter(new SimpleDateFormat("yyyy-MM-dd")))) // use custom date pattern
.useStepMonitor(new SilentStepMonitor())
.usePendingStepStrategy(new FailingUponPendingStep()
);
}
@Override
public InjectableStepsFactory stepsFactory() {
return new SpringStepsFactory(configuration(), createContext());
}
private ApplicationContext createContext() {
return new SpringApplicationContextFactory("spring/application-context.xml").createApplicationContext();
}
}
当我从B中删除所有故事并注释掉步骤类中的所有代码时,问题就消失了。也许这是由春天的背景或其他因素造成的。我很长时间都无法摆脱这个问题。所以,问题是,我该如何解决这个问题或原因是什么?