-
In NetBeans, click on `Tools', `Plugins', `Available Plugins', type ``wildfly'' in `Search:' box, and select the plugin by clicking on the checkbox in `Install' column.
The exact plugin version and the date may be different.
-
Click the Install button, then Next >, accept the license agreement by clicking on the checkbox, then click the Install button to install the plugin. Click the Finish button to restart the IDE and complete installation.
-
In NetBeans, click on `Services' tab.
-
Right-click on Servers, choose `Add Server…' in the pop-up menu.
-
Select `WildFly Application Server' in the Add Server Instance wizard, set the name to `WildFly 8' and click Next >.
-
Click on Browse… for `Server Location' and select the directory that got created when WildFly archive was unzipped. Click on Browse… for `Server Configuration' and select the `standalone/configuration/standalone-full.xml' file in the unzipped WildFly archive.
Click on Next and then Finish. The `Services' should show the WildFly instance.
To be able to perform the exercises discussed in this tutorial, you need the Ultimate Edition of IntelliJ IDEA. Keep that in mind when downloading IntelliJ IDEA from http://www.jetbrains.com/idea/download/.
When the appropriate edition of IntelliJ IDEA is installed, you can start preparing the IDE for the exercises:
First of all, you should specify the JDK that you are going to use. In IntelliJ IDEA, this is done in the Project Structure dialog:
-
Start IntelliJ IDEA. If, as a result, a project opens, close the project (File › Close Project).
-
On the Welcome screen, under Quick Start, click Configure.
-
Under Configure, click Project Defaults, and then, under Project Defaults, click Project Structure.
-
In the left-hand pane of the Project Structure dialog, under Platform Settings, select SDKs. Click
and select JDK. -
In the Select Home Directory for JDK dialog, select the folder in which the JDK that you are going to use is installed, and click OK.
-
In the Project Structure dialog, click Apply.
Now, let’s make the JDK that we have specified the default SDK.
-
In the left-hand pane, under Project Settings, select Project. In the right-hand part of the dialog, under Project SDK, select the JDK from the list.
-
Click OK.
Defining an application server in IntelliJ IDEA, normally, is just telling the IDE where the server is installed. The servers are defined in the Settings dialog. (On OSX, this dialog is called Preferences.)
-
On the Welcome screen, to the left of Project Defaults, click Back
. -
Under Configure, click Settings.
-
In the left-hand pane of the Settings (Preferences) dialog, under IDE Settings, select Application Servers. On the Application Servers page, click
and select JBoss Server. (WildFly is a server from the "JBoss family".) -
In the JBoss Server dialog, click
to the right of the JBoss Home field. -
In the JBoss Home Directory dialog, select the folder in which you have the WildFly server installed, and click OK.
-
Click OK in the JBoss Server dialog.
-
In the Settings (Preferences) dialog, click OK.
The sample application is supplied as a Maven project with an associated pom.xml file that contains all the necessary project definitions. The corresponding IntelliJ IDEA project in such a case can be created by simply "opening" the pom.xml file. (Obviously, this isn’t the only way to create projects in IDEA. You can create projects for existing collections of source files, import Eclipse and Flash Builder projects, and Gradle build scripts. Finally, you can create projects from scratch.)
-
On the Welcome screen, to the left of Configure, click Back
. -
Under Quick Start, click Open Project.
-
In the Open Project dialog, select the pom.xml file associated with the sample application, and click OK.
Wait while IntelliJ IDEA is processing pom.xml and creating the project. When this process is complete, the following message is shown:
-
Click Configure in the message box. (If by now the message has disappeared, click
on the Status bar.The Event Log tool window will open. Click Configure in this window.)
-
In the Setup Frameworks dialog, just click OK. (By doing so you confirm that the file persistence.xml found in the project belongs to the JPA framework.)
Now, as an intermediate check, make sure that the project structure looks something similar to this:
Applications in IntelliJ IDEA are run and debugged according to what is called run/debug configurations. Now we are going to create the configuration for running and debugging the sample application in the context of WildFly.
-
In the main menu, select Run › Edit Configurations….
-
In the Run/Debug Configurations dialog, click
, select JBoss Server, and then select Local.As a result, the run/debug configuration for the WildFly server is created and its settings are shown in the right-hand part of the dialog.
-
Change the name of the run/debug configuration to WildFly8 (optional).
-
In the lower part of the dialog, within the line Warning: No artifacts marked for deployment, click Fix and select movieplex7:war exploded. (Artifacts in IntelliJ IDEA are deployment-ready project outputs and also the configurations according to which such outputs are produced. In our case, there are two configurations for the sample application (movieplex7:war and movieplex7:war exploded). Both configurations represent a format suitable for deployment onto a Java EE 7-enabled application server. movieplex7:war corresponds to a Web archive (WAR). movieplex7:war exploded corresponds to the sample application directory structure (a decompressed archive). The second of the formats is more suitable at the development stage because manipulations with it are faster.)
-
Within the line Error: Artifact 'movieplex7: exploded' has invalid extension, click Fix.
-
In the Project Structure dialog, add .war at the end of the output directory path, and click OK. (For the servers of the JBoss family, the application root directory has to have .war at the end.)
-
In the Run/Debug Configurations dialog, switch to the Server tab. In the field for the application starting page URL, replace http://localhost:8080/movieplex7-1/ with http://localhost:8080/movieplex7-1.0-SNAPSHOT/ and click OK.
The Application Servers tool window opens in the lower part of the workspace. Shown in this window are the server run/debug configuration and the associated deployment artifact. Now you are ready to run the application.
In the Application Servers tool window, select the server run/debug configuration (WildFly8 [local]) and click Run
.
IntelliJ IDEA compiles the code, builds the artifact, starts WildFly and deploys the artifact to the server. You can monitor this process in the Run tool window that opens in the lower part of the workspace.
Finally, your default Web browser opens and the starting page of the application is shown.
At this step IntelliJ IDEA is fully prepared for your development work, and you can continue with your exercises.































