Skip navigation

JBoss Tools

8 Posts authored by: koen.aers

First of all, since it is the period for this, I want to wish everybody a happy and productive new year!

 

Just before the end of the year, the JBoss Tools team have released version 4.1.1 of JBoss Tools and version 7.1 of JBoss Developer Studio. As described in the release blog post there are a lot of interesting improvements and cool new features available. In this post, I want to focus on something that didn't get a lot of attention yet: the availability of Forge 2. As some of you know, Forge is a rapid application development tool that enables you to quickly create new projects (or use existing ones) and enhance them with support for a wide variety of Java frameworks or tools. You can even add support for your own framework or make tedious work simpler by creating your own extensions for Forge.

 

The support for Forge 1 has been included in JBoss Tools for about 2 years now. It's use has been described in one or two of my earlier posts. The fact that not a lot of people know that Forge 2 support has also been around for more than half a year is because it was in fact still pretty much under construction. But the 4.1.1 release of JBoss Tools includes Forge 2.0.0.Beta3 and it is about time that people start to be aware of its possibilities.

 

Installation

 

The installation of Forge 2 is pretty much like it was before. From a fresh install of the Kepler SR1 release of the Eclipse IDE for Java EE Developers, you select 'Help->Install New Software'. In the subsequent dialog you enter the URL of the JBoss Tools Kepler update site: http://download.jboss.org/jbosstools/updates/stable/kepler/. In the filter text you type 'Forge' and then push 'Select All' to select all the remaining items in the table. The process is illustrated in the screenshot below.

install.png

 

You can see that the Forge 2 support is still listed as experimental. This qualification is supposed to disappear soon as Forge 2 is heading towards a Final release. Also, note that the installation of the Forge Tools is needed to install the Forge Tools Extensions. The rest of the installation process is pretty straightforward: you push the 'Next' button twice, accept the license agreements and push 'Finish'. After the installation is finished you will need to restart Eclipse.

 

Start Forge 2

 

When Eclipse is restarted you are able to also start Forge 2. Currently the preferred way to do this is to use the CTRL + 5 (or CMD + 5 on a Mac) key combination. You can change the combination by bringing up the Eclipse preferences and navigating to 'General->Keys'. In the screenshot below you can see what this looks like on my machine.

preferences.png

 

Using the selected key combination for the first time will automatically start Forge 2. A popup that informs you about this will be shown.

startup.png

 

When the popup disappears a new popup takes its place. This new popup contains all the Forge 2 commands that are available in the context of the currently selected item in your workbench.

commands.png

 

You are now ready to start using Forge 2.

 

Using the Forge

 

Forge 2 has introduced a drastic change with respect to its older sibling. The preferred way to issue Forge 2 commands from within the JBoss Tools platform is now not longer to type them at a command prompt but to bring up a Forge wizard. To bring up the list of available wizards, just like when you were starting up Forge 2, issue the CTRL + 5 key combination. When Forge 2 is already started it will immediately show the popup of the available commands. As an example, let us select the 'New Project' command. The Forge 2 wizard for creating new projects will start.

newproject.png

 

I have chosen the name 'test' and kept all the defaults in the wizard page. If you hit 'Finish' the project will be created at the specified location and imported into your Eclipse workspace.

imported.png

If now, while having e.g. the src/main/java folder selected, you hit CTRL + 5 again, you will see that a vast number of new commands are appearing. Indeed, these commands are as I already mentioned earlier, depending on the currently selected item in your workspace. So within the context of a project you can do all kinds of other things like setting up support for one or more of the Java EE specs. This list can become very long so it's interesting to know that you can narrow it down by typing a search string in the text field at the top of the list.

javaee.png

 

It's out of the scope of this blog post to explain each of these possible choices in detail but stay tuned because these will be explained in detail in more posts to come and of course in our documentation.

 

Future Developments

 

While Forge 2 is supported on the command-line, the integration of it in JBoss Tools was not yet completely finished when 4.1.1 was released so you'll have to stick to the wizards for now. However, if you are really curious and want to test it out already now, you should try the JBoss Tools 4.2.x builds.

In the immediate future you can also expect the release of Forge 2.0.0.Final. We invite you cordially to try out this new version of our beloved tool whether included in JBoss Tools or at the command-line and provide us with all the feedback (good or bad) that you think might help us to make it even better.

 

