Skip to content

Commit

Permalink
Use protobuf-maven-plugin
Browse files Browse the repository at this point in the history
- No need to manually setup protoc as a pre-requisite
- More portable
  • Loading branch information
murdos committed Apr 26, 2024
1 parent 53be7b9 commit 0dc35b7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 53 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/deploy_to_central.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ jobs:
- name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.x"
- name: Checkout
uses: actions/checkout@v2
- name: Set up Maven Central Repository
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/java_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.x"
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
Expand Down
77 changes: 32 additions & 45 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
<maven-compiler-plugin.version>3.10.0</maven-compiler-plugin.version>

<!-- dependencies -->
<protobuf-java.version>3.25.0</protobuf-java.version>
<protobuf.version>3.25.0</protobuf.version>
<protobuf-maven-plugin.version>0.6.1</protobuf-maven-plugin.version>
<os-maven-plugin.version>1.7.1</os-maven-plugin.version>
<net.i2p.crypto.eddsa.version>0.3.0</net.i2p.crypto.eddsa.version>
<vavr.version>0.10.3</vavr.version>
<re2j.version>1.6</re2j.version>
Expand Down Expand Up @@ -109,6 +111,32 @@
</profiles>

<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>${os-maven-plugin.version}</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>${protobuf-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -162,49 +190,8 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun.version}</version>
<executions>
<execution>
<id>exec-protoc</id>
<phase>generate-sources</phase>
<configuration>
<target>
<mkdir dir="${project.build.directory}/generated-sources"/>
<exec executable="protoc" failonerror="true">
<arg value="-I"/>
<arg value="${project.basedir}"/>
<arg value="--java_out"/>
<arg value="${project.build.directory}/generated-sources"/>
<arg line="schema.proto"/>
</exec>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${build-helper-maven.version}</version>
<executions>
<execution>
<id>add-classes</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources</source>
</sources>
</configuration>
</execution>
</executions>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
Expand All @@ -222,7 +209,7 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf-java.version}</version>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>net.i2p.crypto</groupId>
Expand Down
File renamed without changes.

0 comments on commit 0dc35b7

Please sign in to comment.