maven not compiling test code / not running test code - maven

I have a simple Mavenized Java Project with the expected directory structure an no "business" classes yet:
The pom.xml is rather mundane. It declares dependencies on JUnit4 and JUnit5, and the "surefire" plugin (enclosing project noise elided):
<properties>
<junit5Version>5.1.0</junit5Version>
<junit4Version>4.12</junit4Version>
<commonsCodecVersion>20041127.091804</commonsCodecVersion>
<mavenCompilerPluginVersion>3.7.0</mavenCompilerPluginVersion>
<junitPlatformSurefireProviderVersion>1.1.0</junitPlatformSurefireProviderVersion>
<mavenSurefirePluginVersion>2.21.0</mavenSurefirePluginVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${mavenCompilerPluginVersion}</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefirePluginVersion}</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junitPlatformSurefireProviderVersion}</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit5Version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5Version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<!-- https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-maven/ -->
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec/ -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commonsCodecVersion}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit4Version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit5Version}</version>
</dependency>
</dependencies>
Problem:
In the above I don't not scope the junit:junit and
org.junit.jupiter.junit-jupiter-api dependencies to the test
scope. Indeed, if I do that, mvn compile fails because it cannot
find the symbols for JUnit4 and JUnit5. This is unexpected, I would
expect it to not actually compile the test code at all. Indeed
examples generally show restriction to the test scope. What's
wrong?
If there is no restriction to the test scope, then mvn compile works, but mvn test doesn't run any tests. The surefire plugin seems to not sniff out any JUnit tests, neither 4's nor 5's. What's wrong here?
And finally, version info:
$ mvn -version
Apache Maven 3.5.2
Maven home: /usr/local/java/maven
Java version: 9.0.4, vendor: Oracle Corporation

maven-surefire-plugin 2.21.0 is not compatible with version 1.1.0 of the junit-platform-surefire-provider.
Either rollback maven-surefire-plugin to 2.19.1 or update junit-platform-surefire-provider to 1.2.0-SNAPSHOT (or the 1.2.0 release if it's out).
The pom.xml to use if using the SNAPSHOT, with the Sonatype plugin repository configured:
<?xml version="1.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>TestJava</groupId>
<artifactId>TestJava</artifactId>
<version>0.0.1-SNAPSHOT</version>
<pluginRepositories>
<pluginRepository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<junit5Version>5.1.0</junit5Version>
<junit4Version>4.12</junit4Version>
<mavenCompilerPluginVersion>3.7.0</mavenCompilerPluginVersion>
<junitPlatformSurefireProviderVersion>1.2.0-SNAPSHOT</junitPlatformSurefireProviderVersion>
<mavenSurefirePluginVersion>2.21.0</mavenSurefirePluginVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${mavenCompilerPluginVersion}</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefirePluginVersion}</version>
<!-- https://www.petrikainulainen.net/programming/testing/junit-5-tutorial-running-unit-tests-with-maven/ -->
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junitPlatformSurefireProviderVersion}</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit5Version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit5Version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit4Version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit5Version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Run mvn -U test to force a check for missing releases and updated snapshots on remote repositories.

Related

Quarkus: Multiple matching properties for name "test.native-image-profile" property

