Skip to content

Commit a270e91

Browse files
authored
Switch to Maven Shade plugin (#2935)
1 parent 457aa34 commit a270e91

File tree

8 files changed

+61
-66
lines changed

8 files changed

+61
-66
lines changed

androidgen/pom.xml

+6-13
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
</dependency>
3434
</dependencies>
3535

36+
<properties>
37+
<shade.mainClass>com.azure.autorest.android.Main</shade.mainClass>
38+
</properties>
39+
3640
<profiles>
3741
<!-- Use -Dlocal to enable this profile when running autorest.java locally -->
3842
<profile>
@@ -43,27 +47,16 @@
4347
</property>
4448
</activation>
4549
<build>
46-
<finalName>${project.artifactId}</finalName>
4750
<plugins>
4851
<plugin>
4952
<groupId>org.apache.maven.plugins</groupId>
50-
<artifactId>maven-assembly-plugin</artifactId>
53+
<artifactId>maven-shade-plugin</artifactId>
5154
<executions>
5255
<execution>
5356
<phase>package</phase>
5457
<goals>
55-
<goal>single</goal>
58+
<goal>shade</goal>
5659
</goals>
57-
<configuration>
58-
<archive>
59-
<manifest>
60-
<mainClass>com.azure.autorest.android.Main</mainClass>
61-
</manifest>
62-
</archive>
63-
<descriptorRefs>
64-
<descriptorRef>jar-with-dependencies</descriptorRef>
65-
</descriptorRefs>
66-
</configuration>
6760
</execution>
6861
</executions>
6962
</plugin>

customization-base/src/main/resources/pom.xml

-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@
6060
<build>
6161
<pluginManagement>
6262
<plugins>
63-
<plugin>
64-
<groupId>org.apache.maven.plugins</groupId>
65-
<artifactId>maven-assembly-plugin</artifactId>
66-
<version>3.7.1</version>
67-
</plugin>
6863
<plugin>
6964
<groupId>org.apache.maven.plugins</groupId>
7065
<artifactId>maven-compiler-plugin</artifactId>

docs/developer/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ As AutoRest plugin, it is defined by the [YAML section in `readme.md`](https://g
1515
Build is configured via Maven.
1616

1717
There is several build profiles:
18-
- `local` profile. It is required to be enabled. It uses `maven-assembly-plugin` to combine project output to a single jar.
18+
- `local` profile. It is required to be enabled. It uses `maven-shade-plugin` to combine project output to a single jar.
1919
- `testVanilla` profile. It enables the integrated vanilla tests, which is the common ground for all modules.
2020
- `testAzure` profile. It enables the integrated Azure tests, which tests handling of some advanced [AutoRest Extensions for OpenAPI 2.0](https://github.com/Azure/autorest/blob/main/docs/extensions/readme.md).
2121
- `testFluent` profile. It enables the integrated Fluent tests, which tests generation of Fluent management SDKs for [ARM](https://docs.microsoft.com/azure/azure-resource-manager/management/overview).

eng/versioning/external_dependencies.txt

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ com.github.spotbugs:spotbugs-maven-plugin
2727
com.puppycrawl.tools:checkstyle
2828

2929
org.apache.maven.plugins:maven-antrun-plugin
30-
org.apache.maven.plugins:maven-assembly-plugin
3130
org.apache.maven.plugins:maven-checkstyle-plugin
3231
org.apache.maven.plugins:maven-clean-plugin
3332
org.apache.maven.plugins:maven-compiler-plugin

fluentgen/pom.xml

+4-13
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
<!-- Tests requires shared static class, like FluentStatic. -->
2626
<parallelizeTests>false</parallelizeTests>
27+
28+
<shade.mainClass>com.azure.autorest.fluent.Main</shade.mainClass>
2729
</properties>
2830

2931
<dependencies>
@@ -79,27 +81,16 @@
7981
</property>
8082
</activation>
8183
<build>
82-
<finalName>${project.artifactId}</finalName>
8384
<plugins>
8485
<plugin>
8586
<groupId>org.apache.maven.plugins</groupId>
86-
<artifactId>maven-assembly-plugin</artifactId>
87+
<artifactId>maven-shade-plugin</artifactId>
8788
<executions>
8889
<execution>
8990
<phase>package</phase>
9091
<goals>
91-
<goal>single</goal>
92+
<goal>shade</goal>
9293
</goals>
93-
<configuration>
94-
<archive>
95-
<manifest>
96-
<mainClass>com.azure.autorest.fluent.Main</mainClass>
97-
</manifest>
98-
</archive>
99-
<descriptorRefs>
100-
<descriptorRef>jar-with-dependencies</descriptorRef>
101-
</descriptorRefs>
102-
</configuration>
10394
</execution>
10495
</executions>
10596
</plugin>

javagen/pom.xml

+11-18
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,17 @@
8989
<version>5.9.3</version>
9090
<scope>test</scope>
9191
</dependency>
92-
<!-- <dependency>-->
93-
<!-- <groupId>io.clientcore</groupId>-->
94-
<!-- <artifactId>core</artifactId>-->
95-
<!-- <version>1.0.0-beta.1</version>-->
96-
<!-- </dependency>-->
92+
<!-- <dependency>-->
93+
<!-- <groupId>io.clientcore</groupId>-->
94+
<!-- <artifactId>core</artifactId>-->
95+
<!-- <version>1.0.0-beta.1</version>-->
96+
<!-- </dependency>-->
9797
</dependencies>
9898

99+
<properties>
100+
<shade.mainClass>com.azure.autorest.Main</shade.mainClass>
101+
</properties>
102+
99103
<profiles>
100104
<!-- Use -Dlocal to enable this profile when running autorest.java locally -->
101105
<profile>
@@ -106,27 +110,16 @@
106110
</property>
107111
</activation>
108112
<build>
109-
<finalName>${project.artifactId}</finalName>
110113
<plugins>
111114
<plugin>
112115
<groupId>org.apache.maven.plugins</groupId>
113-
<artifactId>maven-assembly-plugin</artifactId>
116+
<artifactId>maven-shade-plugin</artifactId>
114117
<executions>
115118
<execution>
116119
<phase>package</phase>
117120
<goals>
118-
<goal>single</goal>
121+
<goal>shade</goal>
119122
</goals>
120-
<configuration>
121-
<archive>
122-
<manifest>
123-
<mainClass>com.azure.autorest.Main</mainClass>
124-
</manifest>
125-
</archive>
126-
<descriptorRefs>
127-
<descriptorRef>jar-with-dependencies</descriptorRef>
128-
</descriptorRefs>
129-
</configuration>
130123
</execution>
131124
</executions>
132125
</plugin>

pom.xml

+32-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
<parallelizeTests>true</parallelizeTests>
5151

5252
<maven.javadoc.failOnWarnings>false</maven.javadoc.failOnWarnings>
53+
54+
<shade.finalName>${project.artifactId}-jar-with-dependencies</shade.finalName>
55+
<shade.mainClass></shade.mainClass>
5356
</properties>
5457

5558
<dependencyManagement>
@@ -91,8 +94,35 @@
9194

9295
<plugin>
9396
<groupId>org.apache.maven.plugins</groupId>
94-
<artifactId>maven-assembly-plugin</artifactId>
95-
<version>3.7.1</version>
97+
<artifactId>maven-shade-plugin</artifactId>
98+
<version>3.6.0</version>
99+
<configuration>
100+
<finalName>${shade.finalName}</finalName>
101+
<minimizeJar>true</minimizeJar>
102+
<entryPoints>
103+
<entryPoint>${shade.mainClass}</entryPoint>
104+
</entryPoints>
105+
<transformers>
106+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
107+
<mainClass>${shade.mainClass}</mainClass>
108+
</transformer>
109+
110+
<!-- this handles and properly merges the content of META-INF/services in the dependencies -->
111+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
112+
</transformers>
113+
<filters>
114+
<filter>
115+
<artifact>*:*</artifact>
116+
<excludes>
117+
<!-- remove the dependencies signature as not relevant-->
118+
<exclude>META-INF/*.MF</exclude>
119+
<exclude>META-INF/*.SF</exclude>
120+
<exclude>META-INF/*.DSA</exclude>
121+
<exclude>META-INF/*.RSA</exclude>
122+
</excludes>
123+
</filter>
124+
</filters>
125+
</configuration>
96126
</plugin>
97127

98128
<!-- This plugin runs tests -->

typespec-extension/pom.xml

+7-13
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@
101101
</dependency>
102102
</dependencies>
103103

104+
<properties>
105+
<shade.finalName>emitter</shade.finalName>
106+
<shade.mainClass>com.azure.typespec.Main</shade.mainClass>
107+
</properties>
108+
104109
<profiles>
105110
<profile>
106111
<id>local</id>
@@ -114,24 +119,13 @@
114119
<plugins>
115120
<plugin>
116121
<groupId>org.apache.maven.plugins</groupId>
117-
<artifactId>maven-assembly-plugin</artifactId>
122+
<artifactId>maven-shade-plugin</artifactId>
118123
<executions>
119124
<execution>
120125
<phase>package</phase>
121126
<goals>
122-
<goal>single</goal>
127+
<goal>shade</goal>
123128
</goals>
124-
<configuration>
125-
<appendAssemblyId>false</appendAssemblyId>
126-
<archive>
127-
<manifest>
128-
<mainClass>com.azure.typespec.Main</mainClass>
129-
</manifest>
130-
</archive>
131-
<descriptorRefs>
132-
<descriptorRef>jar-with-dependencies</descriptorRef>
133-
</descriptorRefs>
134-
</configuration>
135129
</execution>
136130
</executions>
137131
</plugin>

0 commit comments

Comments
 (0)