Monday, August 27, 2012

Changing the Context Root of Web Applications

This article was originally posted in the SAP Community Network. I post it here with few changes that generalize it for all Eclipse WTP users.

Soon after the first steps in developing web applications with Eclipse WTP, developers often realize that the default context root of their applications is not exactly what they want. By default, the context root goes after the project name - if the name of your project is "HelloWorld" then it will be deployed with context root "/HelloWorld".

Changing the context root is a piece of cake. In this post we will see how you can do this in Eclipse WTP.

Setting the context root when creating a new web project

As described in the Web Tools Platform User Guide, when creating a new web application, you typically use the "New Dynamic Web Project" wizard. Instead of finishing it on the first wizard page, you should click on the Next button to advance to the "Web Module" wizard page. There you can set the context root of the application by modifying the value in the "Context root" text field. If you wish to deploy the application in the server's root then simply give "/" as context root.


Changing the context root of an existing web project

To change the context root of a web application that is already available in the Eclipse workspace, simply right-click on the web project and call the "Properties" action from the context menu. Then navigate to the "Web Project Settings" property page and you will find the text field where you can change the context root.


Depending on the server adapter you use, if your application is already deployed and started then you may need to redeploy it or restart it for the change to take effect. 

Wednesday, August 15, 2012

STS 3.0 and SAP NetWeaver Cloud

This article was originally posted in the SAP Community Network. 

One of the interesting news this week is the release of the Spring Tool Suite 3.0.0. In addition to the new features, the highlight is that the complete project is now available as open source software on GitHub under the Eclipse Public License. This is really great news for the Eclipse community! More details about this move can be found on the SpringSource Blog.

After reading this news, I was thrilled to try developing a Spring application with STS 3.0 and deploying it on my trial account in SAP NetWeaver Cloud. I went to the STS download site, grabbed a package and installed it. Then I followed the usual steps for installing the Eclipse Tools for SAP NetWeaver Cloud on top of STS. Since STS 3.0 is based on Eclipse 4.2, the Eclipse Tools for SAP NetWeaver Cloud must be installed from the Juno update site: https://tools.netweaver.ondemand.com/juno.


STS comes with a nice dashboard that brings you up to speed with the Spring technology. Luckily there is a nice example project "spring-mvc-showcase" that demonstrates the capabilities of the Spring MVC web framework through small, simple examples. Just a single click and the project was fetched from GitHub and installed in my Eclipse workspace.


The Maven Integration for Eclipse resolved all required libraries and the project was ready to deploy. I quickly got a functional Spring application, so I will skip any real Spring development for now.

Deploying it on the SAP NetWeaver Cloud required a few more clicks. I just called the "Run on Server" action from the project's context menu and deployed it successfully on the Local Test Server and on my trial account in SAP NetWeaver Cloud.


Trying out Spring with SAP NetWeaver Cloud was a really easy win for me!

Friday, July 6, 2012

Eclipse UI Tips now come on time


The first version of the Eclipse UI Tips for Android reached the astonishing adoption of 18 installations. 13 of which are still active. I am happy that there are people who find this app interesting and useful. Special thanks go to Lothar who submitted the only review in Google Play. I really appreciate it! And I really do care for the feedback that reaches me. 

A few days ago I published an update of the application. As requested, the time for the tip of the day is now configurable. It is not fixed to 8:30 am anymore and you can set it to whatever time you like.

Another improvement is that the welcome screen now includes a link to the User Interface Guidelines wiki page. This is a short term response to the request that it should be possible to browse all of the guidelines without waiting for the tip of the day to come. I will work on a more integrated solution later.

The new version includes also some minor improvements in the layout and a couple of bug fixes.

That's for now, folks! If you want to share any feedback, you are warmly welcome to write a review in Google Play or submit an issue in github.

Monday, June 25, 2012

Eclipse UI Tips for Android

As an Eclipse plug-in developer I am always looking for guidelines how to design my UI for the best user experience. Although not updated for quite a long time, the User Interface Guidelines wiki page is the best source of information I am familiar with. It's quite a lot of reading (big thanks to the contributors), but the time spent on reading really worth.

