Skip to content

Commit d422afa

Browse files
committed
BAEL-9373: Add Maven 4 sample
1 parent 2ce4c3b commit d422afa

File tree

6 files changed

+164
-0
lines changed

6 files changed

+164
-0
lines changed

apache-maven-4/pom.xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project root="true"
3+
xmlns="http://maven.apache.org/POM/4.1.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
6+
7+
<groupId>com.baeldung</groupId>
8+
<artifactId>apache-maven-4</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
<packaging>pom</packaging>
11+
12+
<dependencyManagement>
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.junit</groupId>
16+
<artifactId>junit-bom</artifactId>
17+
<version>${junit-bom.version}</version>
18+
<type>pom</type>
19+
<scope>import</scope>
20+
</dependency>
21+
<dependency>
22+
<groupId>org.apache.logging.log4j</groupId>
23+
<artifactId>log4j-core</artifactId>
24+
<version>${log4j-core.version}</version>
25+
</dependency>
26+
<dependency>
27+
<groupId>org.projectlombok</groupId>
28+
<artifactId>lombok</artifactId>
29+
<version>${lombok.version}</version>
30+
<scope>provided</scope>
31+
</dependency>
32+
</dependencies>
33+
</dependencyManagement>
34+
35+
<dependencies>
36+
<dependency>
37+
<groupId>org.projectlombok</groupId>
38+
<artifactId>lombok</artifactId>
39+
<version>${lombok.version}</version>
40+
<type>classpath-processor</type>
41+
<scope>provided</scope>
42+
</dependency>
43+
</dependencies>
44+
45+
<build>
46+
<!-- Necessary for the Maven 4 Release Candidate -->
47+
<pluginManagement>
48+
<plugins>
49+
<plugin>
50+
<artifactId>maven-compiler-plugin</artifactId>
51+
<version>${maven-compiler-plugin.version}</version>
52+
</plugin>
53+
<plugin>
54+
<artifactId>maven-install-plugin</artifactId>
55+
<version>${maven-install-plugin.version}</version>
56+
</plugin>
57+
</plugins>
58+
</pluginManagement>
59+
</build>
60+
61+
<profiles>
62+
<profile>
63+
<id>conditional-profile</id>
64+
<activation>
65+
<condition>
66+
<![CDATA[exists('${project.basedir}/src/**/*.xsd') && length(${user.name}) > 5]]></condition>
67+
</activation>
68+
</profile>
69+
</profiles>
70+
71+
<properties>
72+
<!-- Maven 4 needs 17+ -->
73+
<maven.compiler.source>17</maven.compiler.source>
74+
<maven.compiler.target>17</maven.compiler.target>
75+
<junit-bom.version>5.13.4</junit-bom.version>
76+
<log4j-core.version>2.24.3</log4j-core.version>
77+
<lombok.version>1.18.42</lombok.version>
78+
<!-- Necessary for the Maven 4 Release Candidate -->
79+
<maven-compiler-plugin.version>4.0.0-beta-3</maven-compiler-plugin.version>
80+
<maven-install-plugin.version>4.0.0-beta-2</maven-install-plugin.version>
81+
</properties>
82+
83+
</project>

apache-maven-4/project-a/pom.xml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.1.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
6+
7+
<parent/>
8+
9+
10+
<groupId>com.baeldung.apache-maven-4</groupId>
11+
<artifactId>project-a</artifactId>
12+
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.junit.jupiter</groupId>
16+
<artifactId>junit-jupiter-engine</artifactId>
17+
<scope>test</scope>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.apache.logging.log4j</groupId>
21+
<artifactId>log4j-core</artifactId>
22+
</dependency>
23+
</dependencies>
24+
25+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.example;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App {
8+
9+
public static void main(String[] args) {
10+
System.out.println("Hello World!");
11+
}
12+
13+
}

apache-maven-4/project-b/pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project
3+
xmlns="http://maven.apache.org/POM/4.1.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://maven.apache.org/POM/4.1.0 http://maven.apache.org/xsd/maven-4.1.0.xsd">
6+
7+
<parent/>
8+
9+
10+
<groupId>com.baeldung.apache-maven-4</groupId>
11+
<artifactId>project-b</artifactId>
12+
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>org.projectlombok</groupId>
17+
<artifactId>lombok</artifactId>
18+
</dependency>
19+
</dependencies>
20+
21+
</project>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example;
2+
3+
/**
4+
* Hello world!
5+
*
6+
*/
7+
public class App {
8+
public static void main(String[] args) {
9+
System.out.println("Hello World!");
10+
new Person().setName("Jack");
11+
}
12+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example;
2+
3+
import lombok.Data;
4+
5+
@Data
6+
public class Person {
7+
8+
private String name;
9+
10+
}

0 commit comments

Comments
 (0)