View Single Post
  #1   Spotlight this post!  
Unread 02-21-2016, 11:36 AM
yonip yonip is offline
Registered User
FRC #0449 (The Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2014
Location: Silver Spring, MD
Posts: 24
yonip is an unknown quantity at this point
[Help] Including non source files in compiled jars (or alternatives)

So this year, I decided to add a .json file to hold the configuration for our robot.
Ideally, I'd like to use the following file structure:
Code:
src/main/java/<robot package then code here>
src/main/resources/cfg.json
But then cfg.json didn't appear anywhere in the compiled .jar
So I moved cfg.json to the robot package (com.usfirt.frc.team449.robot) but it still won't appear in the compiled jar.
So I decided to look up general ways to add non-source files to the jar, but the change that this requires would have to be in the build.xml that wpilib generates via the plugin (I believe that line 94 of that build.xml taht only copies .class files to the jar would do that).

I have noticed on other threads with people asking how to find a file on the roborio, that it would be better to scp or ftp the file into /home/lvuser. Is there any way to automatically do that during the build script (without copying half the wpilib build.xml, redundantly resolving the ip of the roborio and then ssh'ing)?

Currently our working solution is running a short program to print the cfg in one line so we can paste it into a variable used as a fallback when the file isn't fount in code.
Reply With Quote