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

Surefire configuration of properties with spaces in values constructs incorrect Eclipse configuration #1904

Open
stevenschlansker opened this issue Dec 9, 2024 · 0 comments

Comments

@stevenschlansker
Copy link

stevenschlansker commented Dec 9, 2024

First, thank you for fixing delayed property evaluation in m2e! Now we're on to the next issue ;)

We include a upstream parent pom that declares some helpful system properties for Surefire, like:

<pluginManagement>
...
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-surefire-plugin</artifactId>
      <configuration>
        <systemPropertyVariables combine.children="append">
          <sun.jnu.encoding>${project.build.sourceEncoding}</sun.jnu.encoding>
          <user.timezone>UTC</user.timezone>
          <java.awt.headless>true</java.awt.headless>
          <java.util.logging.SimpleFormatter.format>%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %5$s%6$s%n</java.util.logging.SimpleFormatter.format>
         </systemPropertyVariables>
       </configuration>
     </plugin>
   </plugins>
</pluginManagement>

This gets faithfully written to Eclipse test runner config VM args:

-ea
 -Xmx256m -Dfile.encoding=UTF-8 -Dws.default-timeout=PT5m
-Djava.awt.headless=true
-Djava.util.logging.SimpleFormatter.format=%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %4$s %5$s%6$s%n
-Dsun.jnu.encoding=UTF-8
-Duser.timezone=UTC

Because the format has a space in it, the constructed argument list is not parsed correctly and fails the test:

Error: Could not find or load main class %1$tH:%1$tM:%1$tS
Caused by: java.lang.ClassNotFoundException: %1$tH:%1$tM:%1$tS

The configuration of properties is XML and thus clearly the value is a single argument - I don't believe adding any quoting to the POM is appropriate, since this is not shell syntax. I think m2e should handle passing property values that contain spaces correctly through to Eclipse.

Eclipse Version: 2024-12 (4.34.0)
M2E - Maven Integration for Eclipse 2.7.0.20241126-1642

Thank you and please let me know if I can provide further information.

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

1 participant