Change Eclipse wpilib directory

First time poster and complete noob here. Any help is appreciated!

My end goal is to have our code shared between computers using github, sourcetree, and eclipse. We are primarily programming on MacBook Pros. My guess is that everything that relates to the user account folder needs to change because as soon as I push that to github and pull it down on another computer there will obviously be errors.

It seems the wpilib directory is installed by default to the home user account on Mac. I cannot find a way to change this directory. Instead, I copied the directory to the root folder (Macintosh HD), which is also where I placed the /Repositories folder (and made that folder the default workspace in Eclipse).

Naturally that threw some build path errors so I went into the build path preferences and updated the wpilib and networktables variables to be my new /wpilib directory.

Everything seemed to be working fine until I went to build. I am now getting some errors and it is obvious that it is still looking to the home directory for certain things.

Here is the output of the build:

Buildfile: /Repositories/Team-5407/build.xml
Trying to override old definition of task classloader
clean:
   [delete] Deleting directory /Repositories/Team-5407/build
   [delete] Deleting directory /Repositories/Team-5407/dist
compile:
    [mkdir] Created dir: /Repositories/Team-5407/build
     [echo] [athena-compile] Compiling src with classpath=/Users/rickcastorani/wpilib/java/current/lib/WPILib.jar:/Users/rickcastorani/wpilib/java/current/lib/NetworkTables.jar to build
    [javac] Compiling 20 source files to /Repositories/Team-5407/build
jar:
     [echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
    [mkdir] Created dir: /Repositories/Team-5407/dist
    [mkdir] Created dir: /Repositories/Team-5407/build/jars
     [echo] [athena-jar] Copying jars from /Users/rickcastorani/wpilib/java/current/lib/WPILib.jar:/Users/rickcastorani/wpilib/java/current/lib/NetworkTables.jar to build/jars.
     [copy] Copying 2 files to /Repositories/Team-5407/build/jars
      [jar] Building jar: /Repositories/Team-5407/dist/FRCUserProgram.jar
get-target-ip:
     [echo] Trying Target: roboRIO-5407.local
Unknown host: roboRIO-5407.local
     [echo]  roboRIO not found via mDNS, falling back to static USB
     [echo] roboRIO not found via USB, falling back to static address of 10.54.7.2

BUILD FAILED
/wpilib/java/current/ant/build.xml:45: Assertion failed boolean test.
roboRIO not found, please check that the roboRIO is connected, imaged and that the team number is set properly in Eclipse

Total time: 18 seconds

And here is my updated build.xml in my attempt to tweak it so that it does not use the home user directory:

<?xml version="1.0" encoding="UTF-8"?>

<project name="FRC Deployment" default="deploy">

  <!--
  The following properties can be defined to override system level
  settings. These should not be touched unless you know what you're
  doing. The primary use is to override the wpilib version when
  working with older robots that can't compile with the latest
  libraries.
  -->

  <!-- By default the system version of WPI is used -->
  <!-- <property name="version" value=""/> -->

  <!-- By default the system team number is used -->
  <!-- <property name="team-number" value=""/> -->

  <!-- By default the target is set to 10.TE.AM.2 -->
  <!-- <property name="target" value=""/> -->

  <!-- Any other property in build.properties can also be overridden. -->
  
  <property file="/wpilib/wpilib.properties"/>
  <property file="build.properties"/>
  <property file="/wpilib/java/${version}/ant/build.properties"/>
  
  <import file="/wpilib/java/current/ant/build.xml"/>

</project>

Did you actually try this? We’ve been using projects on multiple windows computers with various user names. The plugins use environment variables to resolve the correct path on any computer. I haven’t tried it on OS X, but it should be the same.

It’s failing to communicate with the roboRIO, which does not appear to be related to moving everything. Does it communicate with the default settings?

Interesting…maybe I took this a bit too far when I noticed user name errors when the repository was in the user folder as well. I’ll redo the wpilib and networktables variables back to the user folder and keep the repository on the root and see if that works. Thanks!

It’s okay to use the default location for wpilib because by default, the user’s home directory is expressed as a variable user.home in build.xml rather than explicitly. Therefore, your code is already portable between machines.

Thanks for the confirmation. I successfully reworked our environment so that the repository is under /Repositories and the wpilib is under /Users/<user>/wpilib and it all seems to be working great between machines. Thanks!