Problem with Building Robot Code

Hello all,
When trying to build our robot code, there is an error that says something like

* What went wrong:
A problem occurred evaluating root project 'Timed-Imported'.
> No signature of method: build_8sfn09vasvzoi4jil66sno1.deploy() is applicable for argument types: (build_8sfn09vasvzoi4jil66sno1$_run_closure1) values: [build_8sfn09vasvzoi4jil66sno1$_run_closure1@9b6b1b2]
  Possible solutions: apply(groovy.lang.Closure), apply(java.util.Map), apply(groovy.lang.Closure), apply(java.util.Map), every(), copy(groovy.lang.Closure)

Doing some digging shows that the problem appears to be with the build.gradle, which is below.

plugins {

    id "java"

    id "edu.wpi.first.GradleRIO" version "2022.1.1"

}

sourceCompatibility = JavaVersion.VERSION_11

targetCompatibility = JavaVersion.VERSION_11

def ROBOT_MAIN_CLASS = "frc.robot.Main"

// Define my targets (RoboRIO) and artifacts (deployable files)

// This is added by GradleRIO's backing project EmbeddedTools.

deploy {

    targets {

        roboRIO("roborio") {

            // Team number is loaded either from the .wpilib/wpilib_preferences.json

            // or from command line. If not found an exception will be thrown.

            // You can use getTeamOrDefault(team) instead of getTeamNumber if you

            // want to store a team number in this file.

            team = frc.getTeamNumber()

        }

    }

    artifacts {

        frcJavaArtifact('frcJava') {

            targets << "roborio"

            // Debug can be overridden by command line, for use with VSCode

            debug = frc.getDebugOrDefault(false)

        }

        // Built in artifact to deploy arbitrary files to the roboRIO.

        fileTreeArtifact('frcStaticFileDeploy') {

            // The directory below is the local directory to deploy

            files = fileTree(dir: 'src/main/deploy')

            // Deploy to RoboRIO target, into /home/lvuser/deploy

            targets << "roborio"

            directory = '/home/lvuser/deploy'

        }

    }

}

// Set this to true to enable desktop support.

def includeDesktopSupport = false

// Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries.

// Also defines JUnit 4.

dependencies {

    implementation wpi.deps.wpilib()

    nativeZip wpi.deps.wpilibJni(wpi.platforms.roborio)

    nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop)

    implementation wpi.deps.vendor.java()

    nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio)

    nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop)

    testImplementation 'junit:junit:4.12'

    // Enable simulation gui support. Must check the box in vscode to enable support

    // upon debugging

    simulation wpi.deps.sim.gui(wpi.platforms.desktop, false)

    simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false)

    // Websocket extensions require additional configuration.

    // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false)

    // simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false)

}

// Simulation configuration (e.g. environment variables).

sim {

    // Sets the websocket client remote host.

    // envVar "HALSIMWS_HOST", "10.0.0.2"

}

// Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar')

// in order to make them all available at runtime. Also adding the manifest so WPILib

// knows where to look for our Robot Class.

jar {

    from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } }

    manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS)

}

The rest of the robot code is from last year, so would this problem simply be from outdated functionality or is it a actual code issue? Thanks.

Did you use the project importer from your old project in vscode (then open the new project it created)? Or simply change the gradlerio version? Or something else?

I imported the project, and then changed the gradlerio version.

If you imported it, it isn’t necessary to change the GradleRIO version. The import process updates that for you. Just to double check steps here, install 2022 WPILib, run the vscode 2022 that it installs, run the importer in vscode, open the new project the importer creates.

Those steps appeared to fix the issue, thanks a lot!
However, now there are a bunch of errors like this:
error: package edu.wpi.first.wpilibj2.command does not exist
import edu.wpi.first.wpilibj2.command.SubsystemBase;
error: package edu.wpi.first.wpilibj2.command does not exist
import edu.wpi.first.wpilibj2.command.Command;
et cetera et cetera.
Is this just a problem with the packages having been updated, or is it something missing on my end? Thanks a lot.

Sounds like you’re missing the command vendordep. For that particular vendordep you can just copy it from your old project (the command.json file in the vendordep folder). If you use other vendor deps (e.g. CTRE/Rev) you will need to install their 2022 versions.

That worked and solved the problem! Thanks so much.

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