Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 5. Forge Tools basics in CodeReady Studio
CodeReady Studio offers Forge Tools for developing Java EE applications and to extend the IDE functionality in Eclipse.
The following section describes how to:
- Launch the Forge Console.
- Create a new Forge project.
-
Create a
persistence.xmlfile. - Add a new field to the entity.
- Generate a scaffold.
- Manage addons.
- Run Forge-based applications.
Forge Tools are no longer fully supported by Red Hat.
5.1. Launching the Forge Console Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to launch the Forge Console view.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Click
. The Show View window appears.
- Enter Forge Console in the search Field.
- Select Forge Console.
- Click the button.
The Forge Console view appears.
5.2. Creating a new Forge project Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to create a new Forge project in CodeReady Studio.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter Project in the search field.
Select Project: New.
The Project: New window appears.
-
Name your project. Note that the project name cannot include spaces or special characters. The only special characters allowed are periods (
.), underscores (_), and dashes (-). - Click the button to select the project location.
- Click the down-arrow in the Stack field.
- Select Java EE 7.
- Click the button.
Verification steps
Click
. The Show View window appears.
- Select Project Explorer.
Click the button.
The Project Explorer view appears.
Your newly created Forge project is now listed in the Project Explorer view.
5.3. Creating a persistence.xml file Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to create a persistence.xml file for your Forge project in CodeReady Studio using JPA.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter JPA in the search field.
Select JPA: New Entity.
The JPA: Setup window appears.
Not that the Forge Console automatically detects any prerequisites that must be set up and prompts you to create those at runtime.
Click the button.
The JPA: Connection Settings window appears.
Ensure that the automatically generated values are correct.
Click the button.
The JPA: New Entity window appears.
Name your entity.
Note that the entity name cannot include spaces or special characters. The only special character allowed is underscore (
_).- Click the button.
Your newly created Forge entity is now displayed in the CodeReady Studio editor.
Verification steps
Click
. The Show View window appears.
- Select Project Explorer.
Click the button.
The Project Explorer view appears.
- Expand your Forge project.
Your newly created .java Forge entity and the corresponding persistence.xml file are now listed in the Project Explorer.
5.4. Adding a new field to the entity Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to add a new field to the entity for your Forge project in CodeReady Studio.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter Field in the search field.
Select JPA: New Field.
The JPA: New Field window appears.
- Click the down-arrow in the Target Entity field.
- Select the entity for your project.
- Name your new field.
- Click the button.
Your newly created field is now added to the .java file of your Forge project. The .java file is displayed in the CodeReady Studio editor.
5.5. Generating a scaffold Link kopierenLink in die Zwischenablage kopiert!
Scaffolding is an automatic code generation technique. A program generates a basic CRUD (create, read, update, delete) admin interface by using available information (usually a database).
The following section describes how to generate a scaffold for your Forge project in CodeReady Studio.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter Scaffold in the search field.
Select Scaffold: Generate.
The Scaffold: Generate window appears.
- Click the down-arrow in the Scaffold Type field.
- Select Angular JS.
Click the button.
The Setup Facets window appears.
- Ensure that the automatically generated values are correct.
Click the button.
The Select JPA entities window appears.
- Select the JPA entities for scaffolding.
- Click the button.
Your newly generated entries are now displayed in the CodeReady Studio editor.
5.6. Addon management Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to:
- Create a new addon.
- Add a custom Forge command to the addon.
- Installing a custom Forge command.
- Executing a custom Forge command.
5.6.1. Creating addons Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to create addons for your Forge project in CodeReady Studio.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter Project in the search field.
Select Project: New.
The Project: New window appears.
-
Name your addon. Note that the name of the addon cannot include spaces or special characters. The only special characters allowed are periods (
.), underscores (_), and dashes (-). - Click the button to select the project location.
- Click the down-arrow in the Project Type field.
- Select Forge Addon (JAR).
Click the button.
The Furnace Addon Setup window appears.
- Ensure that the automatically selected dependencies are correct.
Click the button.
Note that the process of setting up the dependencies might take some time to complete.
Your newly created addon is now displayed in the CodeReady Studio editor.
Verification steps
Click
. The Show View window appears.
- Select Project Explorer.
Click the button.
The Project Explorer view appears.
- Expand your Forge project.
Your newly created addon is now listed in the Project Explorer.
5.6.2. Adding a custom Forge commands to the addon Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to create a simple Java class and turn it into a Forge command in CodeReady Studio.
Prerequisites
Existing addon.
For more details on how to create an addon, see Section 5.6.1, “Creating addons”.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Press Ctrl+4.
The Current Selection window appears.
- Enter New Class in the search field.
Select Java: New Class.
The Create a new Java Class window appears.
-
Name your new class. Note that the class name cannot include spaces or special characters. The only special character allowed is underscore (
_). - Click the button.
Press Ctrl+4.
The Current Selection window appears.
- Enter UI in the search field.
Select Addon: New Annotated UI Command.
The Addon: New Annotated UI Command window appears.
- Enter the Command name.
- Click the button.
Your custom Forge command is now created.
5.6.3. Installing a custom Forge command Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to install a custom Forge command into Eclipse IDE using CodeReady Studio.
Procedure
- Open the Project Explorer view.
Press Ctrl+4.
The Current Selection window appears.
- Enter Build in the search field.
Select Build and Install an Addon.
The Build and Install an Addon window appears.
- Ensure that the path to your addon is correct.
- Click the button.
Your custom command is now installed into Eclipse IDE.
5.6.4. Executing a custom Forge command Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to execute a custom Forge command in CodeReady Studio.
Procedure
Press Ctrl+4.
The Current Selection window appears.
- Enter the name of your command in the search field.
- Select your command.
5.7. Running Forge-based application Link kopierenLink in die Zwischenablage kopiert!
The following section describes how to run a Forge-based application in CodeReady Studio.
Procedure
- Start CodeReady Studio.
- Open Git Perspective.
Click
. The Show View window appears.
- Select Project Explorer.
Click the button.
The Project Explorer view appears.
Right-click your Forge
. The Run On Server window appears.
Select the server to use.
For example Red Hat JBoss Enterprise Application Platform 7.0.
Click the button.
The Console view appears.
Your Forge-based application opens in the CodeReady Studio browser.