Forge allows developers to use the familiar terminal or command line interface within an Integrated Development Environment (IDE).
To begin using Forge, launch the Forge Console view by navigating to → → → → .
The Forge Console will launch in an inactive state. How and when Forge starts can be changed, see Chapter 5, Preferences.
To start Forge, click the green arrow in the Forge Console.
Once Forge starts you will notice the name Forge appear in the Forge Console view and a command line currently in your root workspace directory, without a project selected.
From the Forge Console command line you can type the command cd
(change directory) followed by the directory to change to, and if a navigator view is opened, the navigator view will also change to the specified directory. If the resource is not in the local workspace and the Remote Systems view is open, the directory will be selected in the Remote Systems explorer.
Through the Forge Console you can also link the console output to the currently open editor by clicking on the button.
If you find it easier to navigate your project via the Project Explorer view, you can right-click on a file from this view and select → from the context menu.
This will automatically execute the pick-up
command, changing the current Forge runtime context to the selected resource and opening the file or folder. For more on this command see: Section 4.2, “The pick-up command”
If you close the Forge Console view, Forge will continue to run in the background. Re-opeing the Forge Console view will display the latest Forge state.
To stop Forge, click on the red square in the Forge Console.
Outlined in this chapter are the commands you will use most often when developing projects with the Forge runtime.
The command new-project
allows you to create a new project and have it automatically imported into your workspace.
The format of the command is:
new-project --named example --topLevelPackage com.example
Once the command has been executed, the new project will appear in your Project Explorer.
Persistence can be added to a project through the use of the command persistence setup
.
The format of the command is:
persistence setup --provider HIBERNATE --container JBOSS_AS6
Once the command has been executed a new file will have been created called persistence.xml
. The file will appear under your project in the Project Explorer, and will automatically open in an editor.
A new entity can be created for a project by using the command entity
.
The format of the command is:
entity --named Customer
Once the command has been executed a new entity will have been created. The entity will appear under your project's domain in the Project Explorer, and the Java file will automatically open in an editor.
A new field can be created for an entity by using the command field string
.
The format of the command is:
field string --named firstName
Once the command has been executed a new field will have been created in the selected entity. The field will appear in the Java editor and in the Outline view.
Outlined in this chapter are general commands for interacting with the Forge runtime, your projects and the workspace.
The command open
allows you to open a file or folder.
The format of the command is:
open foo/pom.xml
Using the command to open a file will open it in an editor. Executing the command on a folder in your workspace will expanded the folder in the Project Explorer view. If the resource is a folder outside the workspace it will be selected and expanded in the Remote Systems view.
The command pick-up
allows you to view the contents of a directory or navigate to a file and automatically open it.
The format of the command for a directory is:
pick-up foo/
Executing the command on a directory will write the contents of the directory to the screen.
The format of the command for a file is:
pick-up foo/pom.xml
Using the command to open a file will open it in an editor.
Forge preferences can be accessed by navigating to
→ → .From the main Forge preference page you can set how Forge should be started. If you select to Start Forge when Eclipse starts Forge will automatically run on launch. Setting the option to Start Forge in Debug Mode will force Forge to debug mode every time it is started.
Selecting embedded.
from the preferences menu will display the currently installed Forge runtimes and their location. the Forge runtime shipped with Forge Tools displays with the nameYou can have more than one Forge runtime installed at once. To install an alternate runtime to the one provided click on the
button.To add a new Forge runtime you will need to specify a name and provide the runtime location. Once the fields have been completed, click the Installed Forge Runtimes page. Once successfully installed, the new Forge runtime will appear in the Installed Forge Runtimes list.
button to return to the