Recently, I counted that there are exactly 144 guidelines described. Quite a lot, isn't it? Of course, there is a short list of the most important 18 guidelines, but this doesn't mean that I should neglect the other 126. Therefore, I was looking for an easy way to remember them all.

It's quite modern now-a-days to use a smartphone for making one's life easier. I created a simple Android app that fires a status bar notification every morning with a randomly selected Eclipse UI guideline. This would remind me one of these guidelines every day. Since they are 144 total, this should keep me busy for nearly half a year and then for sure I would need to do another round :)

I published the application to Google Play, so you can try it yourself if you find this idea useful. The code is available as open source under EPL on github.

Android app on Google Play

Please, note that I have designed the application to fit my own needs. It's very likely that you have a different style of learning. I am open for feedback, request for improvements and patches. You are welcome to fork the project and submit your requests in the issue tracking system of github.

Monday, June 4, 2012

Eclipse Demo Camp in Sofia on June 18th


Photo by sergi_nog

I am pleased to announce that just in a couple of weeks the 5th Eclipse Demo Camp in Sofia will take place. This time I am not in the organization, but there is a gang of extremely enthusiastic fellows who wish to continue the tradition.

The special guest this time is Ralph Mueller - Director in Eclipse Foundation who is focused on growing the Eclipse community in Europe. We are also expecting some other guests from abroad.

Of course, the most important content of an Eclipse Demo Camp are the demos prepared by you - the Eclipse geeks. So, if you have something interesting to show, please sign up in the wiki page.

If you plan to attend then please follow the instructions how to register, so you can make the organization of the event easier.

Let's make this Demo Camp the best one!


Sunday, October 23, 2011

Bundle Dependency Graph moved from Virgo to Libra

Those of you who are familiar with the Virgo Tooling know about the rich tools in the Virgo server editor. It consists of editor parts like:
  • The Bundle Repository that allow easy installation of bundles from the SpringSource EBR into the OSGi framework.
  • The Bundle Overview that lists all bundles installed in the OSGi framework with their states, attributes, imported and exported packages and services, etc.
  • The Bundle Dependency Graph that visualizes the dependencies between the bundles as a graph.
  • The Server Console that allows executing shell commands in the OSGi framework (somewhat duplicating the standard Eclipse Console). 

The good news today is that three of these editor parts - Bundle Overview, Bundle Dependency Graph and Server Console - are now released from their Virgo dependencies and moved to the Libra project, which allows using these tools with any OSGi framework as well as integrating them in adopter's server adapters for OSGi-based application servers.

This move has been done in the timeframe of Juno M3 that will be officially released on November 11, 2011. From this date on, this new Libra feature will be able to be installed from the Juno Discovery Site. Until then, those who are eager to try it out now, can do this from the Libra Nightly repository.


The new feature is called "OSGi Framework Editor". However, if you want to try it with the Libra server adapters for the open-source OSGi frameworks (like Equinox, Felix, etc.) you will need to install also the "OSGi Framework Launchers" feature. Watch these great video tutorials for an introduction to these server adapters.

The Bundle Overview and the Bundle Dependency Graph editor parts retrieve the bundle information from the OSGi framework via JMX. Therefore, make sure you configure JMX correctly by following the user guide.

In case you like these tools and you want to integrate them in your own server adapter, then take a look at the comprehensive adopter guide that explains how to do this.

So, that's all folks for Juno M3. I plan making some enhancements for the next Juno milestones. My hope is that these editor parts become a useful tool for analyzing the state and the dependencies of  OSGi bundles.






Friday, September 9, 2011

Sharing Target Platforms and Launch Configurations in Version Control

Last week I had the pleasure to participate in the Masterclass on OSGi led by Neil Bartlett and Peter Kriens. The event was really fruitful and inspiring, and among other things I had to opportunity to work with Bndtools. For a long-year user of Eclipse PDE like me, it was quite interesting to look at the OSGi bundle development from such a different perspective.


