JBoss.orgCommunity Documentation
Forge is an application for developing Java EE applications, promoting ease in getting started, working efficiently, and integrating technologies. It simplifies development workflow by providing automation at a command line level. Such automation is useful if you are working with new or complex technology or completing repetitive tasks.
Forge consists of a command line interface and sets of commands provided through plug-ins. The Forge command line accepts standard Unix commands such as cd
for change directory, mkdir
to create a new directory and touch
to create a new file. But Forge's real power lies in its unique command set, which is extendable through plugins. For example, the scaffold
command generates a user interface for an application and the persistence
command adds persistence to a project. Furthermore, Forge comprehends a range of file types, with actions for working with their contents.
Forge Tools is tooling that integrates Forge into the IDE. It enhances your workflow by providing and integrating Forge functionality within the IDE.
Forge Tools consists of the Forge Console and background actions. The Forge Console provides a Forge command line on which to execute all of the Forge commands. The background actions result in the outcome of the Forge commands being immediately reflected in the IDE. For example, files are opened in editors and projects and directories expanded in explorer tabs as actions creating and modifying them are executed on the Forge command line.
The aim of this section is to guide you in using Forge Tools:
View and manage the Forge Console tab, from which the Forge command line is accessible
Start and stop the Forge runtime server in order to access the command line
Navigate to project resources in the Forge command line
Understand how Forge commands affect the IDE through background actions, such as expanding directories in explorer tabs and opening files in editors
Use wizards for accomplishing common Forge commands as an alternative to the Forge command line
A key element for working with Forge is the Forge command line. In order to view this, you need to open the Forge Console tab.
To open the Forge Console tab, click → → . Expand Forge, select Forge Console and click . Alternatively, press Ctrl+4, at which you are prompted whether you also want to start Forge. Irrespective of your response to starting Forge, the Forge Console tab opens.
You must start a Forge runtime server in order to access the Forge command line. Forge Tools provides actions for starting and managing the Forge runtime server.
In the Forge Console tab, click the icon
. Alternatively, press Ctrl+4 and at the prompt asking if you want to start Forge, click . A progress bar in the IDE window and text in the Forge Console tab indicate the starting status of the Forge runtime server.
With a running instance of Forge, in the Forge Console tab click the icon
. Despite the Forge Console tab not being open, Forge will continue to run in the background. Reopen the Forge Console tab to access the same Forge command line, identifiable by the existing command line output.
In the Forge Console tab, click the icon
. Alternatively, on the Forge command line, enter
exit
.
Forge Tools enables you to efficiently navigate to project resources, such as directories and files, on the Forge command line.
To navigate to a project resource on the Forge command line, in the Project Explorer tab right-click any project resource and click → . If the Forge runtime server is not started, you are prompted to start it. At the prompt, click .
Alternatively, in the Project Explorer tab, select a project resource and click the icon
in the Forge Console tab.
Both of these actions result in the Forge command line automatically executing the pick-up
command for the project resource. Following this, the command line navigates to the project resource, the command prompt indicates the selected resource, and the resource opens in an editor if it is a file.
Forge Tools invokes background actions in the IDE in response to commands issued on the command line in the Forge Console. For example, if you create a project file or directory on the Forge command line, the Project Explorer tab is automatically refreshed to show the newly created project resource. A list of Forge commands that result in additional background actions is given below.
cd
The command navigates to the project directory and selects it in the Project Explorer and Package Explorer tabs.
pick-up
The command navigates to the project resource and in the case that the resource is a file it is opened in an editor within the IDE. The project resource is selected and expanded in the Project Explorer and Package Explorer tabs. If the resource resides outside the workspace, it is selected and expanded in the Remote Systems Explorer tab, providing this is installed.
open
The command opens a file in an editor within the IDE. The project resource is selected and expanded in the Project Explorer and Package Explorer tabs. If the resource resides outside the workspace, it is selected and expanded in the Remote Systems Explorer tab, providing this is installed.
new-project
The command creates a new project. The project is automatically imported into the workspace and it is visible in the Project Explorer and Package Explorer tabs.
persistence setup
The command creates a persistence.xml
file. This file is selected in the Project Explorer and Package Explorer tabs and it is automatically opened in an editor within the IDE.
entity
The command creates a new entity and associated Java file. This file is selected in the Project Explorer and Package Explorer tabs and it is automatically opened in the Java editor within the IDE.
field
The command creates a new field for an entity. The Java file associated with the entity is selected in the Project Explorer and Package Explorer tabs and it is automatically opened in an editor within the IDE and the field selected. The field is also selected in the Outline tab.
Forge Tools provides access to a readily available list of Forge commands. Additionally, the commands can be easily inserted in to the Forge command line, as detailed below.
To view the list of Forge commands, with a running instance of Forge, press Ctrl+4. To insert one of the commands in to the Forge command line, in the pop-up window expand the command groups and double-click a command.
You may prefer to work with wizards rather than the command line. Forge Tools provides wizards for some of the most used Forge commands, in addition to supporting command line functionality. There are three wizards currently available relating to entities, as detailed below.
This wizard generates entities from an existing database. There are options for creating a new project if one does not already exist and browsing for the driver.jar and driver classes.
This wizard generates REST endpoint for entities.
This wizard generates the necessary scaffolding for you to use JPA entities in your project. There are options for JavaServer Faces and AngularJS implementations, with the wizard creating the associated pages and Java backing beans.
To open a Forge Tools wizard, click JBoss Tools→Forge. Select one of the listed wizards, click and follow the instructions. If Forge is not already started, this automatically occurs.
→ → and expandThe aim of this section is to guide you in customizing Forge Tools:
Customize when and how Forge starts
Manage available Forge runtime servers
Forge Tools provides a number of customization options for starting Forge.
Click Forge. Select the Start Forge when workbench starts check box. Click to close the Preferences window.
→ and selectThe debug mode enables you to view the progress of processes executed on the Forge command line in the Debug tab. Click → and select Forge. Select the Start Forge in Debug Mode check box. Click to close the Preferences window. This mode is most useful if you are developing plug-ins to extend the functionality of Forge.
Click Forge. In the Forge Startup VM Arguments field, type the arguments you want Forge to use when it starts. Click to close the Preferences window.
→ and select
The standard Java VM arguments can be used when starting Forge. Additionally, Forge specific commands include --debug
to start Forge in debug mode and -pluginDir
to specify the directory where Forge should look for plug-ins to install rather than the default .forge/plugins
directory.
Forge Tools is distributed with a Forge runtime server but you may want to use different versions of Forge runtime servers. Forge Tools provides the ability to manage the Forge runtime servers that are available in the IDE, as detailed below.
To manage the available Forge runtime servers, click Forge and select Installed Forge Runtimes.
→ , expand
To add a Forge runtime server, click Name field, type a name to distinguish the Forge runtime server in the IDE. In the Location field, type the location of the runtime server or click to navigate to the location. Click to close the window.
. In theTo change the name or the location of a Forge runtime server, from the Installed Forge Runtimes list select a runtime and click . Modify the Name and Location fields as appropriate. Click to close the window.
To delete a Forge runtime server, from the Installed Forge Runtimes list select the runtime and click .
To set a runtime server as the default, select the check box corresponding to the Forge runtime server. This runtime server will be used when Forge starts.
Click Preferences window.
to close theIt is not possible to edit or delete the Forge runtime server that is distributed with Forge Tools. Additionally, it is not possible to delete a Forge runtime server that is selected as the default. You must first select a different runtime server as the default.