Unable to generate the extent-report - java

Using the plugin com.vimalselvam.cucumber.listener.ExtentCucumberFormatter (the only that worked for me), my report is generated but with several errors on the log of intellij
I've tried to generate the report with a scenario not defined (just for the speed). Using more than one plugin, as the plugin
These are the depencies I'm using:
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.9</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.7</version>
</dependency>
#CucumberOptions(plugin = {"com.vimalselvam.cucumber.listener.ExtentCucumberFormatter:output/report.html")
#AfterClass
public static void writeExtentReport() {
Reporter.loadXMLConfig(new File("path/extent-config.xml"));
}
The errors:
log4j:WARN No appenders could be found for logger (freemarker.cache).
log4j:WARN Please initialize the log4j system properly.
java.lang.NoSuchMethodError: com.aventstack.extentreports.reporter.ExtentHtmlReporter.loadXMLConfig(Ljava/io/File;)V
at com.vimalselvam.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:66)
at test.runner.TestRunner.writeExtentReport(TestRunner.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:33)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at cucumber.api.junit.Cucumber.run(Cucumber.java:100)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
java.lang.NullPointerException
at com.vimalselvam.cucumber.listener.ExtentCucumberFormatter.result(ExtentCucumberFormatter.java:252)...

You are using vimal, avenstack and adapter dependencies all together in pom.xml which is not advisable and expected. One shall use vimal or avenstack or both together in specific use case or use adapter dependency only. Please follow below instructions.
Vimal Selvam Library: Below is the required maven dependency and a sample test to demonstrate how configuration set up is done.
Maven Dependency
<dependency>
<groupId>com.vimalselvam</groupId>
<artifactId>cucumber-extentsreport</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>4.0.9</version>
</dependency>
Please note that Java 8+ and adding the dependency of ExtentReport v3.1.1+ is mandatory.
Cucumber Runner File
#RunWith(Cucumber.class)
#CucumberOptions(
features = {"src/test/resources/features"},
glue = {"com.cucumber.stepdefinitions"},
plugin = {"com.cucumber.listener.ExtentCucumberFormatter:output/report.html"}
)
public class RunCukesTest {
#AfterClass
public static void teardown() {
Reporter.loadXMLConfig(new File("src/test/resources/extent-config.xml"));
Reporter.setSystemInfo("user", System.getProperty("user.name"));
Reporter.setSystemInfo("os", "Mac OSX");
Reporter.setTestRunnerOutput("Sample test runner output message");
}
}
The above setup will generate the report in output directory with the name of report.html.
Please remove adapter dependency from pom.xml. We shall use vimal/avenstack or extent adapter but not all together.
Extent Adapter: Beauty is, you do not need to write any code any where to generate report this way except from setting adapter in runner below.
Maven Dependency
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.6</version>
</dependency>
Add the com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter plugin to the runner.
#RunWith(Cucumber.class)
#CucumberOptions(plugin = {"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:"})
public class RunCukesTest {
// ..
}
Report Output Directory - ../Project Directory/test-output/HtmlReport
Additional Note: In future, we would request you to use Cucumber v>=4.0.0 as you are using pretty old dependency(v1.2.5) of Cucumber.
For doing so, you can add below set of cucumber minimal dependencies.
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>4.2.6</version>
<scope>test</scope>
</dependency>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuraton>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
<configuration>
<configuration>
<parallel>classes</parallel>
<threadCount>2</threadCount>
</configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.10.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>CucumberWebGui</projectName>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cucumber.version>4.8.0</cucumber.version>
<!-- <extentreports.version>5.0.3</extentreports.version> -->
</properties>
<dependencies>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>gherkin</artifactId>
<version>2.12.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<!-- <scope>test</scope> -->
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-testng -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>klov-reporter</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports-cucumber4-adapter</artifactId>
<version>1.0.11</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
<scope>provided</scope>
</dependency>
<!-- <dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.4-SNAPSHOT</version>
<version>4.0.9</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>4.10.0</version>
</dependency>
<!-- <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency> -->
</dependencies>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<name>WebAutomation</name>
<url>http://maven.apache.org</url>
<description>Web Automation Framework</description>
<organization>
<name>MidTrans Demo</name>
</organization>
</project>

Related

java.lang.NoClassDefFoundError gherkin/ParserException - Can't run cucumber test

