-
Notifications
You must be signed in to change notification settings - Fork 0
Developing in other IDEs
If you, like some of us, prefer to develop in a specific IDE, that is not Eclipse, read on here!
Internally in our team, we use Netbeans and IntelliJ IDEA alongside Eclipse and are therefore going to focus on these in this article. But the general approach should be similar in other IDE's as well.
The easiest approach is to create a WPILib java project in Eclipse, and then importing that project into either Netbeans or IntelliJ.
The DK-Robotics FRC project in this GitHub repository is actually stored as an Eclipse project. Therefore, you can import it directly into Eclipse, or import it into either Netbeans or IntelliJ, as described below
Fortunately, both Netbeans and IntelliJ have options for importing existing Eclipse projects into the respective applications. This is what you should do, if you want to develop this project in Netbeans or IntelliJ.
In Netbeans, go to the menu File -> Import Project -> Eclipse Project...
.
If you have the Eclipse project in Eclipse's workspace
directory, then choose Import Projects from Workspace
and navigate to the projects folder.
If you, however, do not have the project in the Eclipse workspace
directory (ie if you have just downloaded this project, and haven't had it open in Eclipse before), then choose the latter option in the dialog; Import Project ignoring Project Dependencies
, locate the project folder, and choose a destination directory.
Either way, just click Finish
, and the magic will happen!
Notice that this DK-Robotics FRC project contains four
.jar
files, that are automatically linked as libraries. These files are located infrc2017/libs
. It is vital that you include these files! So be sure to do so, if you create your own new project, that you intend to develop outside of Eclipse.
In IntelliJ, go to the menu File -> New -> Project from Existing Sources...
and navigate to the Eclipse project folder and click OK
. This will open up the Import Project
dialog. Select Import project from external model
, select Eclipse
and hit Next
and Next again
. Everything should already be selected the right way by default, so simply follow the wizard to the end.
Notice that this DK-Robotics FRC project contains four
.jar
files, that are automatically linked as libraries. These files are located infrc2017/libs
. It is vital that you include these files! So be sure to do so, if you create your own new project, that you intend to develop outside of Eclipse.
As long as the dependencies/libraries are correctly imported (as they are in this Github project, as stated in the note above), you can build the project just like you are used to doing in both Netbeans and IntelliJ. This might be a nice way to check for any possible syntax errors.
Unfortunately, though, it is not possible to upload the project to the RoboRIO and run it, as the FRC WPILib plugin is only available in Eclipse... At least not the way it is done in Eclipse:
Thankfully, the team behind WPILib have done much to as many standards as possible, which means we can use the underlying scripts/build files! Inside the project folder frc2017/
resides a file named build.xlm
, which is the Ant build task, that the Eclipse plugin calls.
Therefore, we can just run that build file from the Terminal/CLI/CMD, by navigating to the project folder cd somefilepath/frc2017
and typing ant
in the console. This will automatically run the correct file, and do all the magic, including downloading the compiled project (FRCUserProgram.jar) to the robot and running it! (providing Ant is installed on your machine)
Alternatively, IntelliJ actually has some rather nice Ant building capabilities built in. This means that you can add the build.xml
file from the project as an Ant build, and then execute that directly from within IntelliJ. This is a nice way of doing it, that practically resembles the function of the Eclipse plugin.
We assume that a similar approach is possible in Netbeans as well, we just haven't figured out how, yet. But the Terminal way of doing it is so nice and easy anyways (especially on Linux and Mac) that we don't really care much
Both Eclipse, Netbeans and IntelliJ automatically synchronizes the opened project files (all the .java files) in the background, when they are edited/modified in other applications. This implies that you can have the project open in multiple different IDE's, and use them all to develop the same project and modify the same files.
This might be useful if you still prefer to use the Eclipse plugin to upload code to the robot, but wants to write your application in a different IDE; you can just have Eclipse hanging around in the background while you edit in your preferred IDE, and quickly switch back to Eclipse just to upload the code, and back again.
Another really nice implication is that you can switch between different git branches in any of the IDE's, via the terminal/CLI and an application like SourceTree or GitKraken, and your changes/checkouts in any of those applications will automatically appear and be reflected in every of the other applications!