Files
2026-05-09 12:47:01 +02:00

179 lines
7.0 KiB
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.0.6</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>25</java.version>
<zitadel.tag>v4.15.0</zitadel.tag>
<zitadel.version>4.15.0</zitadel.version>
<grpc.version>1.69.0</grpc.version>
<protobuf.version>3.25.5</protobuf.version>
<googleapis.commit>master</googleapis.commit>
<protoc-gen-validate.version>v1.0.4</protoc-gen-validate.version>
<grpc-gateway.version>v2.20.0</grpc-gateway.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>4.4.0</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>${protobuf.version}</version>
</dependency>
<!-- gRPC's generated code references javax.annotation.Generated -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>annotations-api</artifactId>
<version>6.0.53</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.1</version>
</extension>
</extensions>
<plugins>
<!-- 1. Fetch Zitadel + 3rd-party proto sources into target/proto -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>fetch-protos</id>
<phase>generate-sources</phase>
<goals><goal>run</goal></goals>
<configuration>
<target xmlns:unless="ant:unless">
<property name="proto.root" value="${project.build.directory}/proto"/>
<property name="proto.deps" value="${project.build.directory}/proto"/>
<property name="proto.work" value="${project.build.directory}/proto-work"/>
<!-- Zitadel: download + extract proto/zitadel only if not already present -->
<condition property="zitadel.fetched">
<available file="${proto.root}/zitadel/user/v2/user_service.proto"/>
</condition>
<sequential unless:true="zitadel.fetched">
<mkdir dir="${proto.work}"/>
<get src="https://github.com/zitadel/zitadel/archive/refs/tags/${zitadel.tag}.tar.gz"
dest="${proto.work}/zitadel.tar.gz"
skipexisting="true"/>
<untar src="${proto.work}/zitadel.tar.gz" dest="${proto.work}" compression="gzip"/>
<mkdir dir="${proto.root}/zitadel"/>
<copy todir="${proto.root}/zitadel">
<fileset dir="${proto.work}/zitadel-${zitadel.version}/proto/zitadel"/>
</copy>
</sequential>
<!-- googleapis (we only need a few files) -->
<mkdir dir="${proto.deps}/google/api"/>
<get src="https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/api/annotations.proto" dest="${proto.deps}/google/api/annotations.proto" skipexisting="true"/>
<get src="https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/api/http.proto" dest="${proto.deps}/google/api/http.proto" skipexisting="true"/>
<get src="https://raw.githubusercontent.com/googleapis/googleapis/${googleapis.commit}/google/api/field_behavior.proto" dest="${proto.deps}/google/api/field_behavior.proto" skipexisting="true"/>
<!-- protoc-gen-validate -->
<mkdir dir="${proto.deps}/validate"/>
<get src="https://raw.githubusercontent.com/bufbuild/protoc-gen-validate/${protoc-gen-validate.version}/validate/validate.proto" dest="${proto.deps}/validate/validate.proto" skipexisting="true"/>
<!-- grpc-gateway openapiv2 options -->
<mkdir dir="${proto.deps}/protoc-gen-openapiv2/options"/>
<get src="https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/${grpc-gateway.version}/protoc-gen-openapiv2/options/annotations.proto" dest="${proto.deps}/protoc-gen-openapiv2/options/annotations.proto" skipexisting="true"/>
<get src="https://raw.githubusercontent.com/grpc-ecosystem/grpc-gateway/${grpc-gateway.version}/protoc-gen-openapiv2/options/openapiv2.proto" dest="${proto.deps}/protoc-gen-openapiv2/options/openapiv2.proto" skipexisting="true"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- 2. Compile zitadel/user/v2 (and transitively required) protos to Java + gRPC stubs -->
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.6.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}</pluginArtifact>
<protoSourceRoot>${project.build.directory}/proto</protoSourceRoot>
<includes>
<include>zitadel/user/v2/*.proto</include>
<include>zitadel/object/v2/*.proto</include>
<include>zitadel/filter/v2/*.proto</include>
<include>zitadel/metadata/v2/*.proto</include>
<include>zitadel/protoc_gen_zitadel/v2/*.proto</include>
<include>validate/validate.proto</include>
<include>protoc-gen-openapiv2/options/*.proto</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>