question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

additional system properties are not passed as arguments to native execution during maven verify

See original GitHub issue

Describe the bug Additional system properties, which are configured inside the <systemProperties> attribute in the maven-failsafe-plugin part, are not passed as arguments to native execution during maven verify. For example:

... <configuration> <systemProperties> <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> <quarkus.http.test-port>8444</quarkus.http.test-port> <test.url>https://localhost:8444</test.url> <java.library.path>native-libs</java.library.path> </systemProperties> </configuration>

The values for <quarkus.http.test-port> and <test.url> are applied correctly but the value for <java.library.path> is not appended to the execute command (see behaviour below).

Expected behavior The output in the log states: Executing [/home/daniel/IdeaProjects/lmt2-server/target/lmt2-server-1.0-SNAPSHOT-runner, -Dquarkus.http.port=8444, -Dtest.url=http://localhost:8444, -Dquarkus.log.file.path=target/quarkus.log, -Djava.library.path=native-libs]

Actual behavior The output in the log states: Executing [/home/daniel/IdeaProjects/lmt2-server/target/lmt2-server-1.0-SNAPSHOT-runner, -Dquarkus.http.port=8444, -Dtest.url=http://localhost:8444, -Dquarkus.log.file.path=target/quarkus.log]

To Reproduce Steps to reproduce the behavior:

  1. Add some system property to the configuration of the maven-failsafe-plugin
  2. Execute mvn verify -Pnative

Environment (please complete the following information):

  • Linux xxxxxxxxxxxx 4.15.0-70-generic #79-Ubuntu SMP Tue Nov 12 10:36:11 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux openjdk version “1.8.0_232” OpenJDK Runtime Environment (build 1.8.0_232-20191008104205.buildslave.jdk8u-src-tar–b07) OpenJDK 64-Bit GraalVM CE 19.2.1 (build 25.232-b07-jvmci-19.2-b03, mixed mode) Quarkus Version 1.0

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
pantaorancommented, Oct 8, 2021

Thank you @benDeMtp, that has helped me a lot. Indeed it’s using the property when I put it there 👍

1reaction
benDeMtpcommented, Oct 8, 2021

I think during verify, the native image is already build. So properties from quarkus.native.additional-build-args will be ignore, because the build is already done. The problem described here is for other systemProperties needed for run tests (like proxy settings). In this case a QuarkusTestProfile or QuarkusTestResourceLifecycleManager should do the trick.

@pantaoran, In your case, I think you have a problem with your package phase You should have something like these settings in your pom.xml

        <profile>
            <id>native</id>
            <properties>
                <quarkus.native.additional-build-args>
                    -H:ResourceConfigurationFiles=resources-config.json,-H:ReflectionConfigurationFiles=reflection-config.json
                </quarkus.native.additional-build-args>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                                <configuration>
                                    <systemProperties>
                                        <native.image.path>
                                            ${project.build.directory}/${project.build.finalName}-runner
                                        </native.image.path>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven Surefire Plugin – Using System Properties
Using System Properties. There are two ways to add a list of system properties to Surefire: systemPropertyVariables.
Read more >
JUnit tests pass in Eclipse but fail in Maven Surefire
In my case the problem was very likely that a configuration file read by the JUnit test stayed in the memory, corrupting the...
Read more >
Building applications with Maven - Quarkus
Add system properties to maven-surefire-plugin . maven.home is only required if you have custom configuration in ${maven.home}/conf/settings.xml .
Read more >
Maven plugin for GraalVM Native Image building
The plugin figures out which JAR files it needs to pass to the native image and what the executable main class should be....
Read more >
Testing in Java & JVM projects - Gradle User Manual
Gradle executes tests in a separate ('forked') JVM, isolated from the main ... does not exist or an invalid JVM argument is provided,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found