I'm trying to build a native image with Quarkus and I get the following message:
Failed to augment application classes: Multiple matching properties for name "test.native-image-profile" property was matched by both java.lang.String io.quarkus.deployment.dev.testing.TestConfig.nativeImageProfile and java.lang.String io.quarkus.deployment.TestConfig.nativeImageProfile. This is likely because you have an incompatible combination of extensions that both define the same properties (e.g. including both reactive and blocking database extensions)
It doesn't seem to me that my pom contains incompatible extensions or multiple packaging declarations.
Here is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2020 - 2022 Henix, henix.fr
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
<parent>
<groupId>org.opentestfactory.plugins</groupId>
<artifactId>otf-plugins-springboot-parent</artifactId>
<version>${revision}${sha1}${changelist}</version>
<relativePath>..</relativePath>
</parent>
<artifactId>otf-robotframework-report-interpreter</artifactId>
<name>OTF-robotframework-report-interpreter (${project.version})</name>
<description>OTF Robot Framework report interpreter plugin</description>
<properties>
<license.name>Apache-V2</license.name>
<maven.license.version>3.0</maven.license.version>
<java.version>11</java.version>
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
<quarkus.platform.version>2.14.1.Final</quarkus.platform.version>
<surefire-plugin.version>2.22.1</surefire-plugin.version>
<quarkus-plugin.version>1.2.1.Final</quarkus-plugin.version>
<compiler-plugin.version>3.8.1</compiler-plugin.version>
</properties>
<distributionManagement>
<repository>
<id>squash-release-deploy-repo</id>
<name>Squash releases deployment repo</name>
<url>${deploy-repo.release.url}</url>
</repository>
<snapshotRepository>
<id>squash-snapshot-deploy-repo</id>
<name>Squash snapshots deployment repo</name>
<url>${deploy-repo.snapshot.url}</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.opentestfactory</groupId>
<artifactId>otf-java-bom</artifactId>
<version>${project.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.opentestfactory</groupId>
<artifactId>otf-java-bom</artifactId>
<version>${project.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>io.quarkus.arc</groupId>
<artifactId>arc</artifactId>
<version>2.11.1.Final</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye</groupId>
<artifactId>smallrye-config</artifactId>
<version>1.4.1</version>
</dependency>
<!-- Non springboot compile/runtime dependencies -->
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>8.19</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-fips</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.opentestfactory</groupId>
<artifactId>TFMessages</artifactId>
</dependency>
<dependency>
<groupId>org.opentestfactory</groupId>
<artifactId>tf-microservice-components</artifactId>
</dependency>
<dependency>
<groupId>org.opentestfactory.plugins</groupId>
<artifactId>otf-report-interpreter-base</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Test dependencies. -->
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<!-- version controlled from otf-plugins-springboot-parent to override springboot's dependencyManagement -->
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opentestfactory</groupId>
<artifactId>test-utils</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>4.6.1</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jboss.logmanager/jboss-logmanager -->
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<version>2.1.18.Final</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<systemProperties>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>native</id>
<activation>
<property>
<name>native</name>
</property>
</activation>
<properties>
<skipITs>false</skipITs>
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>
</profiles>
</project>
I'm working with Java11 and GraalVM CE 21.0.0.2
This error blocks the construction of my native image.
Can someone helps me ?
Thanks !

Camunda, Wont deploy to Tomcat

I am trying to create a complete instance of Camunda (cockpit, andmin, tasklist, engine-rest, ... ).
I have created a project using their archtype and ran it successfully using maven springboot:run
But when trying to deploy the project to a Tomcat server. I face the issue of the project being inaccessible.
I have the following pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myapplication.camunda</groupId>
<artifactId>camunda-all</artifactId>
<version>1.0-SNAPSHOT</version>
<name>Camunda Spring Boot Application</name>
<description>Spring Boot Application using [Camunda](http://docs.camunda.org). [The project has been generated by the Maven archetype 'camunda-archetype-spring-boot-7.9.2']</description>
<packaging>war</packaging>
<properties>
<camunda.version>7.9.0</camunda.version>
<!--
Adjust if you want to use Camunda Enterprise Edition (EE):
<camunda.version>7.9.0-ee</camunda.version>
Make sure you also switch to the ee webapp dependency
and EE repository below
-->
<camundaSpringBoot.version>3.0.0</camundaSpringBoot.version>
<springBoot.version>2.0.2.RELEASE</springBoot.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.java>1.8</version.java>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-bom</artifactId>
<version>${camunda.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.camunda.bpm.dmn</groupId>
<artifactId>camunda-engine-dmn-bom</artifactId>
<version>${camunda.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springBoot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-webapp</artifactId>
<!--
Adjust if you want to use EE:
<artifactId>camunda-bpm-spring-boot-starter-webapp-ee</artifactId>
Make sure you also use an EE version of Camunda - see above
-->
<version>${camundaSpringBoot.version}</version>
</dependency>
<dependency>
<groupId>org.camunda.bpm.springboot</groupId>
<artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
<version>${camundaSpringBoot.version}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- required to use H2 as a file based database (Otherwise it's In-Memory) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<!-- Required to use Spin dataformat support -->
<dependency>
<groupId>org.camunda.spin</groupId>
<artifactId>camunda-spin-dataformat-all</artifactId>
</dependency>
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine-plugin-spin</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert</artifactId>
<version>1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-assert-scenario</artifactId>
<version>0.2</version>
<scope>test</scope>
</dependency>
<!-- Used to generate test coverage reports, see https://github.com/camunda/camunda-consulting/tree/master/snippets/camunda-bpm-process-test-coverage -->
<!--
<dependency>
<groupId>org.camunda.bpm.extension</groupId>
<artifactId>camunda-bpm-process-test-coverage</artifactId>
<version>0.3.2</version>
<scope>test</scope>
</dependency> -->
<!-- java util logging => slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<scope>test</scope>
</dependency>
<!-- Add your own dependencies here, if in compile scope, they are added to the jar -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<!-- <version>2.4.0-b180725.0427</version>-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<!-- <version>4.5.2</version>-->
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>camunda-bpm-nexus</id>
<name>Camunda Maven Repository</name>
<url>https://app.camunda.com/nexus/content/groups/public</url>
</repository>
<!-- enable this for EE dependencies (requires credentials in ~/.m2/settings.xml)
<repository>
<id>camunda-bpm-nexus-ee</id>
<name>Camunda Enterprise Maven Repository</name>
<url>https://app.camunda.com/nexus/content/repositories/camunda-bpm-ee</url>
</repository>
-->
</repositories>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${springBoot.version}</version>
<configuration>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<mainClass>com.myapplication.camunda.CamundaApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I have the following application class
package com.myapplication.camunda;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
#SpringBootApplication
#EnableProcessApplication("camunda-all")
#ComponentScan("com.myapplication.camunda")
#ComponentScan("com.springboot.camunda")
public class CamundaApplication extends SpringBootServletInitializer {
public static void main(String... args) {
SpringApplication.run(CamundaApplication.class, args);
}
#Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CamundaApplication.class);
}
}
The following application.yaml
spring.datasource:
url: jdbc:postgresql://localhost:5432/camunda_db?autoReconnect=true
username: postgres
password: postgres
driver-class-name: org.postgresql.Driver
spring.h2.console.enabled: true
camunda.bpm:
admin-user:
id: demo
password: demo
firstName: Demo
filter:
create: All tasks
server.port: 8080
server:
servlet:
context-path: /camunda-all
I have the main/resources/webapp directory empty.
I would really appreciate any help.
Created empty maven project
added files you posted above
adjusted db settings to my postgres
cmd: mvn spring-boot:run
Portal is accessible under http://localhost:8080/camunda-all
Then adjusted POM for external tomcat deployment (also upgraded versions and cleanup up).
Updated result here:
https://github.com/rob2universe/stackoverflow58356978
there are couple of things to do to deploy you war in camunda application server.
add required dependency in pom.xml file
<dependency>
<groupId>org.camunda.bpm</groupId>
<artifactId>camunda-engine</artifactId>
<version>7.13.0</version>
<scope>provided</scope>
</dependency>
Replace #EnableProcessApplication("camunda-all") with #ProcessApplication("camunda-all")
extend your main class with ServletProcessApplication not with SpringBootServletInitializer.
Added your BPMN file in process.xml file which is inside resources/META-INF folder.
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-archive>
<process-engine>default</process-engine>
<resource>invoice.v2.bpmn</resource>
<resource>invoiceBusinessDecisions.dmn</resource>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">false</property>
</properties>
</process-archive>
</process-application>

Maven ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called

I am using geb spock maven, with surefire version 2.22.0 on ubuntu. Till 2 weeks back it was working fine, but suddenly I am gettig ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called? error. Below is my configuration:
Maven Version: Apache Maven 3.6.0
Java version: openjdk version "1.8.0_181"
M3_HOME : /opt/maven
When I hit mvn -Dtest="some test " test command it throws below error:
ExecutionException The forked VM terminated without properly saying goodbye. VM crash or System.exit called?
Command was /bin/sh -c cd /home/web/workspace/Durgesh_Delete1 && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /home/web/workspace/Durgesh_Delete1/target/surefire/surefirebooter1782527278200611298.jar /home/web/workspace/Durgesh_Delete1/target/surefire 2018-11-16T11-10-54_226-jvmRun3 surefire2754275980317815656tmp surefire_01299389042676135686tmp
Error occurred in starting fork, check output in log
Process Exit Code: 1
Below is my complete pom.xml
<?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>net.digital.web</groupId>
<artifactId>edge_bdd_automation</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<skipITTests>false</skipITTests>
<geb.version>2.1</geb.version>
<selenium.version>3.12.0</selenium.version>
<groovy.version>2.4.15</groovy.version>
<spock.version>1.1-groovy-2.4</spock.version>
<gson.version>2.8.2</gson.version>
<httpclient.version>4.3.4</httpclient.version>
<httpcore.version>4.3.2</httpcore.version>
<surefire.plugin.version>2.22.0</surefire.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- Groovy compiler for Spock/Geb tests -->
<version.groovy-eclipse-compiler>2.9.2-01</version.groovy-eclipse-compiler>
<version.groovy-eclipse-batch>2.4.3-01</version.groovy-eclipse-batch>
</properties>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray-plugins</name>
<url>http://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-spock</artifactId>
<version>${geb.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.gebish/geb-core -->
<dependency>
<groupId>org.gebish</groupId>
<artifactId>geb-core</artifactId>
<version>${geb.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<!--<scope>test</scope>-->
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<!--Dependencies related to GEB SPOCK reporting-->
<dependency>
<groupId>com.athaydes</groupId>
<artifactId>spock-reports</artifactId>
<version>1.6.0</version>
<scope>test</scope>
<!-- this avoids affecting your version of Groovy/Spock -->
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
</dependency>
<!-- // if you don't already have slf4j-api and an implementation of it in the classpath, add this! -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
<!-- This dependency is for support of Junit latest version -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/ru.yandex.qatools.ashot/ashot -->
<dependency>
<groupId>ru.yandex.qatools.ashot</groupId>
<artifactId>ashot</artifactId>
<version>1.5.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.4.4</version>
</dependency>
<!-- Geb - Spock Report -->
<dependency>
<groupId>com.aoe</groupId>
<artifactId>geb-spock-reports</artifactId>
<version>0.1.5</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Maven surefire plugin-->
<!-- Uncommnet below for invoking parallel execution -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire.plugin.version}</version>
<dependencies>
<!–SPOCK This is to force to use JUnit 4.7+ Runner –>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>${surefire.plugin.version}</version>
</dependency>
</dependencies>
<configuration>
<skipTests>${skipITTests}</skipTests>
<includes>
<include>*Spec.*</include>
</includes>
<systemPropertyVariables>
<geb.build.reportsDir>target/test-reports/geb</geb.build.reportsDir>
</systemPropertyVariables>
<parallel>classes</parallel>
<forkCount>5</forkCount>
<reuseForks>false</reuseForks>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<!-- IMPORTANT -->
<useIncrementalCompilation>false</useIncrementalCompilation>
<encoding>${project.build.sourceEncoding}</encoding>
<compilerId>groovy-eclipse-compiler</compilerId>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${version.groovy-eclipse-compiler}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>${version.groovy-eclipse-batch}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${version.groovy-eclipse-compiler}</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
Please look into this issue. Thanks
Finally, I am able to solve this by adding below line under configuration tag of surefire plugin:
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<threadCount>1</threadCount>
</configuration>
This has been mentioned in the solution suggested by Rushby in above comment, unfortunately no one has voted that answer so was difficult to catch. Thanks!

Intellij does not run Junit5 tests

This is a related question to Maven surefire plugin does not detect Junit5 tests and I have read the userguide.
I have the following in my pom.xml and when I run the maven install the test gets run.
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.platform.version>1.0.1</junit.platform.version>
<junit.jupiter.version>5.0.2</junit.jupiter.version>
<junit.vintage.version>4.12.2</junit.vintage.version>
</properties>
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
<!-- Only required to run tests in an IDE that bundles an older version -->
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
<scope>test</scope>
</dependency>
<!-- Only required to run tests in an IDE that bundles an older version -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${junit.vintage.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
However when I run with Intellij IDEA 2017.1.5 the unit tests throw the following exception
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.launcher.Launcher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;)V
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:61)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:51)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Unfortunately upgrading Intellij itself is going to take me slightly longer to achieve in an enterprise environment so is there any way to make this work in Intellij 2017.1.5 so that it runs the tests?
FYI the test I am attempting to run is NOT a vintage test it is a simple Junit5 test with the org.junit.jupiter.api.Test annotation
Update surefire
As I vaguely recall, there have been significant updates to surefire in the past 2-3 years. Try updating your maven-surefire-plugin, currently at 3.0.0-M3.
New junit-jupiter artifact
Note that as of 5.4.0 of JUnit, we can specify the new and very convenient single Maven artifact of junit-jupiter which in turn will supply 8 libraries to your project.
Simplify your POM
You can drastically simplify your POM. Here is an example POM taken from the maven-archetype-quickstart version 1.4 archetype, though I have updated all the version numbers as of 2019-01.
<?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>work.basil.example</groupId>
<artifactId>acmeapp</artifactId>
<version>1.0-SNAPSHOT</version>
<name>acmeapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0-RC1</version>
<scope>test</scope>
</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>3.1.0</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>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Tip: If you want to use JUnit assertions outside of test-related classes, in your regular app classes, drop the <scope>test</scope> element.
Example class test
package work.basil.example;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Unit test for simple App.
*/
public class AppTest
{
/**
* Rigorous Test :-)
*/
#Test
public void shouldAnswerWithTrue()
{
assertTrue( true );
}
}
I got it working with the following dependencies with Gradle 5.0:
testCompile('org.junit.jupiter:junit-jupiter-api:5.4.0')
testCompile('org.junit.jupiter:junit-jupiter-params:5.4.0')
testCompile('org.junit.platform:junit-platform-commons:1.4.0')
testRuntime('org.junit.jupiter:junit-jupiter-engine:5.4.0')

Maven error - resolving dependencies

I'm not very familiar with maven and I'm struggling with this error message when running a maven compile:
[ERROR] Failed to execute goal on project myProject: Could not resolve dependencies for project myProject:1.0: Failure to find weka:weka:jar:3.7.1-beta in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
The pom looks like this:
<?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>myGroup</groupId>
<artifactId>myProject</artifactId>
<version>1.1</version>
<repositories>
<repository>
<id>ambit-plovdiv</id>
<url>
http://ambit.uni-plovdiv.bg:8083/nexus/content/repositories/thirdparty</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- general purpose math-libraries -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>net.sourceforge.jexcelapi</groupId>
<artifactId>jxl</artifactId>
<version>2.6.10</version>
</dependency>
<dependency>
<groupId>tablelayout</groupId>
<artifactId>TableLayout</artifactId>
<version>20050920</version>
</dependency>
<dependency>
<groupId>org.openscience.cdk</groupId>
<artifactId>cdk</artifactId>
<version>1.3.8</version>
</dependency>
<dependency>
<groupId>org.openscience.cdk</groupId>
<artifactId>jchempaint</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7-beta1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.7-beta1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.7-beta1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<fork>true</fork>
<compilerVersion>1.6</compilerVersion>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Can anybody help to understand this error message?
It was Friday... I mixed up two maven projects. Thanks a lot for your help!
First part of the message means that one of your (transitive) dependency is missing in your accessible repositories.
Second part means that it is not the first time this request has been made, so unless you un-blacklist it (with -U in your command for instance), Maven will not try to find it again on the remote repositories.
If you can upgrade, later versions of weka are in maven central.
Alternatively, as a last resort if you can't find the versions you need in a maven repo somewhere, you could download the jars you need from the weka site, and put them in your local repository, something like this:
mvn install:install-file -Dfile=weka-3.7.1-beta.jar -DgroupId=weka -DartifactId=weka -Dversion=3.7.1-beta -DgeneratePom=true

Resources