``
<?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>############<</groupId>
<artifactId>############</artifactId>
<version>1.0.16-SNAPSHOT</version>
<name>############</name>
<properties>
<!--Plugin Config-->
<allure.html.report.output>${project.basedir}/target/results/allure-html</allure.html.report.output>
<allure.json.results.output>${project.basedir}/allure-results</allure.json.results.output>
<slf4j.version>2.0.3</slf4j.version>
<logback.version>1.4.4</logback.version>
<selenium.version>4.5.3</selenium.version>
<testng.version>7.5</testng.version>
<assertj.version>3.23.1</assertj.version>
<wdm.version>5.1.0</wdm.version>
<awaitility.version>4.2.0</awaitility.version>
<browsermob.version>2.1.5</browsermob.version>
<zapclient.version>1.10.0</zapclient.version>
<axel.version>4.4.2</axel.version>
<javafaker.version>1.0.2</javafaker.version>
<extentreports.version>5.0.9</extentreports.version>
<allure.version>2.19.0</allure.version>
<allure-maven.version>2.11.2</allure-maven.version>
<cucumber.version>7.9.0</cucumber.version>
<java-client.version>8.2.0</java-client.version>
<rest-assured.version>5.2.0</rest-assured.version>
<lombok.version>1.18.24</lombok.version>
<selenium-support.version>4.5.3</selenium-support.version>
<webdrivermanager.version>5.3.0</webdrivermanager.version>
<selenium-chrome-driver.version>4.5.3</selenium-chrome-driver.version>
<maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
<maven-resources-plugin.version>3.2.0</maven-resources-plugin.version>
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
<maven-cucumber-reporting.version>7.9.0</maven-cucumber-reporting.version>
<maven-jar-plugin.version>3.2.2</maven-jar-plugin.version>
<maven-install-plugin.version>2.5.2</maven-install-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-site-plugin.version>3.12.0</maven-site-plugin.version>
<maven-project-info-reports-plugin.version>3.3.0</maven-project-info-reports-plugin.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
<java.version>17</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<spotless-maven-plugin.version>2.22.8</spotless-maven-plugin.version>
<browserstack-local-java.version>1.0.6</browserstack-local-java.version>
<project.encondig>UTF-8</project.encondig>
<project.build.sourceEncoding>${project.encondig}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${project.encondig}</project.reporting.outputEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<commons-codec.version>1.15</commons-codec.version>
<aspectj.version>1.9.7</aspectj.version>
</properties>
<profiles>
<!-- Vendor profiles-->
<profile>
<id>browserstack</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testrunner/AdminTestng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemProperties>
<property>
<name>cucumber.plugin</name>
<value>json:target/cucumber.json,io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm</value>
</property>
<property>
<name>cucumber.filter.tags</name>
<value>#test</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-grid</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>${awaitility.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.lightbody.bmp</groupId>
<artifactId>browsermob-core</artifactId>
<version>${browsermob.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.zaproxy</groupId>
<artifactId>zap-clientapi</artifactId>
<version>${zapclient.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.deque.html.axe-core</groupId>
<artifactId>selenium</artifactId>
<version>${axel.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.javafaker</groupId>
<artifactId>javafaker</artifactId>
<version>${javafaker.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>${extentreports.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>${java-client.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>${selenium-support.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>${webdrivermanager.version}</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>com.browserstack</groupId>
<artifactId>browserstack-local-java</artifactId>
<version>${browserstack-local-java.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>${selenium-chrome-driver.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>${cucumber.version}</version>
</dependency>
<!-- jackson-databind: Work around for security vulnerability on io.github.bonigarcia:webdrivermanager#5.2.0 (current latest) -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.14.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/datatable -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>datatable</artifactId>
<version>7.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jdk8 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
<version>2.14.0</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber5-jvm</artifactId>
<version>2.20.1</version>
<exclusions>
<exclusion>
<groupId>io.cucumber</groupId>
<artifactId>gherkin</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>6.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>6.0.0</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${maven-clean-plugin.version}</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<!-- Source code linting using Spotless -->
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>${spotless-maven-plugin.version}</version>
<configuration>
<java>
<removeUnusedImports/>
<googleJavaFormat>
<style>GOOGLE</style>
<reflowLongStrings>true</reflowLongStrings> <!-- optional (requires at least 1.8) -->
<!-- optional: custom group artifact (you probably don't need this) -->
<groupArtifact>com.google.googlejavaformat:google-java-format</groupArtifact>
</googleJavaFormat>
</java>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>4</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
<forkCount>4</forkCount>
<reuseForks>false</reuseForks>
<argLine>-Duser.language=en</argLine>
<argLine>-Xmx1024m</argLine>
<argLine>-XX:MaxPermSize=256m</argLine>
<argLine>-Dfile.encoding=UTF-8</argLine>
<useFile>false</useFile>
<testFailureIgnore>false</testFailureIgnore>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm"
</argLine>
</configuration>
</execution>
<execution>
<id>cucumberJsonParser</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<threadCount>1</threadCount>
<perCoreThreadCount>true</perCoreThreadCount>
<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
<useFile>false</useFile>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.test.automation.cucumber.allure.Beautify</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>2.10.0</version>
<configuration>
<reportVersion>2.10.0</reportVersion>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>${maven-cucumber-reporting.version}</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<skip>true</skip>
<projectName>cucumbertests</projectName>
<checkBuildResult>false</checkBuildResult>
<outputDirectory>target/report</outputDirectory>
<jsonFiles>
<param>cucumber.json</param>
</jsonFiles>
<!--enableFlashCharts>false</enableFlashCharts-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
``
I am running my cucumber selenium project with mvn clean test -P <profile_name>
When I run the test I get the below error:
[ERROR] TestRunner>AbstractTestNGCucumberTests.setUpClass:27 ? Cucumber java.lang.NoClassDefFoundError: gherkin/ParserException
I have attached my dependency tree pic and also attached the gherkin/parserexception class in my libraries
I am running my cucumber selenium project with mvn clean test -P <profile_name>
When I run the test I get the below error:
[ERROR] TestRunner>AbstractTestNGCucumberTests.setUpClass:27 ? Cucumber java.lang.NoClassDefFoundError: gherkin/ParserException
I have attached my dependency tree pic and also attached the gherkin/parserexception class in my libraries
Thanks os much for your time in reaidng my question and trying to attempt Mr. M.P. Korstanje
I managed to come over the problem. I have changed the cucumber versin to 7 and allurecucumberjvm version to 7 as well and luckily dont get the error any more. Though I get a stepdef error message as below which i will try to solve.
threw exception with message: Input must be set
Thanks again for your time

Cucumber steps is not shown at allure report as expected

all I'm creating API tests using the following tools:
TestNG
Cucumber
Allure report
Rest assured
tests execution can be done using testNG suites.
after the test is executed I'm creating the allure report using the maven command
mvn allure:report
but the allure steps are not generated in the report as expected please see the following screen-shot
while my goal is to have this reporting structure:
here is test code example
#Test
#CucumberOptions (features="src/main/java/com/abc/tests/caseTest/caseTest.feature"
,glue={"com.tests.caseTest"}
,plugin={"pretty", "html:target/cucumber-reports"
, "html:target/cucumber-html-reports"
,"rerun:target/failed_scenarios.txt"}
)
public class CaseTest extends AbstractTestNGCucumberTests {
}
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<rest-assured.version>5.1.1</rest-assured.version>
<allure.testng.version>2.19.0</allure.testng.version>
<allure.rest-assured.version>2.19.0</allure.rest-assured.version>
<jackson.version>2.12.3</jackson.version>
<json.version>20210307</json.version>
<maven.compiler.plugin.version>3.5.1</maven.compiler.plugin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<aspectj.version>1.9.7</aspectj.version>
<assertj-core.version>3.23.1</assertj-core.version>
<elasticsearch-client.version>7.17.0</elasticsearch-client.version>
<maven-surefire-plugin-version>3.0.0-M5</maven-surefire-plugin-version>
<cucumber.version>7.9.0</cucumber.version>
<cucumber-testng.version>7.9.0</cucumber-testng.version>
<allure-cucumber-jvm.version>2.20.0</allure-cucumber-jvm.version>
</properties>
<dependencies>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-rest-assured</artifactId>
<version>${allure.rest-assured.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.automatedowl</groupId>
<artifactId>allure-environment-writer</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber-testng.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber-jvm</artifactId>
<version>${allure-cucumber-jvm.version}</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-testng</artifactId>
<version>${allure.testng.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>${json.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<configuration>
<buildDirectory>${project.basedir}</buildDirectory>
</configuration>
<version>2.10.0</version>
</plugin>
<plugin> <!-- This plugin is very important for Allure attachments and steps -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin-version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>TestNG.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Feature: Case creation update and pemissions
Scenario: create new case from Search
Given User get list of ecomms
When User create case using 3 ecomms from the list
Then Response body should be valid with response code 200
And Case should include 3 ecomms taken from search api
In one of the projects I use the following depedencies and plugins and everything works good.
<dependencies>
<!--Cucumber Dependencies-->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<!--Selenium Dependency-->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<!--Cucumber TestNG Dependency-->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-testng</artifactId>
<version>${cucumber.version}</version>
<scope>test</scope>
</dependency>
<!--Hamcrest Dependency-->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<!--Allure Cucumber Dependency-->
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber5-jvm</artifactId>
<version>${allure.cucumber5.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.plugin.version}</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>TestNG.xml</suiteXmlFile>
</suiteXmlFiles>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumber5jvm.AllureCucumber5Jvm"
</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-maven</artifactId>
<version>${allure.maven.version}</version>
<configuration>
<reportVersion>${allure.version}</reportVersion>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<selenium.version>3.141.59</selenium.version>
<cucumber.version>5.7.0</cucumber.version>
<testng.version>7.4.0</testng.version>
<allure.cucumber5.version>2.14.0</allure.cucumber5.version>
<maven.compiler.plugin.version>3.5.1</maven.compiler.plugin.version>
<maven.surefire.plugin.version>3.0.0-M5</maven.surefire.plugin.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<aspectj.version>1.9.6</aspectj.version>
<allure.maven.version>2.10.0</allure.maven.version>
</properties>

Lombok + QueryDsl + Mapstruct: error compiling: java.lang.NoClassDefFoundError: javax/persistence/Entity: javax.persistence.Entity

Here is the error during maven compile
error compiling: java.lang.NoClassDefFoundError: javax/persistence/Entity: javax.persistence.Entity
I deleted all entity classes and compile was ok.
Is it a bug in annotation processor?
I tried different combinations for annotation processors order.
And here is my full pom xml file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.4</version>
</parent>
<groupId>io.x</groupId>
<artifactId>xx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xx</name>
<description>CRUD API and logic for xx</description>
<properties>
<java.version>16</java.version>
<base-service-with-all-entities.version>1.0.74-SNAPSHOT</base-service-with-all-entities.version>
<base-test-service.version>0.0.9-SNAPSHOT</base-test-service.version>
<feign.version>11.6</feign.version>
<eureka-client.version>1.10.16</eureka-client.version>
<spring-cloud-starter-netflix-ribbon.version>2.2.9.RELEASE</spring-cloud-starter-netflix-ribbon.version>
<querydsl.version>5.0.0</querydsl.version>
<postgresql.version>42.2.23.jre7</postgresql.version>
<liquibase-core.version>4.4.1</liquibase-core.version>
<nv-i18n.version>1.28</nv-i18n.version>
<springfox.version>3.0.0</springfox.version>
<mapstruct.version>1.5.0.Beta1</mapstruct.version>
<commons-codec.version>1.15</commons-codec.version>
<docker.image.name>xxx/${artifactId}</docker.image.name>
<!--suppress UnresolvedMavenProperty -->
<docker.artifact.version>${git.branch}_${git.commit.time}-${git.commit.id.abbrev}</docker.artifact.version>
<docker.image.tag>${docker.artifact.version}</docker.image.tag>
<testcontainers.version>1.15.3</testcontainers.version>
<lombok.version>1.18.20</lombok.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>2020.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-bom</artifactId>
<version>${testcontainers.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<repositories>
<repository>
<id>snapshots</id>
<url>https://nexus.y.com/repository/maven-snapshots/</url>
</repository>
<repository>
<id>releases</id>
<url>https://nexus.y.com/repository/maven-releases/</url>
</repository>
</repositories>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>https://nexus.y.com/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>releases</id>
<url>https://nexus.y.com/repository/maven-releases/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>io.x</groupId>
<artifactId>base-service-with-all-entities</artifactId>
<version>${base-service-with-all-entities.version}</version>
</dependency>
<dependency>
<groupId>io.x</groupId>
<artifactId>base-test-service</artifactId>
<version>${base-test-service.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-okhttp</artifactId>
<version>${feign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-gson</artifactId>
<version>${feign.version}</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-slf4j</artifactId>
<version>${feign.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>com.neovisionaries</groupId>
<artifactId>nv-i18n</artifactId>
<version>${nv-i18n.version}</version>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<version>${liquibase-core.version}</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>${querydsl.version}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox.version}</version>
</dependency>
<dependency>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct</artifactId>
<version>${mapstruct.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.7</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.springtestdbunit</groupId>
<artifactId>spring-test-dbunit</artifactId>
<version>1.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.7.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId>
<version>1.16.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>4.9.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${parent.version}</version>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<jvmArguments>--enable-preview</jvmArguments>
<mainClass>io.x.xx.Application</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.13</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<repository>${docker.image.name}</repository>
<tag>${docker.image.tag}</tag>
<contextDirectory>target/dockerbuild</contextDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>16</source>
<target>16</target>
<compilerArgs>
<arg>-Xlint:all</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg>
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED</arg>
<compilerArg>--enable-preview</compilerArg>
<compilerArg>-Amapstruct.defaultComponentModel=spring</compilerArg>
</compilerArgs>
<annotationProcessors>
<annotationProcessor>com.querydsl.apt.jpa.JPAAnnotationProcessor</annotationProcessor>
<annotationProcessor>lombok.launch.AnnotationProcessorHider$AnnotationProcessor
</annotationProcessor>
<annotationProcessor>org.mapstruct.ap.MappingProcessor</annotationProcessor>
</annotationProcessors>
<annotationProcessorPaths>
<path>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>${querydsl.version}</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
<path>
<groupId>org.mapstruct</groupId>
<artifactId>mapstruct-processor</artifactId>
<version>${mapstruct.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<argLine>--enable-preview</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>get-the-git-info</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<offline>true</offline>
<useNativeGit>true</useNativeGit>
<dateFormat>yyyyMMdd</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>target/git.properties</generateGitPropertiesFilename>
<commitIdGenerationMode>full</commitIdGenerationMode>
<injectAllReactorProjects>true</injectAllReactorProjects>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>target/dockerbuild</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}</directory>
<include>Dockerfile</include>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
<resource>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<Build-Version>${docker.image.tag}</Build-Version>
<Build-Revision>${docker.image.tag}</Build-Revision>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
QueryDsl does not declare a dependency to the JPA API. Maybe this is a bug. To fix this issue add the dependency manually as a path element to the annotationProcessorPaths. The annotation processor dependencies and the Maven dependencies are distinct, hence adding it as a dependency or plugin dependency does not work.
The example is processing it in a separate phase. You can also include it in the default Maven compiler plugin configuration.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<id>querydsl</id>
<goals>
<goal>compile</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<proc>only</proc>
<annotationProcessorPaths>
<path>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<classifier>jpa</classifier>
<version>${querydsl.version}</version>
</path>
<!-- querydsl is not declaring a dependency to JPA-->
<path>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
<version>2.2.3</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
You have to use the version 5.0.0 and just add classifier 'jakarta' to jpa or/and apt querydsl dependencies.
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<classifier>jakarta</classifier>
</dependency>
You don't seem to have a dependency to JPA declared. QueryDSL expects the API to be provided by the application. You can fix this by declaring a dependency to the JPA API:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
Although usually javax.persistence:javax.persistence-api will be provided transitively through your JPA implentation (i.e. your dependency on hibernate-core).

how to load org.springframework.jdbc.core.RowMapper library

I am trying to execute an open source apache project
i am stopped at an error
Error:(34, 37) java: package org.springframework.jdbc.core does not exist
I tried to load this library but could not find it anywhere
I checked this link
Can't import org.springframework.jdbc.core with maven
they talk about another libarary spring-jdbc !!
where can i find the needed library
I have been working on this for 5 days and no luck
POM.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
http://www.apache.org/licenses/LICENSE-2.0
-->
<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>org.apache.ctakes</groupId>
<artifactId>ctakes</artifactId>
<version>4.0.0</version>
<packaging>pom</packaging>
<name>Apache cTAKES</name>
<url>http://ctakes.apache.org</url>
<inceptionYear>2012</inceptionYear>
<scm>
<!-- In child modules, Maven will append ${artifactId} to the following
URLs -->
<connection>scm:svn:https://svn.apache.org/repos/asf/ctakes/tags/ctakes-4.0.0-rc3</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/ctakes/tags/ctakes-4.0.0-rc3</developerConnection>
<url>https://svn.apache.org/repos/asf/ctakes/tags/ctakes-4.0.0-rc3</url>
</scm>
<issueManagement>
<system>jira</system>
<url>https://issues.apache.org/jira/browse/ctakes</url>
</issueManagement>
<ciManagement>
<system>jenkins</system>
<url>https://builds.apache.org/job/ctakes-trunk/</url>
</ciManagement>
<mailingLists>
<mailingList>
<name>Apache cTAKES Users</name>
<subscribe>user-subscribe#ctakes.apache.org</subscribe>
<unsubscribe>user-unsubscribe#ctakes.apache.org</unsubscribe>
<post>user#ctakes.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/ctakes-user/</archive>
</mailingList>
<mailingList>
<name>Apache cTAKES Developers</name>
<subscribe>dev-subscribe#ctakes.apache.org</subscribe>
<unsubscribe>dev-unsubscribe#ctakes.apache.org</unsubscribe>
<post>dev#ctakes.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/ctakes-dev/</archive>
</mailingList>
<mailingList>
<name>Apache cTAKES Commits</name>
<subscribe>commits-subscribe#ctakes.apache.org</subscribe>
<unsubscribe>commits-unsubscribe#ctakes.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/ctakes-commits/</archive>
</mailingList>
<mailingList>
<name>Apache cTAKES Notifications</name>
<subscribe>notifications-subscribe#ctakes.apache.org</subscribe>
<unsubscribe>notifications-unsubscribe#ctakes.apache.org</unsubscribe>
<archive>http://mail-archives.apache.org/mod_mbox/ctakes-notifications/</archive>
</mailingList>
</mailingLists>
<properties>
<ctakes.version>4.0.0</ctakes.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>13</version>
</parent>
<modules>
<module>ctakes-gui</module>
<module>ctakes-gui-res</module>
<module>ctakes-utils</module>
<module>ctakes-core</module>
<module>ctakes-type-system</module>
<module>ctakes-pos-tagger</module>
<module>ctakes-chunker</module>
<module>ctakes-preprocessor</module>
<module>ctakes-dictionary-lookup</module>
<module>ctakes-context-tokenizer</module>
<module>ctakes-lvg</module>
<module>ctakes-ne-contexts</module>
<module>ctakes-constituency-parser</module>
<module>ctakes-coreference</module>
<module>ctakes-drug-ner</module>
<module>ctakes-side-effect</module>
<module>ctakes-smoking-status</module>
<module>ctakes-dependency-parser</module>
<module>ctakes-relation-extractor</module>
<module>ctakes-assertion</module>
<module>ctakes-assertion-zoner</module>
<module>ctakes-temporal</module>
<module>ctakes-clinical-pipeline</module>
<module>ctakes-clinical-pipeline-res</module>
<module>ctakes-distribution</module>
<module>ctakes-regression-test</module>
<module>ctakes-assertion-res</module>
<module>ctakes-chunker-res</module>
<module>ctakes-constituency-parser-res</module>
<module>ctakes-core-res</module>
<module>ctakes-coreference-res</module>
<module>ctakes-dependency-parser-res</module>
<module>ctakes-dictionary-lookup-res</module>
<module>ctakes-lvg-res</module>
<module>ctakes-pos-tagger-res</module>
<module>ctakes-relation-extractor-res</module>
<module>ctakes-side-effect-res</module>
<module>ctakes-smoking-status-res</module>
<module>ctakes-temporal-res</module>
<module>ctakes-assertion-zoner-res</module>
<module>ctakes-drug-ner-res</module>
<module>ctakes-ne-contexts-res</module>
<module>ctakes-template-filler</module>
<module>ctakes-examples</module>
<module>ctakes-examples-res</module>
<module>ctakes-ytex-res</module>
<module>ctakes-ytex</module>
<module>ctakes-ytex-uima</module>
<module>ctakes-ytex-web</module>
<module>ctakes-dictionary-lookup-fast</module>
<module>ctakes-dictionary-lookup-fast-res</module>
</modules>
<dependencyManagement>
<dependencies>
<!-- cTAKES third party dependency versions -->
<!-- <dependency> <groupId>jama</groupId> <artifactId>jama</artifactId>
<version>1.0.2</version> </dependency> -->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-jdbc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun/tools -->
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.5.0</version>
<scope>system</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- There is an xml=apis 2.0 in maven central, but it is pom only, therefore broken. -->
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<!-- TODO : Remove jdom and refactor code to jdom2 -->
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-maxent</artifactId>
<version>3.0.3</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.apache.uima</groupId>-->
<!--<artifactId>uimaj-examples</artifactId>-->
<!--<version>2.9.0</version>-->
<!--</dependency>-->
<dependency>
<groupId>tw.edu.ntu.csie</groupId>
<artifactId>libsvm</artifactId>
<version>3.1</version>
</dependency>
<!-- import a consistent set of versions for all ClearTK modules -->
<dependency>
<groupId>org.cleartk</groupId>
<artifactId>cleartk</artifactId>
<version>2.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.0.16</version>
</dependency>
<dependency>
<groupId>com.lexicalscope.jewelcli</groupId>
<artifactId>jewelcli</artifactId>
<version>0.8.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>10.0</version>
</dependency>
<dependency>
<groupId>com.carrotsearch</groupId>
<artifactId>hppc</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>edu.mit.findstruct</groupId>
<artifactId>structmulti</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>edu.mit.findstruct</groupId>
<artifactId>findstructapi</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>com.googlecode.armbrust-file-utils</groupId>
<artifactId>sqlwrapper</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.openai</groupId>
<artifactId>openaifsm</artifactId>
<version>0.0.1</version>
</dependency>
<dependency>
<groupId>gov.nih.nlm.nls.lvg</groupId>
<artifactId>lvgdist</artifactId>
<version>2016.0</version>
</dependency>
<dependency>
<groupId>com.googlecode.clearnlp</groupId>
<artifactId>clearnlp</artifactId>
<version>1.3.1</version>
</dependency>
<!-- cTAKES module versions -->
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-gui</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-gui-res</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-examples</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-examples-res</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-type-system</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-utils</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-core</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-core-res</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-dictionary-lookup</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-dictionary-lookup-res</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-dictionary-lookup-fast</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-dictionary-lookup-fast-res</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-preprocessor</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-assertion-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-assertion-zoner
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-assertion-zoner-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-constituency-parser
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-constituency-parser-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-relation-extractor
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-relation-extractor-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-temporal
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-temporal-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-ytex-res
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-ytex
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-ytex-uima
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-ytex-web
</artifactId>
<version>${ctakes.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ctakes</groupId>
<artifactId>
ctakes-distribution
</artifactId>
<version>${ctakes.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<!-- It's good practice to explicitly declare versions for all plugins -->
<pluginManagement>
<plugins>
<plugin>
<groupId>com.mycila.maven-license-plugin</groupId>
<artifactId>maven-license-plugin</artifactId>
<version>1.9.0</version>
<configuration>
<header>ctakes-distribution/src/main/config/license_header.txt</header>
<excludes>
<!-- We're disabling .txt files for now because some Annotators may
not be able to handle standard comments in text files. This may break name
values pairs such as stopWords.txt -->
<exclude>**.txt</exclude>
</excludes>
<useDefaultMapping>false</useDefaultMapping>
<quiet>false</quiet>
<failIfMissing>false</failIfMissing>
<mapping>
<java>JAVADOC_STYLE</java>
<groovy>JAVADOC_STYLE</groovy>
<js>JAVADOC_STYLE</js>
<css>JAVADOC_STYLE</css>
<xml>XML_STYLE</xml>
<dtd>XML_STYLE</dtd>
<xsd>XML_STYLE</xsd>
<html>XML_STYLE</html>
<htm>XML_STYLE</htm>
<xsl>XML_STYLE</xsl>
<fml>XML_STYLE</fml>
<apt>DOUBLETILDE_STYLE</apt>
<properties>SCRIPT_STYLE</properties>
<sh>SCRIPT_STYLE</sh>
<!-- <txt>TEXT</txt> -->
<bat>BATCH</bat>
<cmd>BATCH</cmd>
<sql>DOUBLEDASHES_STYLE</sql>
<jsp>DYNASCRIPT_STYLE</jsp>
<ftl>FTL</ftl>
<xhtml>XML_STYLE</xhtml>
<vm>SHARPSTAR_STYLE</vm>
<jspx>XML_STYLE</jspx>
</mapping>
<properties>
<owner>Apache Software Foundation</owner>
<year>${project.inceptionYear}</year>
<email>dev#ctakes.apache.org</email>
</properties>
<strictCheck>true</strictCheck>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.4</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArgument>-Xlint</compilerArgument>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<includes>
<!-- Resources will be copied by the assembly
No need for it to be inside the jar
<include>**/*.class</include>
<include>**/types/*.xml</include>
<include>**/META-INF/**</include>
-->
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.3</version>
<configuration>
<useReleaseProfile>false</useReleaseProfile>
<goals>deploy</goals>
<arguments>-Papache-release -DskipTests</arguments>
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
<!-- Maven expects tests to start or end with "Test", not "Tests", so
explicitly include files ending in "Tests" -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.1</version>
<configuration>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*Tests.java</include>
<include>**/*TestCase.java</include>
</includes>
<argLine>-Xmx3g</argLine>
<forkedProcessTimeoutInSeconds>900</forkedProcessTimeoutInSeconds>
<additionalClasspathElements>
<additionalClasspathElement>ctakes-assertion-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-assertion-zoner-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-chunker-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-clinical-pipeline-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-constituency-parser-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-core-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-coreference-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-dependency-parser-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-dictionary-lookup-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-drug-ner-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-lvg-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-ne-contexts-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-pos-tagger-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-relation-extractor-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-side-effect-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-smoking-status-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-temporal-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-ytex-res/src/main/resources</additionalClasspathElement>
<additionalClasspathElement>ctakes-dictionary-lookup-fast-res/src/main/resources</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.8</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>check</goal>
</goals>
<id>default-cli</id>
</execution>
</executions>
<configuration>
<excludes>
<!-- File generated by maven-release-plugin -->
<exclude>release.properties</exclude>
<!-- Eclipse launch files -->
<exclude>**/*.launch</exclude>
<!-- Exclude target and eclipse files
The default RAT ignoreEclipse doesn't work
if there is a submodule that is commented out
So excluding it explictly here -->
<exclude>**/.classpath</exclude>
<exclude>**/.project</exclude>
<exclude>**/.settings/**</exclude>
<exclude>**/target/**</exclude>
<exclude>**/MANIFEST.MF</exclude>
<!-- Exclude bin/model resources -->
<exclude>**/resources/models/**</exclude>
<exclude>**/src/main/resources/**</exclude>
<exclude>**/src/test/resources/**</exclude>
<exclude>**/META-INF/org.uimafit/types.txt</exclude>
<!-- Exclude test data files -->
<exclude>**/data/test/**</exclude>
<exclude>**/data/**</exclude>
<exclude>**/output/**</exclude>
<exclude>**/sample_note.txt</exclude>
</excludes>
<numUnapprovedLicenses>0</numUnapprovedLicenses>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<!--
This is needed to execute/unpack resources in m2e eclipse ide
Currently used in the ctakes-dictionary-lookup project
-->
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>2.8</versionRange>
<goals>
<goal>unpack-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
<pluginExecution>
<!--
Ignore the Maven remote resources plugin in Eclipse. We don't use it from Eclipse,
and it causes a warning if m2e is not configured to ignore it as below.
-->
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>disable-java8-doclint</id>
<activation>
<jdk>[1.8,)</jdk>
</activation>
<properties>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
</profile>
</profiles>
</project>
You required the RowMapper for your use. So, It persists inside the "Spring-jdbc" Jar.
You have to import this jar into your pom.xml. When IDE automatically downloaded the jar, it will be visible in your code.
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>5.2.1.RELEASE</version>
</dependency>
</dependencies>
RowMapper Github path:
https://github.com/spring-projects/spring-framework/blob/master/spring-jdbc/src/main/java/org/springframework/jdbc/core/RowMapper.java
Other Versions:
https://mvnrepository.com/artifact/org.springframework/spring-jdbc/5.2.1.RELEASE
Dependency Management allows to consolidate and centralize the management of dependency versions without adding dependencies which are inherited by all children.

WAR deployment works fine, testing anything with Hibernate gives NoSuchMethodError

I'm getting the following error whenever I try to run some of my test cases:
This only happens when I'm running my tests, if I deploy and run the .war, everything runs fine. I've checked my project and the jboss folder and only one version of jboss-logging.jar is present. If I try to include org.jboss.logging.Logging in my project, everything is fine until it runs, at which point it throws the error there instead of when creating the SessionFactory.
pom.xml:
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>WEB-INF</directory>
<targetPath>/WEB-INF</targetPath>
<includes>
<include>*.xml</include>
</includes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>test-compile</goal>
<goal>compile</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>analyze</id>
<goals>
<goal>analyze-only</goal>
</goals>
<configuration>
<failOnWarning>true</failOnWarning>
<outputXML>true</outputXML>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.20.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-web -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-web</artifactId>
<version>2.10.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet.jsp/jsp-api -->
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-core -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.5.14.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-json-plugin -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-json-plugin</artifactId>
<version>2.5.14.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.struts/struts2-junit-plugin -->
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-junit-plugin</artifactId>
<version>2.5.14.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jstl/jstl -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.taglibs/taglibs-standard-impl -->
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mindrot/jbcrypt -->
<dependency>
<groupId>org.mindrot</groupId>
<artifactId>jbcrypt</artifactId>
<version>0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.1.10.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-c3p0 -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>5.1.10.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1211.jre6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.pdfbox/pdfbox -->
<dependency>
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
<version>2.0.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.subethamail/subethasmtp-wiser -->
<dependency>
<groupId>org.subethamail</groupId>
<artifactId>subethasmtp-wiser</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-email -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging -->
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>3.3.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
stacktrace:
java.lang.NoSuchMethodError: org.jboss.logging.Logger.getMessageLogger(Ljava/lang/Class;Ljava/lang/String;)Ljava/lang/Object;
at myproject.ComMappingTest.setUp(ComMappingTest.java:26)
at junit.framework.TestCase.runBare(TestCase.java:139)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:252)
at junit.framework.TestSuite.run(TestSuite.java:247)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:86)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
ComMappingTest.java:
package myproject.tests.com;
import java.util.List;
import junit.framework.TestCase;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import myproject.hbos.com.CountryHBO;
import myproject.hbos.com.PortHBO;
import myproject.hbos.com.UserHBO;
import myproject.util.SessionManager;
public class ComMappingTest extends TestCase {
private static Session session = null;
private static Transaction tx = null;
#BeforeClass
public void setUp() {
System.out.println(org.jboss.logging.Logger.Level.ERROR);
session = SessionManager.getSession();
tx = session.beginTransaction();
}
#AfterClass
public void tearDown() {
tx.rollback();
session.close();
}
#Test
#SuppressWarnings("unchecked")
public void testUserMaping() {
List<UserHBO> users = (List<UserHBO>) session.createQuery("FROM UserHBO").setMaxResults(1).list();
assertNotNull(users);
}
#Test
public void testPortMapping() {
PortHBO port = (PortHBO) session.get(PortHBO.class, 8211);
assertNotNull(port);
}
#Test
#SuppressWarnings("unchecked")
public void testCountryMapping() {
List<CountryHBO> client = (List<CountryHBO>) session.createQuery("FROM CountryHBO").setMaxResults(1).list();
assertNotNull(client);
}
}
Your unit tests assume that the JBOSS logging JAR are in the CLASSPATH, but they are not. The WAR deployment works because the JAR is present on the app server.
You can add the JAR dependency in your pom.xml and mark it as <scope>test</scope>

Categories