In the meantime: happy Forging!


Cheers,

Koen

koen.aers

Eclipse Day Florence

Posted by koen.aers May 29, 2013

I have blogged about the Eclipse Day Florence that I attended a couple of weeks ago. If you are curious, you can watch the video of my talk here.

 

Cheers,

Koen

A couple of days ago somebody asked me how to use Forge after having installed the JBoss Tools nighty build. This is a valid question and indeed not so obvious at the moment. We don't want to overload the top level Eclipse menubar and toolbar so it is somewhat hidden until we find a good spot for the shortcuts. Suggestions are of course always welcome.

 

The Long and Winding Road

The normal way to start Forge is to start it by pressing the start toolbar button or choosing the start menu entry of the Forge Console View.

start_button.pngstart_menu.png

Now the question of course is how you can open this Forge Console View. This can be done by selecting the 'Forge->Forge Console' entry in the Eclipse 'Show View' dialog.

Show_View.png

Now the question of course is how you can open this fancy 'Show View' dialog. The long and winding road to do this would be to use the Eclipse menu bar and select 'Window->Show View->Other...'. Luckily there is a quicker alternative to do this last step only using your keyboard:

  • Windows and Linux: press Alt+Shift+Q and then another Q
  • Mac: press Option+Cmd+Q and then another Q

 

The Fast Lane

Even with this last keyboard trick this is a very long process and it would be good if there was a faster way to do it. The good news is that there actually is a shortcut. Earlier, we posted how to bring up a popup containing all the Forge commands applicable in the current context

  • Windows and Linux: Ctrl+4
  • Mac: press Cmd+4

Now if only we extended the functionality of this combination to startup Forge if it is not running? That is exactly what we did. Pressing the above key combination brings up a dialog if Forge is not running yet and asks you if you want to start it.

forge_not_running.pngPressing 'Yes' on this menu will start Forge, open the Forge Console View and bring this last view into focus. If the above combination does not work on your machine (because of a different keyboard layout) or if you would like to hook up this functionality to a different keystroke combo, you can do so by bringing up the Eclipse Preferences dialog:

  • Windows and Linux: choose 'Window->Preferences'
  • Mac: choose 'Eclipse->Preferences...' or press Cmd+, (that is Cmd and the comma).

preferences.png As you can see in the above screenshot, you can change the binding by selecting the 'General->Keys' entry and then look for the 'Forge Command List' command. Go into the 'Binding' field and choose your favourite keyboard combination.

 

The Result

Whether you take the long and winding road or the fast lane, the result should in both cases that you are seeing the Forge welcome banner and a prompt inviting you to enter your command of choice.

console_view.png

 

This is a work in progress. If you have any suggestions to make a better binding, or ideas about a proper perspective or menu that could be a home for this functionality, be my guest!

 

Cheers,

Koen

Whether Forge Tools is male or female can possibly be a source of animated debate but under the motto 'She Comes in Colours Everywhere' we have added support for colours in the Forge console that comes with JBoss Tools. The result looks like the screenshot below.

forge_colors.png

An obvious improvement is to let users customize the used colours through the Eclipse preferences. This is the planned for subject of JBIDE-9746. In the meantime you can already enjoy the wonderful defaults! ;-)

 

Cheers,

Koen

These last weeks, we have been working hard to enable an exciting new feature of the Forge / JBoss Tools integration. The idea was to generate a popup with a list of plugins for which commands can be applied in the Forge console when a 'special shortcut' is pressed, much similar to the quick access feature in Eclipse.

 

To do this we needed to enable hidden communication of metadata from JBoss Tools to the Forge runtime and back. Today I am pleased to show the first results of this in the form of a first screenshot.

forge-ctrl-4-popup.pngAs you can see the popup contains a list of the Forge plugins for which there is a command applicable right after starting up Forge in JBoss Tools. The default way to bring up this popup is currently the key combination 'Cmd+4'.

 

Of course a lot of work still needs to be done for this to become really useful: all the applicable commands need to appear as children of the listed plugins and for these commands the different options need to appear somehow (probably as a new prepopulated popup). Afterwards the complete commands should be pasted into the Forge console view and executed.

 

