Gravitational collapse of homogeneous scalar fields