It Worked!! New version of pom.xml $ cat 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>br.edu.ifrs</groupId> <artifactId>totalinventory</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>totalinventory Maven Webapp</name> <url>http://www.poa.ifrs.edu.br</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.7</maven.compiler.source> <maven.compiler.target>1.7</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> <dependency> <groupId>org.junit.jupiter</groupId> <artifactId>junit-jupiter-engine</artifactId> <version>5.4.0</version> <scope>test</scope> </dependency> <dependency> <groupId>javax.persistence</groupId> <artifactId>javax.persistence-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>javax.ejb</groupId> <artifactId>ejb-api</artifactId> <version>3.0</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.ws.rs</groupId> <artifactId>javax.ws.rs-api</artifactId> <version>2.1.1</version> </dependency> <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.apache.maven.surefire</groupId> <artifactId>surefire-junit47</artifactId> <version>2.22.1</version> </dependency> </dependencies> <build> <finalName>totalinventory</finalName> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> </plugins> </pluginManagement> </build> </project> Result of mvn test: $ mvn clean test [INFO] Scanning for projects... [INFO] [INFO] ---------------------< br.edu.ifrs:totalinventory >--------------------- [INFO] Building totalinventory Maven Webapp 1.0-SNAPSHOT [INFO] --------------------------------[ war ]--------------------------------- [INFO] [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ totalinventory --- [INFO] Deleting /home/jeronimo/Documents/maven-testes/totalinventory/target [INFO] [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ totalinventory --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ totalinventory --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 5 source files to /home/jeronimo/Documents/maven-testes/totalinventory/target/classes [INFO] [INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) @ totalinventory --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /home/jeronimo/Documents/maven-testes/totalinventory/src/test/resources [INFO] [INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ totalinventory --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /home/jeronimo/Documents/maven-testes/totalinventory/target/test-classes [INFO] [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ totalinventory --- [INFO] [INFO] ------------------------------------------------------- [INFO] T E S T S [INFO] ------------------------------------------------------- [INFO] Running br.edu.ifrs.test.FabricanteTest [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.009 s - in br.edu.ifrs.test.FabricanteTest [INFO] [INFO] Results: [INFO] [INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.707 s [INFO] Finished at: 2019-12-09T12:19:59-02:00 [INFO] ------------------------------------------------------------------------ Thanks guys! Jeronimo Em seg., 9 de dez. de 2019 às 11:11, Tibor Digana <[email protected]> escreveu: > Hi Jeronimo, > > The old version of Surefire and Failsafe required to have the Junit5 > engine in the test dependency. > > But you do not have to declare it if you use the version 3.0.0-M4. > It's enough to have only Junit Jupiter API in the test dependency. > The plugin will find out the engine from Junit5. > > btw, pls remove the dependency with the artifactId: surefire-junit47. > > As Karl has explained, see the documentation in [1]. This should help. > > If you have any problem, feel free to reply. > > Cheers > Tibor17 > > On Mon, Dec 9, 2019 at 2:12 PM Karl Heinz Marbaise <[email protected]> > wrote: > >> Hi, >> >> first you have to use junit-jupiter-engine[1] instead of api apart from >> that you won't be able to get that running cause JUnit Jupiter requires >> JDK8+ (see [2]). >> >> furthermore dependencies to junit provider is simply not needed cause >> this is automatically done by maven-surefire/maven-failsafe-plugin... >> >> Kind regards >> Karl Heinz Marbaise >> >> [1]: >> >> http://maven.apache.org/surefire/maven-surefire-plugin/examples/junit-platform.html >> [2]: >> https://junit.org/junit5/docs/current/user-guide/#overview-java-versions >> >> On 09.12.19 13:31, Jeronimo wrote: >> > Hi, >> > >> > I am using Maven 3.6 >> > >> > $ mvn -version >> > Apache Maven 3.6.0 >> > Maven home: /usr/share/maven >> > Java version: 11.0.4, vendor: Ubuntu, runtime: >> > /usr/lib/jvm/java-11-openjdk-amd64 >> > Default locale: en_US, platform encoding: UTF-8 >> > OS name: "linux", version: "5.0.0-37-generic", arch: "amd64", family: >> "unix" >> > >> > My pom.xml seems like this: >> > $ cat 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>br.edu.ifrs</groupId> >> > <artifactId>totalinventory</artifactId> >> > <version>1.0-SNAPSHOT</version> >> > <packaging>war</packaging> >> > >> > <name>totalinventory Maven Webapp</name> >> > <url>http://www.poa.ifrs.edu.br</url> >> > >> > <properties> >> > <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> >> > <maven.compiler.source>1.7</maven.compiler.source> >> > <maven.compiler.target>1.7</maven.compiler.target> >> > </properties> >> > >> > <dependencies> >> > <dependency> >> > <groupId>junit</groupId> >> > <artifactId>junit</artifactId> >> > <version>4.11</version> >> > <scope>test</scope> >> > </dependency> >> > <dependency> >> > <groupId>org.junit.jupiter</groupId> >> > <artifactId>junit-jupiter-api</artifactId> >> > <version>5.5.2</version> >> > <scope>test</scope> >> > </dependency> >> > <dependency> >> > <groupId>javax.persistence</groupId> >> > <artifactId>javax.persistence-api</artifactId> >> > <version>2.2</version> >> > </dependency> >> > <dependency> >> > <groupId>javax.ejb</groupId> >> > <artifactId>ejb-api</artifactId> >> > <version>3.0</version> >> > <scope>provided</scope> >> > </dependency> >> > <dependency> >> > <groupId>javax.ws.rs</groupId> >> > <artifactId>javax.ws.rs-api</artifactId> >> > <version>2.1.1</version> >> > </dependency> >> > <dependency> >> > <groupId>javax.annotation</groupId> >> > <artifactId>javax.annotation-api</artifactId> >> > <version>1.3.2</version> >> > </dependency> >> > <dependency> >> > <groupId>org.apache.maven.surefire</groupId> >> > <artifactId>surefire-junit47</artifactId> >> > <version>2.22.1</version> >> > </dependency> >> > </dependencies> >> > >> > <build> >> > <finalName>totalinventory</finalName> >> > <pluginManagement><!-- lock down plugins versions to avoid using >> Maven >> > defaults (may be moved to parent pom) --> >> > <plugins> >> > <plugin> >> > <artifactId>maven-clean-plugin</artifactId> >> > <version>3.1.0</version> >> > </plugin> >> > <!-- see >> > >> http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging >> > --> >> > <plugin> >> > <artifactId>maven-resources-plugin</artifactId> >> > <version>3.0.2</version> >> > </plugin> >> > <plugin> >> > <artifactId>maven-compiler-plugin</artifactId> >> > <version>3.8.0</version> >> > </plugin> >> > <plugin> >> > <artifactId>maven-surefire-plugin</artifactId> >> > <version>2.22.1</version> >> > </plugin> >> > <plugin> >> > <groupId>org.apache.maven.plugins</groupId> >> > <artifactId>maven-failsafe-plugin</artifactId> >> > <version>2.22.1</version> >> > </plugin> >> > <plugin> >> > <artifactId>maven-war-plugin</artifactId> >> > <version>3.2.2</version> >> > </plugin> >> > <plugin> >> > <artifactId>maven-install-plugin</artifactId> >> > <version>2.5.2</version> >> > </plugin> >> > <plugin> >> > <artifactId>maven-deploy-plugin</artifactId> >> > <version>2.8.2</version> >> > </plugin> >> > </plugins> >> > </pluginManagement> >> > </build> >> > </project> >> > >> > >> > When trying to execute JUnit testes: >> > $ mvn clean test >> > [INFO] Scanning for projects... >> > [INFO] >> > [INFO] ---------------------< br.edu.ifrs:totalinventory >> >> --------------------- >> > [INFO] Building totalinventory Maven Webapp 1.0-SNAPSHOT >> > [INFO] --------------------------------[ war >> > ]--------------------------------- >> > [INFO] >> > [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ >> totalinventory >> > --- >> > [INFO] Deleting >> /home/jeronimo/Documents/maven-testes/totalinventory/target >> > [INFO] >> > [INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) @ >> > totalinventory --- >> > [INFO] Using 'UTF-8' encoding to copy filtered resources. >> > [INFO] Copying 1 resource >> > [INFO] >> > [INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ >> > totalinventory --- >> > [INFO] Changes detected - recompiling the module! >> > [INFO] Compiling 5 source files to >> > /home/jeronimo/Documents/maven-testes/totalinventory/target/classes >> > [INFO] >> > [INFO] --- maven-resources-plugin:3.0.2:testResources >> > (default-testResources) @ totalinventory --- >> > [INFO] Using 'UTF-8' encoding to copy filtered resources. >> > [INFO] skip non existing resourceDirectory >> > /home/jeronimo/Documents/maven-testes/totalinventory/src/test/resources >> > [INFO] >> > [INFO] --- maven-compiler-plugin:3.8.0:testCompile >> (default-testCompile) @ >> > totalinventory --- >> > [INFO] Changes detected - recompiling the module! >> > [INFO] *Compiling 1 source file *to >> > /home/jeronimo/Documents/maven-testes/totalinventory/target/test-classes >> > [INFO] >> > [INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ >> > totalinventory --- >> > [INFO] >> > [INFO] ------------------------------------------------------- >> > [INFO] T E S T S >> > [INFO] ------------------------------------------------------- >> > [INFO] >> > [INFO] Results: >> > [INFO] >> > [INFO] *Tests run: 0,* Failures: 0, Errors: 0, Skipped: 0 >> > [INFO] >> > [INFO] >> > ------------------------------------------------------------------------ >> > [INFO] BUILD SUCCESS >> > [INFO] >> > ------------------------------------------------------------------------ >> > [INFO] Total time: 2.525 s >> > [INFO] Finished at: 2019-12-09T10:24:37-02:00 >> > [INFO] >> > ------------------------------------------------------------------------ >> > >> > >> > The phases seems to compile one test class but don't run any. >> > >> > My Test class is on ./src/test/java >> > $ cat src/test/java/FabricanteTest.java >> > package br.edu.ifrs.test; >> > >> > import static org.junit.jupiter.api.Assertions.assertEquals; >> > >> > import br.edu.ifrs.model.Fabricante; >> > >> > import org.junit.jupiter.api.Test; >> > >> > public class FabricanteTest { >> > >> > @Test >> > public void testGetName() { >> > Fabricante fabricante = new Fabricante("Dell", "www.dell.com"); >> > assertEquals("Dell", fabricante.getName()); >> > } >> > >> > } >> > >> > >> > I have no idea the cause of not running tests. >> > >> > Any help? >> > >> > Regard's >> > >> > Jeronimo >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >>