Feedback and/or ideas are more than welcome!

 

Cheers,

Koen

As I reported earlier I am currently working on the integration of Forge in JBoss Tools. Lincoln's excellent screencast inspired me to write up a tutorial that shows how his work looks in the context of JBoss Tools. For the people that are too busy to read through the entire post and prefer to watch a movie, I have recorded a short version. In true Hollywood style, this is basically a remake of Lincoln's version. We will create, deploy and debug a simple JEE web application on JBoss AS but this time using JBoss Tools.

 

 

Now for the brave among you. Let's see the detailed steps on how to do this yourself...

Setting Up

If you want to try out the different steps in this article the first piece of software you will need to install is JBoss AS. I recommend to download AS 6 Final and extract it into your place of choice.

 

The other item that you need is JBoss Tools. We are going to live on the bleeding edge and use a nightly build of JBoss Tools 3.3 which embeds a snapshot of the Forge runtime. A word of warning is in its place here: as usual when using nightlies and alpha software it is very well possible that things are broken. If this would happen please don't get frustrated and try again some time later. Or even better, report the issue on the JBoss Tools Forum or on the Forge mailing list (forge-users@lists.jboss.org).

 

I assume, dear reader, that you are hardcore enough not to be scared away by these minor inconveniences and are ready to download the Indigo M6 release of the Eclipse IDE for Java EE Developers. Extract the archive into your place of choice and fire up the Eclipse IDE. The screenshot below shows you what the installation folder looks like on my machine.

installation_layout.png

When this is done let's go ahead and install the appropriate elements of JBoss Tools. To do this, we select Help->Install New Software. To avoid clashes between the JBoss Tools and Eclipse Indigo update sites we have to disable the latter. Click on the Available Software Sites link and uncheck the Indigo entry.

available_software_sites.png

After this, we enter the address of the JBoss Tools nightly update site in the Work with: text field. In the resulting list of available software elements we select Maven Support and Web and Java EE Development. This is illustrated in the screenshot below.

install_jboss_tools.png

The rest of this installation is pretty straightforward. We press Next> and wait until all the needed dependencies have been calculated. Then we press Next> again on the Installation Details page, we accept the license agreements on the Review Licenses page and press Finish to launch the process that will download the required packages. We press OK when the security warning appears and Restart Now when prompted.

 

Now we are ready for the next step which will be to configure and start the application server.

 

Configuring the Application Server

In order to debug a webapp in our running server we need to make JBoss Tools aware of the server. The first step to do this is bring up the context menu in the Servers view and select New->Server.

new_server.pngThe New Server wizard opens. On the first page of this wizard we select JBoss Community->JBoss AS 6.0 as the server type and push the Next> button. The only thing we still need to do is specify the folder where we extracted the previously downloaded JBoss AS 6 archive in the Home Directory text field. The situation on my machine is illustrated in the screenshot below.

JBoss_Runtime.png

We leave all the default settings and push the Finish button to close the wizard. The newly configured server shows up in the Servers view. The only thing that we still need to do is launch it by selecting this new server, bringing up the context menu. Since we want to debug our application we will select Debug to launch it in debug mode.

debug_server.png

The Console view opens and shows the console messages generated by the starting application server. After some time our server is up and running and we are ready to roll.

 

First Forge Steps

Until now we haven't seen any sign of our beloved Forge project. Let's change that and open up the Forge console by selecting Window->Show View->Other... and then Forge->Forge Console as illustrated above. The Forge Console view opens. An image of that is shown below.

start_forge.png

As you can see there are two buttons in the top left corner of this view as well as a drop down menu with two entries to start and stop our Forge runtime. Go ahead and select either the green arrow or the 'Start Forge' entry from the menu. After some time the Forge start banner should appear and Forge is prompting for input. Entering the pwd command should indicate the path to your current workspace.

forge_banner.png

It can sometimes be unclear to a beginning user as to what commands you can issue at a particular moment when working with Forge. Luckily there are a number of tools at your disposal that can help at this point. Typing a tab character can help you at any time. When you do this at an empty prompt Forge will give you a list of commands that can be used at that particular scope. Below you see the list that is produced when we type a tab character at this time.

tab_character.png

You can also use the tab character when in the middle of typing a command. When there are multiple choices Forge will list all the possibilities but when there is only one possibility Forge will complete your command. Furthermore, as you can see, there is the list-commands command. This will print the commands applicable in the current scope listed by category. If you use this command with the --all option, it will list all the possible commands disregarding the current scope. The ones that are applicable in the current scope are marked with an asterisk.

list_commands_all.png

Before we start the interesting work, it is worth mentioning one last thing. The Forge runtime that we are currently working with is embedded in JBoss Tools. Currently this is a snapshot build that removes some of the issues that were present in the 1.0.0.Alpha3 release. Of course it is probable that at one time you will want to change the provided runtime. You can do so by opening the Installed Forge Runtimes preferences page. On this page you can add new runtimes and select the one that you want to use.

forge_preferences.png

Now that we have covered the basics, it is time for some real work. Let's create an example project.

 

Creating the Example Project

Surprisingly enough or not, to create a new project, you need to use the new-project command. This command has two important parameters: the name of the project itself and the fully qualified name of the top level package. Using the tab character is really convenient as you will quickly learn when using Forge for a while as it reduces the long command illustrated below to just a few key presses. Of course you will still have to write the respective names.

new_project.png

We accept the default project directory that Forge presents us by pressing enter once again. At this time the Forge runtime starts off creating a project with a typical Maven layout. When this is done JBoss Tools will automatically import this newly created project into the current workspace. The result is shown in the screenshot below.

after_project_import.png

As you can see, this went really very smoothly. But let's make it even more interesting by creating an entity.

 

Adding the Customer Entity

Adding an entity is done using the entity command. At this time, in the current scope, the 'entity' command is not enabled. We first have to setup the persistence. This is done using the persistence setup command. We will need to specify the JPA provider for which we choose Hibernate and the target container which will be JBoss AS 6. The full command to issue is persistence setup --provider HIBERNATE --container JBOSS_AS6.

persistence_setup.pngAs you can see we have the opportunity to accept support for the extended APIs which we will do. When prompted we select version 3.6.4.Final of Hibernate. As shown below, an editor opens and shows the generated persistence.xml file.

entity_command.png

Now the we can create entities. As shown above we issue the following command entity --named Customer. We will be lazy again and accept the proposed default package. This time the java editor opens on the generated Customer.java file.

field_command.png

Next we will create two fields in our Customer class. One for the first name and one for the last name of the customer. The two commands to be issued are field string --named firstName and field string --named lastName. Observe how the newly created fields get selected in the editor and the outline view.

after_adding_fields.png

Now that we have our Customer class, let's develop the user interface. We want to make use of PrettyFaces to provide us with pretty URLs. Fortunately for us, there is a Forge plugin for PrettyFaces that we can use. As a bonus it will enable us to show how to install additional plugins into Forge.

 

Adding the PrettyFaces Plugin

The commands available in Forge are provided by plugins. The Forge runtime embedded in JBoss Tools comes with a number of standard plugins that provide us with the commands that were shown earlier when we tried the list-commands --all command. The prettyfaces setup command which we need to use if we want to enable PrettyFaces in our example project is not one of those standard commands. Luckily the list of Forge commands is extensible. To do so we can install plugins with the forge command. There are a number of different ways to install those plugins such as providing a jar file or a Maven identifier. We are going to install our PrettyFaces plugin using git. As shown below we issue the forge git-plugin git://github.com/ocpsoft/prettyfaces-forge-plugin.git command.

install_prettyfaces.png

Forge will start by checking out the plugin source code into a temporary folder, launch Maven on the checked out code to build the plugin and then install the plugin in the ~/.forge folder. It will then restart Forge so that the new plugin is available.

prettyfaces_installed.png

Now that our prettyfaces plugin is installed, we can start using it.

 

PrettyFaces in the Example Project

We start of where we left earlier and setup PrettyFaces for our example project by issuing the command prettyfaces setup. Forge will ask us if it's OK to change the packaging from 'jar' to 'war', which we accept.

prettyfaces_setup.png

After that we need to choose the technology to use for our application. We choose Java EE 6 and Servlet >= 3.0.

prettyfaces_technology.png

The last thing Forge asks from us is to choose the version of PrettyFaces that we want to use. We choose version 3.2.1. The pretty-config.xml file opens in an xml editor. Also notice how the layout of the project changes. This is because setting up PrettyFaces has changed our packaging from 'jar' to 'war'. The Eclipse Maven integration picks this up and the Forge Tools automatically update the project configuration accordingly.

prettyfaces_installed.png

Now we are sure we will be able to create pretty urls and we are ready to scaffold our Customer application.

 

Scaffolding the Example Application

The first thing to do is setup scaffolding. We issue the scaffold setup command and accept the default for the scaffold type and instruct Forge to install the scaffold provider for our project.

scaffold_setup.png

We install version 1.15 of Metawidget and version 3.0.0.Final of Seam Persistence.

scaffold_versions.png

We accept the index.html file to be overwritten and choose to generate a pretty URL ('/') for the combination of the index.xhtml resource and the /index.jsf URL.

scaffold_index.png

Now we need to scaffold the user interface for the Customer entity. We can do this by issuing the scaffold from-entity command. We again accept the default for the scaffold type and then generate the following URL combinations:

  • /customer/view -> /faces/scaffold/customer/view.xhtml for the view.xhtml resource.
  • /customer/create -> /faces/scaffold/customer/create.xhtml for the create.xhtml resource
  • /customer/list -> /faces/scaffold/customer/list.xhtml for the list.xhtml resource

The process is illustrated below for the first one of these.

scaffold_from_entity.png

After this, we can proceed by building and deploying our application.


Building and Deploying

Building the application is only a matter of entering the build command. This will invoke Maven and build the project.

mark_as_deployable.png

When the build is finished, we navigate to the created example.war artefact in the target folder, bring up the context menu on this file and select Mark as Deployable. After that, we bring up the context menu a second time on this file and select Debug As->Debug on Server.

debug_on_server.png

The Debug on Server wizard pops up. We select our JBoss AS 6 Runtime Server that we configured in the beginning and push the Finish button. The Eclipse console view should appear, showing the activity of the server while it is deploying our application.

When deployment is finished, we are ready to see how debugging works.


Debugging the Application

Let's put a breakpoint setLastName method of our Customer class.

breakpoint.png

Next we open the Eclipse browser window by clicking the globe icon in the toolbar and enter the URL of our application: http://localhost:8080/example/customer/list.

webbrowser.png

As expected there are no customers in our database. Let's change this by pushing the Create new button. On the next screen we enter the first and last names of our first customer and press Create.

kermit_frog.png

We are prompted by Eclipse to change to the Debug perspective and as expected, our application is halted on the breakpoint tht we set a moment ago.

debug.png

Now we can do all the things developers do while debugging applications. I encourage you to remove the breakpoint and push the Resume button (or F8) to continue the application, play around and see how Forge created a basic CRUD user interface for our Customer entity. For me the time has come to finish this long article and come to a conclusion.


Conclusion

In this article I have tried to illustrate how easy it is to get started with Forge to create, deploy and debug a JEE application. Also, I have tried to show you how developers can benefit greatly of the combined power of a command line oriented interface that is integrated in a full featured IDE. As you have seen, the IDE can provide immediate feedback of what happened by issuing the commands at the command line in the Forge Console view.

Finally, I would encourage you to test drive Forge and its JBoss Tools integration and provide us with all you feedback. For that you can use the Forge mailing list (forge-users@lists.jboss.org) as well as the JBoss Tools discussion forum. Bugs and feature requests can be filed against the Forge or the JBoss Tools issue trackers.

 

Happy Forging!

Koen

Next month at EclipseCon I'll be continuing the saga of the Graph Editor. This story actually starts back in 2005, when I was working on the very first graphical editor for jBPM 3. I was using the Eclipse Graphical Editing Framework (GEF) and became very frustrated with the lack of good documentation. So for my own records, I kept notes as to how the application was put together. The result served as the base for a number of talks and tutorials on GEF at the EclipseWorld (2005, 2006 and 2007) and EclipseCon (2006, 2007 and 2008) conferences. Should you be interested, I have attached the last version of this tutorial that I presented at EclipseCon 2008.

