eclipse-m2e / m2e-core

Eclipse Public License 2.0
112 stars 115 forks source link

surefire.forkNumber undefined variable #1884

Open r6squeegee opened 2 hours ago

r6squeegee commented 2 hours ago

surefire.forkNumber generates an error when junit test is run from with in eclipse.

Basically in a pom.xml surefire plugin section, you can configure to fork. This works on the command line using mvn directly, this also worked in prior versions of eclipse. I'm unsure when it broke but I think it was with in the last month or so.

Reverting back to a much earlier version of eclipse (the only one I had was 2024-03) shows it worked back then.

The reason I didn't notice it the day it happened was because you must right click the project -> maven -> update project, before it breaks (or after you install a new eclipse), if your system was working with an older version it would continue working until you had to do an update-project.

attached as a simple project showing this.

dialog

project zipped : temp.zip

To un-break it, you have to downgrade to an older version of eclipse and delete the working directories .metadata directory or it will continue to appear broken even on older versions.

We also tested jdk 17,21,23 and it happens on all versions. It happened on multiple fedora 40 machines. It happened with both the eclipse-installer with bundled jdk and binary untar-gz versions with separately downloaded openjdks.

the download was tagged eclipse-jee-2024-09-R-linux-gtk-x86_64.tar.gz

the relavant part of the pom (it's in the zip file) is as follows :

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xmx1g -Duser.timezone=UTC</argLine>
<trimStackTrace>false</trimStackTrace>
<runOrder>alphabetical</runOrder>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<systemPropertyVariables>
<forkQualifier>_${surefire.forkNumber}</forkQualifier>
<!--                        <forkQualifier>_1</forkQualifier>  -->
</systemPropertyVariables>
</configuration>
</plugin>
merks commented 2 hours ago

Have you tried my suggestion to define a corresponding variable in Window -> Preferences -> Run/Debug -> String Substitutions. That definitely will solve the problem.

r6squeegee commented 1 hour ago

the problem isn't working around it, the problem is a regression in functionality.

I believe I can also work around it by adding -DDEV to the jvm run parameters.

merks commented 1 hour ago

Have you looked at the launch configuration itself? I expect it will contain the ${surefire.forkNumber} in the VM or Progres args section. It may well be that adding this is a regression or maybe it's an enhancement. I just wanted to be sure your not blocked until there is an answer and/or a fix...