File tree Expand file tree Collapse file tree 5 files changed +83
-0
lines changed
java/ql/integration-tests/java/maven-execution-specific-java-version Expand file tree Collapse file tree 5 files changed +83
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+
3+ <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" >
4+ <modelVersion >4.0.0</modelVersion >
5+
6+ <groupId >com.example</groupId >
7+ <artifactId >maven-execution-specific-java-version</artifactId >
8+ <version >1.0-SNAPSHOT</version >
9+
10+ <name >maven-execution-specific-java-version</name >
11+ <description >Test case: Project with execution-specific Java versions (Java 11 for main, Java 17 for test). Maven.java should detect the highest version (17) and use it for compilation.</description >
12+
13+ <properties >
14+ <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
15+ </properties >
16+
17+ <build >
18+ <plugins >
19+ <plugin >
20+ <groupId >org.apache.maven.plugins</groupId >
21+ <artifactId >maven-compiler-plugin</artifactId >
22+ <version >3.13.0</version >
23+ <executions >
24+ <!-- Compilation for src/main/java -->
25+ <execution >
26+ <id >default-compile</id >
27+ <phase >compile</phase >
28+ <goals >
29+ <goal >compile</goal >
30+ </goals >
31+ <configuration >
32+ <release >11</release > <!-- Java 11 for main -->
33+ </configuration >
34+ </execution >
35+
36+ <!-- Compilation for src/test/java -->
37+ <execution >
38+ <id >default-testCompile</id >
39+ <phase >test-compile</phase >
40+ <goals >
41+ <goal >testCompile</goal >
42+ </goals >
43+ <configuration >
44+ <release >17</release > <!-- Java 17 for test -->
45+ </configuration >
46+ </execution >
47+ </executions >
48+ </plugin >
49+ </plugins >
50+ </build >
51+ </project >
Original file line number Diff line number Diff line change 1+ pom.xml
2+ src/main/java/com/example/App.java
3+ src/test/java/com/example/AppTest.java
4+ target/maven-archiver/pom.properties
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ public class App {
4+ public static void main (String [] args ) {
5+ System .out .println ("Hello World! Running on Java " + System .getProperty ("java.version" ));
6+ }
7+
8+ public String getMessage () {
9+ return "Hello from App" ;
10+ }
11+ }
Original file line number Diff line number Diff line change 1+ package com .example ;
2+
3+ public class AppTest {
4+ public static void main (String [] args ) {
5+ App app = new App ();
6+ String message = app .getMessage ();
7+
8+ if ("Hello from App" .equals (message )) {
9+ System .out .println ("Test passed!" );
10+ } else {
11+ System .err .println ("Test failed!" );
12+ System .exit (1 );
13+ }
14+ }
15+ }
Original file line number Diff line number Diff line change 1+ def test (codeql , java ):
2+ codeql .database .create ()
You can’t perform that action at this time.
0 commit comments