Jump To Topic
Switching to Maven has been a good thing over all. Maven’s dependency management allows projects to work more consistently out of the box. No more missing dependencies, for the most part. Just clone the repo, build the project and go.
Maven’s dependency management and standard project structure results in one standard project structure that should work in any IDE that supports Maven. Unfortunately, each IDE still requires a little bit of fine-tuning to wire up our Maven goals to the IDEs’ menus.
For the initial transition, we focused most of our attention on the experience in IntelliJ and NetBeans. IntelliJ, because it is the most widely used, and NetBeans, because it provides (arguably) the best Maven integration, and therefore, didn’t require us to do very much.
We did our best with Eclipse, but will need to take a second pass at it, as it uses a very different model for its launch actions than NetBeans and IntelliJ.
We left VSCode users on their own to do the link-ups, for the most part, because they’re such a clever bunch, and we knew they’d be able to figure it out 🙂
Now that the dust has settled on the migration, we’re circling back to try to tighten it up. Our next update to the Codename One application archetype (7.0.59) includes some VSCode-specific config files to help improve integration.
Opening Projects in VSCode
In the left panel, select the “Bare-bones Java App” template, enter a package and Main Class, and select “VSCode” in the IDE drop-down. Then press the Download button.
It will prompt you to save the project, which will then download as a zip file. Extract the zip file, then open the resulting project folder in VSCode.
The project window should look like the following screenshot:
Running the Project
Unfortunately VSCode “Run” button doesn’t work to run the project in the simulator. We’re working on that. To run the project in the Codename One simulator, you’ll need to use the “Run in Simulator” command which is available in the Maven favorites menu.
In the left “Explorer” panel, you should see a “Maven” option at the bottom. Expand this to show all of the modules in the application. The first module listed is the “root” module, and is also the module on which all of the core actions are registered.
Right click on this module, then select “Favorites…” in the context menu as shown below:
This will reveal a menu with all of the important actions you’ll need to perform on your project.
Select the “Run in Simulator” option to build and launch your app in the Codename One simulator.