Enterprise Java Development@TOPIC@
The most current release of Eclipse IDE as of preparing these instructions is 2019-06. Eclipse IDE seems to have gone from a yearly release cycle to a three month release cycle . When they followed a yearly release cycle -- it was always released in the August/Sepember timeframe and that was the worst time to switch. The best time to upgrade when they followed the yearly cycle was in the Janurary timeframe when issues had been reported and patches had time to be released. I am not sure yet how to time the new three month cycles -- but needless to say "the latest" is not a requirement for this course. If you already have an IDE or a version of Eclipse that you are comfortable with -- there should be no reason to upgrade.
There is no course requirement that you use Eclipse IDE or the latest Eclipse IDE. Many students have completed this course using IntelliJ.
Download Eclipse IDE for JavaEE Developers Eclipse IDE for Enterprise Developers or latest from Eclipse Packages or Eclipse Downloads
Install Eclipse IDE for JavaEE Developers and Start
For the Mac installation, a .dmg was provided. Install Eclipse to the Applications folder, pin it to the taskbar so that it is easy to locate, and start Eclipse.
For the Linux installation, a tar.gz archive was provided. Exctract this to a location on your computer, and start Eclipse.
For the Windows installation, a .zip archive was provided. Extract this to a
location on your computer, pin the eclipse
executable
to the taskbar so that it is easy to locate, and start Eclipse.
Eclipse will default to the JRE when launching most tools/applications. Sometimes this can be an issue and requires a JDK. Add the JDK and make it your default JRE. Make sure it is JDK 11.
Window->Preferences->Java->Installed JREs
press Add..->Standard VM and reference the JDK instance you installed earlier
Make the new JDK VM your default
It is a good idea to use assertions (assert foo!=null : "hey!";
)
in your code and enable assertions within your development environment
(by adding -ea
to the "Default VM Arguments" setting within
the JRE Definition).
m2e is a plugin installed into Eclipse that configures Eclipse based on the Maven pom.xml configuration. When adjusting your builds, you should always define changes within the Maven pom.xml and rely on m2e to translate that into Eclipse. Any changes added directly to Eclipse will not be seen by the command-line build.
m2e was pre-installed in the download. Nothing more needs to be done to install it. The rest of these instructions are concerned with using it and demonstrating it.
Add the Java Package Explorer to the JavaEE Perspective. I find this easier to work with than the Project Explorer used by default in the JavaEE perspective.
Select Window->Open Perspective->Other->Java
Select Top Level Elements->Working Sets from the down-facing triangle in the top-right corner of the Package Explorer.
Create a New Java Working Set and call it "javase"
Press OK
Import the class examples into Eclipse as a Maven Project
Right click on "javase" in the Package Explorer and select Import...->Maven->Existing Maven Projects
Browse to the project area where you performed
the Git checkout earlier and select the javase
folder.
Select Next to have the current project(s) added to the selected working set.
There will be an extra panel that appears the first time you import a project with a new maven plugin. Allow Eclipse to setup any that it knows about, discover ones that may be new, or resolve later for those that it cannot find. There will be unsigned content warnings for most of the plugins. Eclipse will want to restart after installing any new plugins.
Build and test the javase5Enhancements
application using
Run As->Maven Install by right clicking on any of the
project folders.
If you receive the following error
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
add the following '-vm' option to your eclipse.ini file -- pointing to your javaw executable in the JDK directory, restart Eclipse, and retry.
-vm C:\apps\Java\jdk1.8.0_181/bin/javaw.exe
--launcher.defaultAction openFile -vm C:\apps\Java\jdk1.8.0_181/bin/javaw.exe -vmargs ...
Try also Run As->JUnit Test.
You can use the command line Git to functionally clone the remote repository and update your local copy. However, having Git integrated into Eclipse allows the plugin to make Eclipse transition easier between one checked out branch to another or correctly react to an updated branch.
Git is pre-installed in the download. Nothing more needs to be done to install it (yay!).
JBoss maintains a set of Eclipse plugins to help with development and use of their products. There are too many to describe -- let alone understand in total. However, we can make use of a few. The primary one is to optionally run/manage Wildfly within Eclipse versus the command line. Follow these steps if you want to enable a few additional productivity JBoss Tools plugins.
Open the Eclipse Marketplace panel using
Help->Eclipse Marketplace
Type Wildfly
into the seach field and press Go
Click Install for the JBoss Tools
Complete the installation steps for JBoss Tools. There are many tools in the repository. Very few of them are needed for class or not obvious how to use them without more investigation. Choose the following suggested minimal set.
Context and Dependency Injection Tools
Hibernate Tools
JBoss AS, Wildfly, & EAP Tools
JBoss JAX-RS Tools
You will receive a warning about the content within the plugin being unsigned.
You will receive a warning after restarting Eclipse about the reporting anonymous use to JBoss. They use those callbacks to determine where and when their tools are being used (for bragging rights?). I disable that.
Define a Server Instance for JBoss
Open the JavaEE Perspective
Select "new server wizard..." in the Servers panel
Select Wildfly 17 under the JBoss Community folder
Select defaults for location, controlled by, and create new runtime.
Set HOME to your wildfly installation directory using the Browse button on the next panel.
Set the JRE to JavaSE-11
Leave the server base directory as "standalone" and configuration to "standalone.xml".
Review options. Note that I generally start my server externally so that standard output does not compete with my other actions within Eclipse. However, there are pros and cons to both methods and I will start you with internally launched here.
Start the server by right clicking on it and selecting Start. You should see some server log activity in the Eclipse console. This will conflict with but play nice with the externally-managed mode. We will look at this closer once we get to server-side development.