Skip to content

Commit

Permalink
Refactor agent shade plugin usage (#23203)
Browse files Browse the repository at this point in the history
* Refactor : change the zipkin packging usage (#23178)

* Refactor : refactor the maven shade plugin structure in agent module (#23178)

* Fix : fix an incorrect path of target (#23178)
  • Loading branch information
taojintianxia authored Dec 31, 2022
1 parent ec63196 commit fd87956
Show file tree
Hide file tree
Showing 14 changed files with 399 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,22 @@
</fileSet>

<fileSet>
<directory>../plugins/logging/target/plugins</directory>
<directory>../plugins/logging/base/target/plugins</directory>
<outputDirectory>./plugins</outputDirectory>
<includes>
<include>**.jar</include>
</includes>
</fileSet>

<fileSet>
<directory>../plugins/tracing/target/plugins</directory>
<directory>../plugins/tracing/type/target/plugins</directory>
<outputDirectory>./plugins</outputDirectory>
<includes>
<include>**.jar</include>
</includes>
<excludes>
<exclude>shardingsphere-agent-tracing-test-${project.version}.jar</exclude>
</excludes>
</fileSet>
<fileSet>
<directory>../plugins/metrics/target/plugins</directory>
<directory>../plugins/metrics/type/target/plugins</directory>
<outputDirectory>./plugins</outputDirectory>
<includes>
<include>**.jar</include>
Expand All @@ -72,7 +69,7 @@
</includes>
</fileSet>
<fileSet>
<directory>../plugins/metrics/target/lib</directory>
<directory>../plugins/metrics/core/target/lib</directory>
<outputDirectory>./lib</outputDirectory>
<includes>
<include>**.jar</include>
Expand Down
43 changes: 43 additions & 0 deletions agent/plugins/logging/base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,47 @@
</parent>
<artifactId>shardingsphere-agent-logging-base</artifactId>
<name>${project.artifactId}</name>

<properties>
<target.directory>${project.basedir}/target/plugins</target.directory>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<relocations>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>${shade.package}.org.slf4j</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
15 changes: 0 additions & 15 deletions agent/plugins/logging/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
<module>base</module>
</modules>

<properties>
<target.directory>${project.basedir}/../target/plugins</target.directory>
</properties>

<dependencies>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
Expand All @@ -44,15 +40,4 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
34 changes: 33 additions & 1 deletion agent/plugins/metrics/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<name>${project.artifactId}</name>

<properties>
<target.directory>${project.basedir}/../target/lib</target.directory>
<target.directory>${project.basedir}/target/lib</target.directory>
</properties>

<dependencies>
Expand Down Expand Up @@ -57,8 +57,40 @@
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>${shade.package}.com.google.common</shadedPattern>
</relocation>
<relocation>
<pattern>net.bytebuddy</pattern>
<shadedPattern>${shade.package}.net.bytebuddy</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
15 changes: 0 additions & 15 deletions agent/plugins/metrics/type/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,4 @@
<modules>
<module>prometheus</module>
</modules>

<properties>
<target.directory>${project.basedir}/../../target/plugins</target.directory>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
53 changes: 53 additions & 0 deletions agent/plugins/metrics/type/prometheus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<name>${project.artifactId}</name>

<properties>
<target.directory>${project.basedir}/../target/plugins</target.directory>
<prometheus.version>0.11.0</prometheus.version>
<prometheus.jmx.version>0.16.1</prometheus.jmx.version>
</properties>
Expand Down Expand Up @@ -91,8 +92,60 @@
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<minimizeJar>true</minimizeJar>
<createDependencyReducedPom>false</createDependencyReducedPom>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<relocations>
<relocation>
<pattern>com.google.common</pattern>
<shadedPattern>${shade.package}.com.google.common</shadedPattern>
</relocation>
<relocation>
<pattern>net.bytebuddy</pattern>
<shadedPattern>${shade.package}.net.bytebuddy</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml.snakeyaml</pattern>
<shadedPattern>${shade.package}.org.yaml.snakeyaml</shadedPattern>
</relocation>
<relocation>
<pattern>io.prometheus.client</pattern>
<shadedPattern>${shade.package}.io.prometheus.client</shadedPattern>
</relocation>
<relocation>
<pattern>org.checkerframework</pattern>
<shadedPattern>${shade.package}.org.checkerframework</shadedPattern>
</relocation>
<relocation>
<pattern>org.slf4j</pattern>
<shadedPattern>${shade.package}.org.slf4j</shadedPattern>
</relocation>
<relocation>
<pattern>com.google.errorprone.annotations</pattern>
<shadedPattern>${shade.package}.com.google.errorprone.annotations</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
66 changes: 0 additions & 66 deletions agent/plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,70 +54,4 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>shade</goal>
</goals>
<phase>package</phase>
<configuration>
<minimizeJar>true</minimizeJar>
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadeSourcesContent>true</shadeSourcesContent>
<artifactSet>
<excludes>
<exclude>com.google.errorprone:error_prone_annotations:jar:</exclude>
<exclude>com.google.code.findbugs:jsr305:jar:</exclude>
<exclude>com.google.guava:listenablefuture:jar:*</exclude>
<exclude>com.google.j2objc:j2objc-annotations:jar:*</exclude>
<exclude>org.checkerframework:checker-qual:jar:</exclude>
<exclude>com.h2database:h2:jar:</exclude>
<exclude>org.slf4j:*</exclude>
<exclude>org.apache.commons:logging:*</exclude>
</excludes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>${shade.package}.com.google</shadedPattern>
</relocation>
<relocation>
<pattern>net.bytebuddy</pattern>
<shadedPattern>${shade.package}.net.bytebuddy</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml</pattern>
<shadedPattern>${shade.package}.org.yaml</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons.logging</pattern>
<shadedPattern>${shade.package}.org.apache.commons.logging</shadedPattern>
</relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>${shade.package}.io.netty</shadedPattern>
</relocation>
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
13 changes: 0 additions & 13 deletions agent/plugins/tracing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@

<properties>
<opentracing.version>0.31.0</opentracing.version>

<target.directory>${project.basedir}/../target/plugins</target.directory>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -69,15 +67,4 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<outputFile>${target.directory}/${project.build.finalName}.jar</outputFile>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit fd87956

Please sign in to comment.