简体   繁体   中英

What is this dependency error with Report portal?

I have Cucumber Jbehave Test Automation framework which I am trying to sync up with Report Portal. I updated pom.xml, log4j2.xml and ReportPortal.properties file. If I comment out the line reportPortalScenario.instance in AllStories, test is running fine. I never used retrofit before. Please tell me what am I missing. Thanks in Advance

But when I run a test with ReportPortalScenarioFormat.INSTANCE , I see the below error

[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


This is my 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>

All 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);
  }

You have to specify additional dependencies for jbehave. Please take a look on our example here: https://github.com/reportportal/examples-java/blob/master/example-jbehave/pom.xml#L56

I've put a comment: "For unknown reason 'jbehave-maven-plugin' does not see these dependencies". Nothing to add here, it's just some kind of bug inside the plugin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM