Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions maven-modules/maven-toolchains/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?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>
<parent>
<groupId>com.baeldung</groupId>
<artifactId>maven-modules</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>maven-toolchains</artifactId>

<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<protobuf.version>3.0.0</protobuf.version>
</properties>

<dependencies>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.19.4</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>24</version>
<vendor>liberica</vendor>
</jdk>
<protobuf>
<version>${protobuf.version}</version>
</protobuf>
</toolchains>
</configuration>
</plugin>

<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
24 changes: 24 additions & 0 deletions maven-modules/maven-toolchains/src/main/proto/addressbook.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
syntax = "proto3";

option java_package = "com.baeldung";
option java_multiple_files = true;
option java_outer_classname = "AddressBookProtos";

message Address {
string street_address = 1;
string city = 2;
string state = 3;
string postal_code = 4;
}

message Contact {
string first_name = 1;
string last_name = 2;
string email = 3;
string phone_number = 4;
Address address = 5;
}

message AddressBook {
repeated Contact contacts = 1;
}
25 changes: 25 additions & 0 deletions maven-modules/maven-toolchains/toolchains.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<toolchains>
<!-- JDK toolchains -->
<toolchain>
<type>jdk</type>
<provides>
<version>24</version>
<vendor>liberica</vendor>
</provides>
<configuration>
<jdkHome>/opt/liberica-24</jdkHome>
</configuration>
</toolchain>

<!-- Protocol Buffers toolchains -->
<toolchain>
<type>protobuf</type>
<provides>
<version>3.0.0</version>
</provides>
<configuration>
<protocExecutable>/opt/protoc-3.0.0/bin/protoc</protocExecutable>
</configuration>
</toolchain>
</toolchains>
2 changes: 2 additions & 0 deletions maven-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
<module>multimodulemavenproject</module>
<module>resume-from</module>
<module>maven-multiple-repositories</module>
<!-- Commented out maven-toolchains due to missing tools on build server -->
<!-- <module>maven-toolchains</module>-->
</modules>

<dependencyManagement>
Expand Down