Skip to content

Commit

Permalink
feature: use maven-shade-plugin rename protobuf-java to larksuite-oap…
Browse files Browse the repository at this point in the history
…i-shaded-protobuf-java; fix larksuite#148
  • Loading branch information
MagakiReimu committed Oct 24, 2024
1 parent d5c1b15 commit 8ed7770
Show file tree
Hide file tree
Showing 6 changed files with 571 additions and 477 deletions.
93 changes: 93 additions & 0 deletions larksuite-oapi-shaded-protobuf/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?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.larksuite.oapi</groupId>
<artifactId>larksuite</artifactId>
<version>2.0.0</version>
</parent>

<artifactId>larksuite-oapi-shaded-protobuf</artifactId>
<packaging>jar</packaging>
<version>2.3.6</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

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

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<id>shade-protobuf</id>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>com.google.protobuf:protobuf-java</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>com.google.protobuf:*</artifact>
<includes>
<include>**/*</include>
</includes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com/google/protobuf</pattern>
<shadedPattern>com/lark/oapi/google/protobuf</shadedPattern>
</relocation>
<relocation>
<pattern>google/</pattern>
<shadedPattern>com.lark.oapi.google.</shadedPattern>
<includes>
<include>**/*.proto</include>
</includes>
</relocation>
</relocations>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer">
<resources>
<resource>NOTICE</resource>
<resource>LICENSE</resource>
</resources>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>META-INF/LICENSE.txt</resource>
<file>${basedir}/../LICENSE-binary</file>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
6 changes: 3 additions & 3 deletions larksuite-oapi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@
<version>4.5.13</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.22.2</version>
<groupId>com.larksuite.oapi</groupId>
<artifactId>larksuite-oapi-shaded-protobuf</artifactId>
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
Expand Down
2 changes: 1 addition & 1 deletion larksuite-oapi/src/main/java/com/lark/oapi/ws/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.protobuf.ByteString;
import com.lark.oapi.google.protobuf.ByteString;
import com.lark.oapi.core.enums.BaseUrlEnum;
import com.lark.oapi.core.utils.Jsons;
import com.lark.oapi.event.EventDispatcher;
Expand Down
Loading

0 comments on commit 8ed7770

Please sign in to comment.