Skip to content

Commit 241d4f4

Browse files
authored
Merge pull request #739 from bci-oss/731-fix-samm-cli-executable-jar
Fix samm-cli executable jar build and integration tests
2 parents 5916302 + f6ab43f commit 241d4f4

File tree

5 files changed

+135
-15
lines changed

5 files changed

+135
-15
lines changed

.github/workflows/dependency-update.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout
17-
uses: actions/checkout@v3
17+
uses: actions/checkout@v4
18+
1819
- name: Submit Dependency Snapshot
1920
uses: advanced-security/maven-dependency-submission-action@v3

.github/workflows/pull-request-check.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,24 @@ jobs:
6969
java --version
7070
export MAVEN_OPTS="-Xmx4096m"
7171
export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
72+
# Actual build of core SDK
7273
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
74+
# Build samm-cli executable jar and run integration tests
75+
unset JAVA_TOOL_OPTIONS
76+
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
7377
shell: bash
7478

7579
- name: Build native image
7680
if: matrix.os != 'macos-13'
7781
run: |
7882
export MAVEN_OPTS="-Xmx4096m"
79-
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
83+
# Build native binary and run integration tests
84+
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
8085
shell: bash
8186

8287
- name: Build native image (Mac)
8388
if: matrix.os == 'macos-13'
8489
run: |
85-
export MAVEN_OPTS="-Xmx4096m"
86-
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
8790
bundle="samm-bundle-DEV-SNAPSHOT-$(date +%s)"
8891
mkdir ${bundle}
8992
curl -Lo jre.tar.gz https://github.com/adoptium/temurin21-binaries/releases/download/jdk-21.0.6%2B7/OpenJDK21U-jre_x64_mac_hotspot_21.0.6_7.tar.gz

.github/workflows/release-workflow.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,11 @@ jobs:
104104
105105
# Actual build of core SDK
106106
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean deploy -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60 -DaltDeploymentRepository=local::default::file://nexus-staging -Psign
107-
# Build of CLI
107+
# Build samm-cli executable jar and run integration tests
108108
unset JAVA_TOOL_OPTIONS
109-
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
109+
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
110+
# Build native binary and run integration tests
111+
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
110112
111113
# Create .tar.gz of samm-cli
112114
pushd tools/samm-cli/target
@@ -178,7 +180,7 @@ jobs:
178180
mvn versions:commit
179181
# Actual build of core SDK
180182
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
181-
# Build of CLI
183+
# Build samm-cli executable jar and run integration tests
182184
unset JAVA_TOOL_OPTIONS
183185
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
184186
shell: bash
@@ -266,9 +268,11 @@ jobs:
266268
267269
# Actual build of core SDK
268270
mvn -B -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
269-
# Build of CLI
271+
# Build samm-cli executable jar and run integration tests
270272
unset JAVA_TOOL_OPTIONS
271-
mvn -B -pl tools/samm-cli clean verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
273+
mvn -B -pl tools/samm-cli clean verify -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
274+
# Build native binary and run integration tests
275+
mvn -B -pl tools/samm-cli verify -Pnative -Dmaven.wagon.httpconnectionManager.ttlSeconds=60
272276
shell: bash
273277