One of the differentiators of Bndtools is that all resources of the OSGi development environment (like bundle repository, build and run configurations) are stored in projects in the Eclipse workspace and can be easily shared to a version control system using the Eclipse Team Provider. And indeed, this is a very useful feature - sharing such non-functional resources with your team members would enable them to quickly have the same working environment by just a quick checkout from the version control system.

But... Does Eclipse PDE really miss this same feature?

Not exactly! PDE has the "target platform" that is the equivalent of the bundle repository and the build-time configuration in Bndtools, and the "launch configuration" that is the equivalent for the run configuration in Bndtools. It's true that both target platforms and launch configurations are stored deep in the Eclipse workspace's metadata, which cannot be shared using the Eclipse Team Provider. But this is just the default behavior. Both artifacts can be exported to files in existing projects in the workspace so they can be shared.

Target Platforms

Let's first take a look at the target platforms. Users have two options: 1) create a new target platform from scratch as a file, or 2) export an existing target platform to a file.

New target platforms can be created using the New Target Definition wizard. It can be found by following New > Other... > Plug-in Development > Target Definition from the main menu. You need to choose "Nothing" for "Initialize the target definition with". The result is an "empty" .target file in an existing project in the workspace.


Exporting an existing target platform to a file can be done in a similar way. In the New Target Definition wizard choose the "Current Target" radio button instead of "Nothing". This way the wizard will export the active target platform. If you want to export a target platform that is not the active one at the moment, you need to first activate it (from Window > Preferences > Plug-in Development > Target Platform preference page).

Edit (Thank Curtis for this hint): Another (even easier) way to export an existing target platform is by going to the Target Platform preference page (Window > Preferences > Plug-in Development > Target Platform) and using the Share... button. This will launch a wizard that will export the selected target platform as a .target file in the specified project. The wizard itself will not share the target platform in a version control system, but after having it in the project you can use the Eclipse Team Provider for doing this.

The result .target file can be open and edited with the (default) Target Editor. It is important to mention that there may be many target definitions in the workspace, but only one can be activated as a target platform at the same time. This is a known issue (bug 159072) in PDE. It's not a problem for simple OSGi development scenarios, but could be really annoying for more complex ones. I have to admit that Bndtools has a better design here - every Bnd project can have its own target platform equivalent.

Launch Configurations

Here the only option is to export an existing launch configuration. This can be done by calling the File > Export... > Run/Debug > Launch Configurations wizard from the main menu. The selected launch configuration will be exported as a .launch file at the given location on the file system. You need to browse the location of the respective project in the workspace. Don't forget to Refresh the project to see the exported file.


The .launch files can be executed by using the Run As actions in the context menu. They can be edited by calling Run As > Run Configurations... action. Actually, every .launch file in the workspace is recognized as a launch configuration.

Like target platforms, you can have many launch configurations in the workspace. And, luckily, you can launch as many as you like at the same time. Launch configurations can be configured to launch only a subset of the target platform - the bundles that you really want to run, plus additional bundles from the workspace. So, it's worth having several launch configurations if complex projects must be run in different contexts.

Additional Hints

It's very important to remember that when sharing resources with a team provider you should avoid using absolute file paths. Otherwise, your team mates could see broken paths if they don't maintain the same directory structure like yours. Such file paths could be the working directory of a launch configuration or a directory of bundles included in a target platform.

The Eclipse Platform has an excellent solution called Path Variables. The one that I like the most is the ${workspace_loc} variable that always points to the root location of the current Eclipse workspace. I highly recommend using it when constructing file paths that will be shared with a team provider.

Many dialogs in Eclipse provide the special Workspace... button that makes construction of paths relative to the workspace root very easy.


Conclusion

We've seen that sharing project metadata like target platforms and launch configurations, although not so obvious at first sight, is easily possible in Eclipse PDE. Compared to Bndtools, PDE even provides some more flexibility, but at the same time has also some deficiencies.
Languagesen>bg GoogleCE
за