|
21 | 21 | <project xmlns="http://maven.apache.org/POM/4.0.0"
|
22 | 22 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
23 | 23 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
24 |
| - <modelVersion>4.0.0</modelVersion> |
| 24 | + <modelVersion>4.0.0</modelVersion> |
25 | 25 |
|
26 |
| - <groupId>org.example</groupId> |
27 |
| - <artifactId>testng-junit5</artifactId> |
28 |
| - <version>1.0-SNAPSHOT</version> |
| 26 | + <groupId>org.example</groupId> |
| 27 | + <artifactId>testng-junit5</artifactId> |
| 28 | + <version>1.0-SNAPSHOT</version> |
29 | 29 |
|
30 |
| - <properties> |
31 |
| - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
32 |
| - <maven.compiler.source>${java.specification.version}</maven.compiler.source> |
33 |
| - <maven.compiler.target>${java.specification.version}</maven.compiler.target> |
34 |
| - </properties> |
| 30 | + <description>Project with mixed TestNG and JUnit5 tests.</description> |
35 | 31 |
|
36 |
| - <dependencies> |
| 32 | + <properties> |
| 33 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 34 | + <maven.compiler.source>${java.specification.version}</maven.compiler.source> |
| 35 | + <maven.compiler.target>${java.specification.version}</maven.compiler.target> |
| 36 | + </properties> |
| 37 | + |
| 38 | + <dependencies> |
| 39 | + <dependency> |
| 40 | + <groupId>org.testng</groupId> |
| 41 | + <artifactId>testng</artifactId> |
| 42 | + <version>7.5</version> |
| 43 | + <scope>test</scope> |
| 44 | + </dependency> |
| 45 | + <dependency> |
| 46 | + <groupId>org.junit.support</groupId> |
| 47 | + <artifactId>testng-engine</artifactId> |
| 48 | + <version>1.0.1</version> |
| 49 | + <scope>test</scope> |
| 50 | + </dependency> |
| 51 | + </dependencies> |
| 52 | + |
| 53 | + <build> |
| 54 | + <pluginManagement> |
| 55 | + <plugins> |
| 56 | + <plugin> |
| 57 | + <groupId>org.apache.maven.plugins</groupId> |
| 58 | + <artifactId>maven-surefire-plugin</artifactId> |
| 59 | + <version>${surefire.version}</version> |
| 60 | + </plugin> |
| 61 | + </plugins> |
| 62 | + </pluginManagement> |
| 63 | + </build> |
| 64 | + |
| 65 | + <profiles> |
| 66 | + <profile> |
| 67 | + <id>testng-only</id> |
| 68 | + <build> |
| 69 | + <plugins> |
| 70 | + <plugin> |
| 71 | + <groupId>org.apache.maven.plugins</groupId> |
| 72 | + <artifactId>maven-compiler-plugin</artifactId> |
| 73 | + <configuration> |
| 74 | + <testIncludes> |
| 75 | + <!-- JUnit5Test.java ignored - Jupiter does not exist in dependencies. --> |
| 76 | + <testInclude>**/TestNGTest.java</testInclude> |
| 77 | + </testIncludes> |
| 78 | + </configuration> |
| 79 | + </plugin> |
| 80 | + </plugins> |
| 81 | + </build> |
| 82 | + </profile> |
| 83 | + <profile> |
| 84 | + <id>junit5-engine</id> |
| 85 | + <dependencies> |
37 | 86 | <dependency>
|
38 |
| - <groupId>org.testng</groupId> |
39 |
| - <artifactId>testng</artifactId> |
40 |
| - <version>7.1.0</version> |
41 |
| - <scope>test</scope> |
| 87 | + <groupId>org.junit.jupiter</groupId> |
| 88 | + <artifactId>junit-jupiter-engine</artifactId> |
| 89 | + <!-- TODO check with next version of testng-engine --> |
| 90 | + <!-- we have old junit-platform-commons:1.7.2 in dependency tree --> |
| 91 | + <version>5.7.2</version> |
| 92 | + <scope>test</scope> |
42 | 93 | </dependency>
|
43 |
| - <dependency> |
44 |
| - <groupId>com.github.testng-team</groupId> |
45 |
| - <artifactId>testng-junit5</artifactId> |
46 |
| - <version>0.0.1</version> |
47 |
| - <scope>test</scope> |
| 94 | + </dependencies> |
| 95 | + </profile> |
| 96 | + <profile> |
| 97 | + <id>junit5-api</id> |
| 98 | + <!-- |
| 99 | + This exclusion avoids inconsistent versions combination: junit-platform-engine:1.7.2 and junit-jupiter-api:5.8.2. |
| 100 | + The surefire would add artifacts to the class path: junit-platform-*, junit-jupiter-engine, etc. |
| 101 | + --> |
| 102 | + <dependencyManagement> |
| 103 | + <dependencies> |
| 104 | + <dependency> |
| 105 | + <groupId>org.junit.support</groupId> |
| 106 | + <artifactId>testng-engine</artifactId> |
48 | 107 | <exclusions>
|
49 |
| - <exclusion> |
50 |
| - <groupId>org.junit.platform</groupId> |
51 |
| - <artifactId>junit-platform-engine</artifactId> |
52 |
| - </exclusion> |
| 108 | + <exclusion> |
| 109 | + <groupId>org.junit.platform</groupId> |
| 110 | + <artifactId>junit-platform-engine</artifactId> |
| 111 | + </exclusion> |
53 | 112 | </exclusions>
|
| 113 | + </dependency> |
| 114 | + </dependencies> |
| 115 | + </dependencyManagement> |
| 116 | + <dependencies> |
| 117 | + <dependency> |
| 118 | + <groupId>org.junit.jupiter</groupId> |
| 119 | + <artifactId>junit-jupiter-api</artifactId> |
| 120 | + <!-- junit-jupiter-api has junit-platform-commons as nearest definition --> |
| 121 | + <!-- so junit-platform-commons:1.8.2 wins ;-) --> |
| 122 | + <version>5.8.2</version> |
| 123 | + <scope>test</scope> |
54 | 124 | </dependency>
|
55 |
| - </dependencies> |
56 |
| - |
57 |
| - <build> |
58 |
| - <pluginManagement> |
59 |
| - <plugins> |
60 |
| - <plugin> |
61 |
| - <groupId>org.apache.maven.plugins</groupId> |
62 |
| - <artifactId>maven-surefire-plugin</artifactId> |
63 |
| - <version>${surefire.version}</version> |
64 |
| - </plugin> |
65 |
| - </plugins> |
66 |
| - </pluginManagement> |
67 |
| - </build> |
68 |
| - |
69 |
| - <profiles> |
70 |
| - <profile> |
71 |
| - <id>junit5-engine</id> |
72 |
| - <dependencies> |
73 |
| - <dependency> |
74 |
| - <groupId>org.junit.jupiter</groupId> |
75 |
| - <artifactId>junit-jupiter-engine</artifactId> |
76 |
| - <version>5.6.2</version> |
77 |
| - <scope>test</scope> |
78 |
| - </dependency> |
79 |
| - </dependencies> |
80 |
| - </profile> |
81 |
| - <profile> |
82 |
| - <id>junit5-api</id> |
83 |
| - <dependencies> |
84 |
| - <dependency> |
85 |
| - <groupId>org.junit.jupiter</groupId> |
86 |
| - <artifactId>junit-jupiter-api</artifactId> |
87 |
| - <version>5.6.2</version> |
88 |
| - <scope>test</scope> |
89 |
| - </dependency> |
90 |
| - </dependencies> |
91 |
| - </profile> |
92 |
| - </profiles> |
| 125 | + </dependencies> |
| 126 | + </profile> |
| 127 | + </profiles> |
93 | 128 |
|
94 | 129 | </project>
|
0 commit comments