STS 4 and JUnit 5

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

STS 4 and JUnit 5

grampajohn
Administrator
Dear colleagues -

Sooner or later, most likely after the 2019 tournament, we'll need to upgrade the Power TAC code to Java 11. If you are using the Spring Tool Suite (STS) for your coding, that means you will have to move to STS version 4, which is available now. I have upgraded my development environment to STS 4, and in the process found that it won't run our tests, apparently because the test reporting functionality depends on JUnit 4, and we have already transitioned to JUnit 5 in our code base.

I found a workaround that does not require any changes in our code. It does require that we modify the project classpath in STS/Eclipse to include JUnit 4. We don't want to include this dependency in our pom.xml files, because it's not needed to build and run the Power TAC code using maven, and could lead to conflicts (although I have not tested that). So here's what you have to do if you upgrade to STS 4:

1. Download the JUnit 4 jar file.

2. Put the downloaded jar file in your STS workspace. If you are not sure where that is, open STS and bring up the Preferences dialog under Window->Preferences. In the Preferences dialog, the path is shown under General/Workspace. If you haven't modified the default settings, that will almost certainly be ~/workspace.

3. In the project where you need to run tests, open the project properties dialog (under Project->Properties) and go to the Java Build Path. Select Add External JARs... and add the downloaded JUnit 4 jar file. This will modify the project .classpath, but that will be a local change and will not get pushed to github. That's because powertac-server/.gitignore explicitly prevents .classpath files from being committed.

As always, please let us know if you run into trouble with this.

John
Reply | Threaded
Open this post in threaded view
|

Re: STS 4 and JUnit 5

erikkemperman
If I understand the issue properly, this should resolve itself when STS is upgraded to latest Eclipse:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=538956

In the meantime we can use John’s workaround (or just run tests in Maven.)