Update Eclipse Java project to latest WPILib version

I have an old Eclipse Java project whose dependencies point to 2020.1.2 versions of the WPILib components. I would like to update the Eclipse Project and External Dependencies to the latest 2021 versions. However, updating the GradleRIO version to anything beyond 2020.1.2 results in this error:

Build file ‘C:\Users\rcorn\workspace\FRC Java\RobotLib\build.gradle’ line: 5
An exception occurred applying plugin request [id: ‘edu.wpi.first.GradleRIO’, version: ‘2021.2.1’]
Failed to apply plugin [class ‘edu.wpi.first.gradlerio.wpi.WPIPlugin’]
Could not create an instance of type edu.wpi.first.gradlerio.wpi.simulation.SimulationExtension_Decorated.
org.gradle.api.model.ObjectFactory.domainObjectContainer(Ljava/lang/Class;)Lorg/gradle/api/NamedDomainObjectContainer; build.gradle /RobotLib line 5 Gradle Error Marker

I have not been able to solve this or find another way to move this Eclipse project forward.

See the instructions here:

1 Like

GradleRIO versions are linked to a specific Gradle version. What looks to be happening is you’re still running Gradle 5.0, which doesn’t work with newer copies of GradleRIO. 2020 and 2021 copies of GradleRIO require Gradle 6.0.1 (2020.2.x might have worked with 5.0, but it wasn’t on purpose, and 6.0 was always the required version). You can update to 6.0.1 in gradle-wrapper.properties.json.

One thing to note is that 2022 will require some form of Gradle 7 (We’re not sure yet exactly), and there are also some pretty major changes in the API’s we use.

So my VSCode project uses GradleRIO 2021.3.1 in build.gradle and works fine. Does this mean the WPILib installer installs a separate Gradle appropriate for the current year?

Ok, so I answered my own question, gradle is being pulled by each project based on gradle-wrapper.properties version. Adjusting the properties for the Eclipse project updated everything as desired.

Thanks for the help.

Ah, not so fast. After the update to 2021.3.1 things look good but I have two new errors:

The import edu.wpi.first.wpilibj.geometry cannot be resolved

The import edu.wpi.first.wpilibj.LinearFilter cannot be resolved

Best I can tell these are legit imports for 2021 library.

After a lot of poking around trying to figure this issue out, the import errors went away. Can’t say what or if I did anything that fixed it. Some glitch in all the plumbing in these projects.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.