In the meantime, two other frameworks have emerged in the Eclipse realm that can be used to create such rich graphical editors. The Graphical Modeling Framework (GMF) has been around for a very long time even and is well matured. It builds on top of GEF and the Eclipse Modeling Framework (EMF). It also has a powerful tools suite that can be used to quickly model and generate your application. Graphiti is a bit more recent and is currently in incubation at Eclipse. Graphiti also builds on top of GEF and uses EMF to store its graphical details. EMF is also the preferred way to serialize the semantic model.

During the previous year, I have been using GMF intensively while forging a prototype BPMN2 editor for jBPM 5. Later that same year I was asked to investigate Graphiti as a candidate technology for a BPMN2 editor. Just like 6 years ago, I have kept notes on the use of both of these technologies. It was only a small step to turn these notes into a presentation comparing both technologies. So I am happy to have been accepted to share this experience at the upcoming EclipseCon conference.

If you expected to see the results of the comparison in this post, I'll have to disappoint you. I will probably write up an article later on but in the meantime I'll leave the scoop to the EclipseCon attendees. The advice is to register for EclipseCon and attend my session on Tuesday March 22nd at 2:30 pm. I hope I will see a lot of you!

 

Cheers,

Koen

Over the past few weeks, I have started the integration of Seam Forge into JBoss Tools. Today I am happy to present the first results of this work.

Installation

If you are familiar with the Eclipse platform the installation should be a breeze for you. The easiest way is to download a recent Eclipse version and use the 'Help->Install New Software...' wizard to install the latest and greatest JBoss Tools from the update site. Don't forget to include the Maven integration for Eclipse as we will need it later on. After this, use the same mechanism to install the forge tools from this update archive. Restart Eclipse and you should be set to go.

Install Forge.png

Starting and Stopping

Now that the installation is dealt with, let's have a look whether everything went ok. You can bring up the "Forge Console View" by selecting 'Window->Show View->Other...' and then 'Seam Forge->Forge Console'.

Forge Console.pngAs you can see the Forge Console View has a toolbar and a dropdown menu that allow you to start and stop Forge. The initial message pane indicates that Forge is not running. Let's get going and push the 'Start Forge' button.

Forge Started.png

After a while, the Forge welcome banner appears and you are invited to enter forge commands. The very convenient tab completion suggesting the list or possible commands does not work yet, but you can get the suggestions anyway by pressing tab followed by a return. Also, the coloring is not yet enabled like when using Forge directly in a terminal window. When you're done working you can stop Forge by pushing the 'Stop Forge' button.

Create a Project

To make things a bit more interesting, let's try the tutorial from Lincoln's blog. We create a new project called 'foo' with top level package 'org.foo':

 

[no project] workspace $ new-project --named foo --topLevelPackage org.foo

Foo Created.pngNow the project is created but unfortunately, we cannot see it in our workspace. This is one of the obvious features that need to be added. For now, we have to import the project in the workspace. Here is where the Maven plugins come into play. For Forge projects are indeed Maven projects too. Select 'File->Import...' and then 'Maven->Existing Maven Project'. Point the wizard at the workspace root and the 'foo' project should show up in the list of projects to import. After importing the project shows up in the package explorer.

Package Explorer Foo.pngWe enter the next few commands from the tutorial:

 

[foo] foo $ install forge.scaffold

[foo] foo $ new-entity --named Person

[foo] Person.java $ new-field string --fieldName firstName

[foo] Person.java $ new-field string --fieldName lastName

[foo] Person.java $ cd ..

[foo] domain $ scaffold generate-metawidget-jsf *.java

 

To see which changes are performed in the project by these commands we need to refresh the project.

Complete Workbench.png

Again, it would be good if after issuing each command the relevant changes would be highlighted by setting the relevant folder, file or file element selected. This is more work for the future.

The Future

As suggested, a lot more work is waiting... Some of the features that are on the list are:

  • Adding a preference page to be able to add and select Forge runtimes.
  • Support for tab completion suggesting the list of possible commands.
  • Support for command history.
  • Support for colors in the Eclipse Forge Console.
  • Show appropriate feedback after each command.
  • etc.

If you are interested in helping out implementing some of these features or if you just want to view the code implementing the current console, you can find the sources in the JBoss Tools SVN.

 

Happy forging!

Koen

Filter Blog

By date:
By tag: