报表门户的依赖性错误是什么



我有Cucumber Jbehavior测试自动化框架,我正在尝试与Report Portal同步。我更新了pom.xml、log4j2.xml和ReportPortal.properties文件。如果我在AllStories中注释掉行reportPortalScenario.instance,则测试运行良好。我以前从未使用过改装。请告诉我我缺了什么。提前感谢

但是,当我使用ReportPortalScenarioFormat.INSTANCE运行测试时,我看到以下错误

[ERROR] Failed to execute goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables (embeddable-stories) on project insights-acceptance-tests: Execution embeddable-stories of goal org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables failed: A required class was missing while executing org.jbehave:jbehave-maven-plugin:4.8.1:run-stories-as-embeddables: retrofit2/adapter/rxjava2/RxJava2CallAdapterFactory
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.jbehave:jbehave-maven-plugin:4.8.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-maven-plugin/4.8.1/jbehave-maven-plugin-4.8.1.jar
[ERROR] urls[1] = file:/C:/jpt/m2/repo/org/jbehave/jbehave-core/4.8.1/jbehave-core-4.8.1.jar
[ERROR] urls[2] = file:/C:/jpt/m2/repo/junit/junit/4.13.1/junit-4.13.1.jar
[ERROR] urls[3] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] urls[4] = file:/C:/jpt/m2/repo/org/hamcrest/hamcrest/2.1/hamcrest-2.1.jar
[ERROR] urls[5] = file:/C:/jpt/m2/repo/commons-io/commons-io/2.6/commons-io-2.6.jar
[ERROR] urls[6] = file:/C:/jpt/m2/repo/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar
[ERROR] urls[7] = file:/C:/jpt/m2/repo/org/apache/commons/commons-text/1.3/commons-text-1.3.jar
[ERROR] urls[8] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[9] = file:/C:/jpt/m2/repo/org/freemarker/freemarker/2.3.28/freemarker-2.3.28.jar
[ERROR] urls[10] = file:/C:/jpt/m2/repo/com/thoughtworks/paranamer/paranamer/2.8/paranamer-2.8.jar
[ERROR] urls[11] = file:/C:/jpt/m2/repo/com/thoughtworks/xstream/xstream/1.4.14/xstream-1.4.14.jar
[ERROR] urls[12] = file:/C:/jpt/m2/repo/xmlpull/xmlpull/1.1.3.1/xmlpull-1.1.3.1.jar
[ERROR] urls[13] = file:/C:/jpt/m2/repo/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
[ERROR] urls[14] = file:/C:/jpt/m2/repo/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
[ERROR] urls[15] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-interpolation/1.1/plexus-interpolation-1.1.jar
[ERROR] urls[16] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
[ERROR] urls[17] = file:/C:/jpt/m2/repo/org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar
[ERROR] urls[18] = file:/C:/jpt/m2/repo/org/apache/maven/skins/maven-default-skin/1.0/maven-default-skin-1.0.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :insights-acceptance-tests
Process finished with exit code 1

这是我的pom.xml

ependencies>
<dependency>
<groupId>com.epam.reportportal</groupId>
<artifactId>agent-java-jbehave</artifactId>
<version>5.1.1</version>
</dependency>
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-core</artifactId>
<version>${jbehave.core.version}</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>insights-application-driver</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.3.2</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<dependency>
<groupId>com.mastercard.commercial.ta</groupId>
<artifactId>tenon-io-lib</artifactId>
<version>3.1.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc10</artifactId>
<version>19.3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.17.1</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.17.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-maven-plugin</artifactId>
<version>${jbehave.core.version}</version>
<executions>
<execution>
<id>embeddable-stories</id>
<phase>test</phase>
<configuration>
<includes>
<include>${embeddables}</include>
</includes>
<excludes/>
<ignoreFailureInStories>true</ignoreFailureInStories>
<ignoreFailureInView>false</ignoreFailureInView>
<threads>1</threads>
<metaFilters>
<metaFilter>${meta.filter}</metaFilter>
</metaFilters>
</configuration>
<goals>
<goal>run-stories-as-embeddables</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration packages="com.epam.ta.reportportal.log4j.appender" status="WARN">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</Console>
<ReportPortalLog4j2Appender name="ReportPortalAppender">
<PatternLayout
pattern="%d [%t] %-5level %logger{36} - %msg%n%throwable"/>
</ReportPortalLog4j2Appender>
</Appenders>
<Loggers>
<Root level="DEBUG">
<AppenderRef ref="ConsoleAppender" level="info"/>
<AppenderRef ref="ReportPortalAppender"/>
</Root>
</Loggers>
</Configuration>

所有Stories.java

public class AllStories extends AdapterUiStories {
/** Set STORY_NAME as "*" to execute all stories. */
private static final String STORY_NAME = "*";
/** This method will select the stories to be executed or re-executed. */
@Override
public List<String> storyPaths() {
String storyPaths = System.getProperty(STORY_PATHS_PROP);
if (storyPaths == null) {
return new StoryFinder()
.findPaths(
CodeLocations.codeLocationFromClass(this.getClass()),
String.format("stories/**/%s.story", STORY_NAME.trim().toLowerCase()),
"");
}
return Arrays.asList(storyPaths.split(FailedStoriesReporter.PATHS_BREAKER));
}
@Override
public Configuration configuration() {
MostUsefulConfiguration configuration = new MostUsefulConfiguration();
configuration.useStoryReporterBuilder(getStoryReporterBuilder(configuration))
.useStoryLoader(new LoadFromClasspath(this.getClass()));
return configuration;
}
private StoryReporterBuilder getStoryReporterBuilder(MostUsefulConfiguration configuration) {
return configuration.storyReporterBuilder()
.withCodeLocation(CodeLocations.codeLocationFromPath("build/reports/jbehave"))
.withDefaultFormats()
.withFormats(Format.HTML, Format.CONSOLE, ReportPortalScenarioFormat.INSTANCE);
}
@Override
protected StoryReporterBuilder getStoryReporterBuilder() {
return super.getStoryReporterBuilder()
.withFailureTraceCompression(false)
.withFailureTrace(true)
.withDefaultFormats();
}
@Override
public ApplicationContext getAnnotatedApplicationContext() {
return new AnnotationConfigApplicationContext(ApplicationConfig.class);
}

您必须为jbehave指定额外的依赖项。请看一下我们的例子:https://github.com/reportportal/examples-java/blob/master/example-jbehave/pom.xml#L56

我发表了一条评论:;由于未知原因,"jbehave-maven插件"没有看到这些依赖关系;。这里没有什么要添加的,只是插件中的某种bug。

最新更新