Sunday, 5 April 2009

Maven Eclipse Tomcat "There are no projects that can be added or removed from the server"

I started to give up my MyEclipse IDE and turn to use a simple Eclipse instead. The main reason is because I found Eclipse actually do what I want it to do, like hot deploy to tomcat. Frankly it's not as good as MyEclipse, but it does the job.

I hit the wall as soon as I start to use it. When I tried to get rid of all eclipse project files (e.g. .project and .classpath) by using mvn eclipse:clean command, I regreted 2 minutes afterward. It was because once the command mvn eclipse:eclipse finished, I switched back to Eclipse, imported the project once again and then added the project to Tomcat, Eclipse prompt me a message "There are no projects that can be added or removed from the server". No matter what I tried to do, like adding "EAR Libraries", "Web App Libraries" and even "Tomcat Server Runtime Library", it does not help a bit. And I could not find a single hint from the net to solve it.

After struggling a whole day, I looked at the eclipse maven plugin. I found the solution.

Since Eclipse is using WTP for web project, and Eclipse needs the WTP configuration in order to recognise it is a web project. If you create a dynamic web project from Eclipse, it works nicely. However, it does not work when you start your project using maven. In order to enable WTP using maven, first we have to add maven-eclipse-plugin and make sure the version of maven-eclipse-plugin is specified (2.6 is the latest version at the moment). Then we have to put a configuration property <wtpversion> and set it to either 1.0, 1.5 or 2.0. Other setting like none or R7 does not work. So here is my setting:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.6</version>
<configuration>
<buildOutputDirectory>src/main/webapp/WEB-INF/classes</buildOutputDirectory>
<downloadJavadocs>true</downloadJavadocs>
<downloadSources>true</downloadSources>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>

There are other settings like <wtpmanifest>, <wtpapplicationxml>, <manifest>. But they are not necessary in order to deploy to Tomcat. This trick also apply on other server like glassfish.

After I put the setting in, it works nice and sweet!

The environment:
Eclipse 3.4
Maven 2.0.8
maven-eclipse-plugin 2.6
Tomcat 5.5, 6.0
Glassfish v3-prelude
MacOSX 10.5

For more information: http://maven.apache.org/plugins/maven-eclipse-plugin/index.html

Friday, 3 April 2009

The Toyota Way / Lean presentation

Few days ago I had an opportunity to attend a presentation which hosts by ThoughtWorks in Australia. The presentation was about an introduction of the Toyota way or Lean in both manufacturing and I.T industries. This is the first time I attend an official presentation that talk about Lean.The presentation gave an very good introductory of Lean. The presentation last around an hour. I would like to share some of the important points that I had learnt from the presentation.

First, the presenter mentioned 2 basic concepts in Lean.
- Just in Time (JIT), and
- Stop the Line

In short, Just in Time (JIT) is about providing resource whenever the resource is needed. The presenter gave an example in the supermarket. When an item was taking by a customer, a staff will provide a new item back. So it reduces waste by avoiding over stock problem. To apply in I.T. development area, I personally think it means we only implements what the business need, we should never develop something out of scope. We should minimise the "predict future" thinking. So when business need a new feature, we implement exactly what it should do with appropriate code refactoring. Do not over architect what the business need.

For Stop the Line concept, it means if a problem occur, we should stop the process and fix the issue before continuing. If there is a problem, although it may be a tiny problem, we should not cover it up and leave it until later, the problem might grow to a big issue. For example, if you feel dizzy, start a little bit coughing, you should better go to see a doctor rather than wait for a couple of days and "hope" that those symptoms goes away. Otherwise, you will suffer more than just taking a few pills. It seems like it is a very basic concept. Everyone should know, but I guess only a few people can actually "act". To apply it to I.T., we should watch out the problem carefully, we should keep continuing on code refactoring whenever necessary. We should not be afraid of doing it. If we do not face to the problem, we might get a larger problem at the end.

After those 2 basic concepts, the presenters spent some other time talking about Waste concept. There are 8 elements of Waste in manufacturing industries, they are:
- waiting (e.g. waiting for next process)
- over production (e.g. produce more than demand)
- transport or conveyance (e.g. unnecessary stock reallocation)
- over processing (e.g. poor tool)
- rework (e.g. without clearly process and work)
- stock (e.g. keep too much stock)
- motion (e.g. unnecessary staff movement in the working environment)
- resource

Waste elements in I.T. industries:
- extra feature (over production)
- delay (waiting)
- hand-offs (loss of information)
- re-learning
- partially done work (not JIT)
- task switching (reduce throughput)
- defects (unecessary rework)
- unused employee creativity

Finally, the presenters brought an interesting topic. The presenter said there are lots of people are doing multitasking, multi-project at a time because usually, for instance, when project A needed a confirmation from senior management, the workforce will be idle. To reduce the workforce idle time, people will be assigned to other projects.

To illustrate it, assume there are 4 projects: A, B, C and D. Every project needs 4 iterations to be finished. So, the time frame for those people who handle multi-projects are:

ABBD ABCD ACCD ABCD

So all the projects will be finished at the last iteration, at the same time. However, if the projects are well organised, 3 of the projects (A, B and C) are actually delivered earlier as in the following illustration:

AAAA BBBB CCCC DDDD

So what the presenter was trying to say is that moving people around in order to reduce the idle time is a wrong idea. To make the projects success, projects should be clearly identified before it starts.

However, I don't agree with the presenter on the above since the case is too ideal. And it is not agile. I don't think people could find such ideal situation in the reality. I would say we can only minimise people switching between projects as much as possible. If delay happens unfortunately, both project's iteration should be maintained together, swap enough people to the other project, maintain team structure and rotate people in between projects within a couple of iteration so that people will not feel too much distraction from different projects.