Skip to content

Commit 39776bf

Browse files
committed
build: publish a shaded version in addition to plain client6
io.grpc uses META-INF/services to dynamically load NameResolver providers. When building a fat JAR, plugins like maven-assembly-plugin won't merge overlapping config files without an additional configuration on the end-user's side. While configuring the plugin is not difficult and we could document this in our README, we will do our users one better: using maven-shade-plugin we can distribute a shaded version of client6 with all its' dependencies' configurations resolved in advance (in addition to the 'slim' version of the lib). Now, when trying to build a fat JAR all that our users will need to do is include <classifier>all</classifier> tag to client6 <dependency> block.
1 parent 48cb18f commit 39776bf

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

pom.xml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,6 @@
217217
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.58.0:exe:${os.detected.classifier}</pluginArtifact>
218218
<outputDirectory>src/main/java</outputDirectory>
219219
<clearOutputDirectory>false</clearOutputDirectory>
220-
221220
</configuration>
222221
<executions>
223222
<execution>
@@ -445,6 +444,28 @@
445444
<artifactId>maven-project-info-reports-plugin</artifactId>
446445
<version>3.1.1my</version>
447446
</plugin>
447+
448+
<plugin>
449+
<groupId>org.apache.maven.plugins</groupId>
450+
<artifactId>maven-shade-plugin</artifactId>
451+
<version>3.6.0</version>
452+
<configuration>
453+
<createDependencyReducedPom>false</createDependencyReducedPom>
454+
<shadedArtifactAttached>true</shadedArtifactAttached>
455+
<shadedClassifierName>all</shadedClassifierName>
456+
<transformers>
457+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
458+
</transformers>
459+
</configuration>
460+
<executions>
461+
<execution>
462+
<phase>package</phase>
463+
<goals>
464+
<goal>shade</goal>
465+
</goals>
466+
</execution>
467+
</executions>
468+
</plugin>
448469
</plugins>
449470
</pluginManagement>
450471
<plugins>
@@ -464,6 +485,10 @@
464485
<groupId>org.codehaus.mojo</groupId>
465486
<artifactId>build-helper-maven-plugin</artifactId>
466487
</plugin>
488+
<plugin>
489+
<groupId>org.apache.maven.plugins</groupId>
490+
<artifactId>maven-shade-plugin</artifactId>
491+
</plugin>
467492
<plugin>
468493
<groupId>org.apache.maven.plugins</groupId>
469494
<artifactId>maven-javadoc-plugin</artifactId>

0 commit comments

Comments
 (0)