Skip to content

Commit 4714221

Browse files
committed
Fix maven shade and optimize CI
1 parent e175ffd commit 4714221

2 files changed

Lines changed: 45 additions & 55 deletions

File tree

.github/workflows/maven.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,19 @@ jobs:
2727
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2828
settings-path: ${{ github.workspace }} # location for the settings.xml file
2929

30-
- name: Build with Maven
30+
- name: Build
3131
env:
3232
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
33-
run: |
34-
mvn clean verify -Pcoverage -Ppack --file pom.xml --batch-mode -Dsytle.colors=always --errors
35-
bash <(curl -s https://codecov.io/bash) -t $CODECOV_TOKEN -F unittests -f ./target/site/jacoco/jacoco.xml -n codecov-umbrella
36-
- name: Release
37-
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
38-
uses: samuelmeuli/action-maven-publish@v1
33+
run: mvn -B package --file pom.xml -Pcoverage -Dsytle.colors=always --errors
34+
- name: Upload coverage to Codecov
35+
uses: codecov/codecov-action@v1
3936
with:
40-
gpg_private_key: ${{ secrets.gpg_private_key }}
41-
gpg_passphrase: ${{ secrets.gpg_passphrase }}
42-
nexus_username: ${{ secrets.nexus_username }}
43-
nexus_password: ${{ secrets.nexus_password }}
37+
token: ${{ secrets.CODECOV_TOKEN }}
38+
- name: Release
39+
# if: github.event_name == 'push' && github.ref == 'refs/heads/master'
40+
uses: samuelmeuli/action-maven-publish@v1
41+
with:
42+
gpg_private_key: ${{ secrets.gpg_private_key }}
43+
gpg_passphrase: ${{ secrets.gpg_passphrase }}
44+
nexus_username: ${{ secrets.nexus_username }}
45+
nexus_password: ${{ secrets.nexus_password }}

pom.xml

Lines changed: 32 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -304,47 +304,6 @@
304304
</build>
305305
</profile>
306306

307-
<profile>
308-
<id>pack</id>
309-
<build>
310-
<plugins>
311-
<!--Based on: https://www.baeldung.com/executable-jar-with-maven-->
312-
<plugin>
313-
<groupId>org.apache.maven.plugins</groupId>
314-
<artifactId>maven-shade-plugin</artifactId>
315-
<version>3.2.0</version>
316-
<executions>
317-
<execution>
318-
<phase>package</phase>
319-
<goals>
320-
<goal>shade</goal>
321-
</goals>
322-
<configuration>
323-
<artifactSet>
324-
<includes>
325-
<include>${project.groupId}:${project.artifactId}</include>
326-
<include>com.squareup.okhttp3</include>
327-
<include>com.squareup.okio</include>
328-
</includes>
329-
</artifactSet>
330-
<relocations>
331-
<relocation>
332-
<pattern>okhttp3</pattern>
333-
<shadedPattern>${shade.id}.okhttp3</shadedPattern>
334-
</relocation>
335-
<relocation>
336-
<pattern>okio</pattern>
337-
<shadedPattern>${shade.id}.okio</shadedPattern>
338-
</relocation>
339-
</relocations>
340-
</configuration>
341-
</execution>
342-
</executions>
343-
</plugin>
344-
</plugins>
345-
</build>
346-
</profile>
347-
348307
<profile>
349308
<id>deploy</id>
350309
<!-- Based on: https://central.sonatype.org/pages/apache-maven.html-->
@@ -396,9 +355,6 @@
396355
</goals>
397356
</execution>
398357
</executions>
399-
<configuration>
400-
<source>8</source>
401-
</configuration>
402358
</plugin>
403359
<plugin>
404360
<groupId>org.sonatype.plugins</groupId>
@@ -510,6 +466,38 @@
510466
<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
511467
</configuration>
512468
</plugin>
469+
<plugin>
470+
<groupId>org.apache.maven.plugins</groupId>
471+
<artifactId>maven-shade-plugin</artifactId>
472+
<version>3.2.3</version>
473+
<executions>
474+
<execution>
475+
<phase>package</phase>
476+
<goals>
477+
<goal>shade</goal>
478+
</goals>
479+
<configuration>
480+
<artifactSet>
481+
<includes>
482+
<include>${project.groupId}:${project.artifactId}</include>
483+
<include>com.squareup.okhttp3</include>
484+
<include>com.squareup.okio</include>
485+
</includes>
486+
</artifactSet>
487+
<relocations>
488+
<relocation>
489+
<pattern>okhttp3</pattern>
490+
<shadedPattern>${shade.id}.okhttp3</shadedPattern>
491+
</relocation>
492+
<relocation>
493+
<pattern>okio</pattern>
494+
<shadedPattern>${shade.id}.okio</shadedPattern>
495+
</relocation>
496+
</relocations>
497+
</configuration>
498+
</execution>
499+
</executions>
500+
</plugin>
513501
</plugins>
514502
</build>
515503
</project>

0 commit comments

Comments
 (0)