274278
- name: Upload Windows binary

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,13 @@ Building the SDK requires a Java 21-compatible [GraalVM JDK](https://www.graalvm
5858

5959
To build the SDK core components, run the following command:
6060
```bash
61-
mvn -pl '!org.eclipse.esmf:samm-cli' clean install
61+
mvn -pl '!org.eclipse.esmf:samm-cli' clean install -Pnative
6262
```
6363

6464
To also build SDK core components and the CLI tool, run the above command, followed by:
6565
```bash
66-
cd tools/samm-cli
67-
mvn -B clean verify
68-
mvn -B verify -Pnative
66+
mvn -pl org.eclipse.esmf:samm-cli clean verify
67+
mvn -pl org.eclipse.esmf:samm-cli verify -Pnative
6968
```
7069

7170
We are always looking forward to your contributions. For more details on how to contribute just take

tools/samm-cli/pom.xml

Lines changed: 115 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
<main-class>org.eclipse.esmf.SammCli</main-class>
3333
<binary-name>samm</binary-name>
3434
<skip.maven.surefire>false</skip.maven.surefire>
35-
<skip.maven.failsafe>true</skip.maven.failsafe>
35+
<skip.maven.failsafe>false</skip.maven.failsafe>
3636
<skip.maven.surefire.report.plugin>false</skip.maven.surefire.report.plugin>
3737
<skip.maven.shade>false</skip.maven.shade>
3838
</properties>
@@ -203,6 +203,106 @@
203203
</configuration>
204204
</plugin>
205205

206+
<!-- Build fat jar -->
207+
<plugin>
208+
<groupId>org.apache.maven.plugins</groupId>
209+
<artifactId>maven-shade-plugin</artifactId>
210+
<executions>
211+
<execution>
212+
<id>default-shade</id>
213+
<phase>package</phase>
214+
<goals>
215+
<goal>shade</goal>
216+
</goals>
217+
<configuration>
218+
<createDependencyReducedPom>false</createDependencyReducedPom>
219+
<createSourcesJar>false</createSourcesJar>
220+
<skip>${skip.maven.shade}</skip>
221+
<transformers>
222+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
223+
<manifestEntries>
224+
<Main-Class>${main-class}</Main-Class>
225+
</manifestEntries>
226+
</transformer>
227+
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
228+
</transformers>
229+
<artifactSet>
230+
<excludes>
231+
<!-- Duplicate annotations that are already contained in javax.annotation-api -->
232+
<exclude>javax.annotation:jsr250-api</exclude>
233+
</excludes>
234+
</artifactSet>
235+
<filters>
236+
<!-- Required to prevent overlapping resources -->
237+
<filter>
238+
<artifact>*:*</artifact>
239+
<excludes>
240+
<exclude>module-info.class</exclude>
241+
<exclude>META-INF/*</exclude>
242+
<exclude>META-INF/sisu/javax.inject.Named</exclude>
243+
<exclude>META-INF/plexus/components.xml</exclude>
244+
<exclude>META-INF.versions*/**</exclude>
245+
<exclude>META-INF/versions*/**</exclude>
246+
<exclude>META-INF/maven/**</exclude>
247+
<exclude>plugin.xml</exclude>
248+
<exclude>about.html</exclude>
249+
</excludes>
250+
</filter>
251+
<!-- Required to override the excludes above -->
252+
<filter>
253+
<artifact>${project.groupId}:${project.artifactId}</artifact>
254+
<excludeDefaults>false</excludeDefaults>
255+
<includes>
256+
<include>**</include>
257+
<include>META-INF/**</include>
258+
<include>git.properties</include>
259+
</includes>
260+
<excludes>
261+
<!-- Explicitly exclude build-time-only code from jar -->
262+
<exclude>org/eclipse/esmf/buildtime/**</exclude>
263+
</excludes>
264+
</filter>
265+
<!-- Clashes with the files from xml-apis-ext -->
266+
<filter>
267+
<artifact>xml-apis:xml-apis</artifact>
268+
<excludes>
269+
<exclude>license/**</exclude>
270+
</excludes>
271+
</filter>
272+
<!-- Clashes with the same file from batik-rasterizer -->
273+
<filter>
274+
<artifact>org.apache.xmlgraphics:batik-svgrasterizer</artifact>
275+
<excludes>
276+
<exclude>org/apache/batik/apps/rasterizer/resources/rasterizer.policy</exclude>
277+
</excludes>
278+
</filter>
279+
<!-- These configs add lots of spurious GraalVM configuration -->
280+
<filter>
281+
<artifact>org.jboss.forge.roaster:roaster-jdt</artifact>
282+
<excludes>
283+
<exclude>META-INF/native-image/**</exclude>
284+
</excludes>
285+
</filter>
286+
<!-- Required to have Model Instantiators available -->
287+
<filter>
288+
<artifact>org.eclipse.esmf:esmf-aspect-meta-model-java</artifact>
289+
<includes>
290+
<include>**</include>
291+
</includes>
292+
</filter>
293+
<!-- Prevent overlapping classes from javax modules -->
294+
<filter>
295+
<artifact>jakarta.activation:jakarta.activation-api</artifact>
296+
<excludes>
297+
<exclude>**</exclude>
298+
</excludes>
299+
</filter>
300+
</filters>
301+
</configuration>
302+
</execution>
303+
</executions>
304+
</plugin>
305+
206306
<plugin>
207307
<groupId>pl.project13.maven</groupId>
208308
<artifactId>git-commit-id-plugin</artifactId>
@@ -385,11 +485,24 @@
385485
<packaging-type>native</packaging-type>
386486
<skip.maven.surefire>true</skip.maven.surefire>
387487
<skip.maven.failsafe>false</skip.maven.failsafe>
488+
<skip.maven.shade>true</skip.maven.shade>
388489
<maven.source.skip>false</maven.source.skip>
389490
</properties>
390491

391492
<build>
392493
<plugins>
494+
<!-- When building native, skip build the jar -->
495+
<plugin>
496+
<groupId>org.apache.maven.plugins</groupId>
497+
<artifactId>maven-jar-plugin</artifactId>
498+
<executions>
499+
<execution>
500+
<id>default-jar</id>
501+
<phase>none</phase>
502+
</execution>
503+
</executions>
504+
</plugin>
505+
393506
<plugin>
394507
<groupId>org.graalvm.buildtools</groupId>
395508
<artifactId>native-maven-plugin</artifactId>
@@ -400,7 +513,7 @@
400513
<goals>
401514
<goal>compile</goal>
402515
</goals>
403-
<phase>package</phase>
516+
<phase>prepare-package</phase>
404517
</execution>
405518
</executions>
406519
<configuration>

0 commit comments

Comments
 (0)