Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unresolved systemPropertyVariables in surefire break launch configs #1832

Open
hd42 opened this issue Sep 25, 2024 · 4 comments
Open

Unresolved systemPropertyVariables in surefire break launch configs #1832

hd42 opened this issue Sep 25, 2024 · 4 comments

Comments

@hd42
Copy link
Contributor

hd42 commented Sep 25, 2024

I have a problem related to the same new feature as #1824, but I believe different enough to warrant its own entry:
In my surefire plugin configuration, I have the following lines, configuring where to find the application under test for some UI tests:

                        <systemPropertyVariables>
                            <test.port>${test.port}</test.port>
                            <test.headless>${test.headless}</test.headless>
                            <test.hostname>${test.hostname}</test.hostname>
                            <test.password>${test.password}</test.password>
                        </systemPropertyVariables>

These properties are set in the .Jenkinsfile in our build jobs. When I run the tests locally without providing the properties, computed defaults for a local setup are used, which I don't want to duplicate in the POM.
Everytime I run a Maven Update in eclipse, these get added to my launch config as

-Dtest.port=null
-Dtest.headless=null
-Dtest.hostname=null
-Dtest.password=null

That leads to exceptions like java.lang.NumberFormatException: For input string: "null" when parsing the port. I believe it would be better to not write null as a property value - either just writing the property name or probably better leaving it out altogether.

-Dm2e.process.test.configuration=false as suggested by @HannesWell in #1824 works, but of course disables this otherwise cool feature for the whole workspace.

@treilhes
Copy link
Contributor

Hello @hd42,

I don't see any issue here. Unset properties are null unlike empty properties which are ""

Why not setting default properties with empty values like

<properties>
    <test.port></test.port>
    <test.headless></test.headless>
    <test.hostname></test.hostname>
    <test.password></test.password>
</properties>

If i'm not mistaken, properties set using command line parameters will override them so your jenkins build will still work

@hd42
Copy link
Contributor Author

hd42 commented Sep 30, 2024

@treilhes: I see two problems:

  1. Updating m2e broke my existing and working launch configurations
  2. writing "property=null" to the VM arguments is not setting them to null, it is setting them to the String "null", which breaks for example int properties

Adding empty properties to my pom.xml is a workaround I can use, but I believe this is still a bug.

@treilhes
Copy link
Contributor

@hd42
You may be right but i feel like discussing this won't lead us anywhere so let's be factual.
What happens when you run your build using mvn cli outside eclipse without providing those variables ?
What is the surefire/failsafe executed command line ?
I think the best approach is sticking to the cli behaviour, so if the cli populates the surefire/failsafe command line with empty values then it must be the same in eclipse

@hd42
Copy link
Contributor Author

hd42 commented Oct 2, 2024

The test run from the cli as well, because not setting the properties leads to them being not set (NULL) instead of setting them to the String "null", as happens in the launch config with m2e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants