> Doesn't tycho try to read
the feature.xml file to determinate what dependencies is needed?
No, Maven will build all modules that are declared in the scope, independently of dependency resolution.
can we optimize the build process with tycho that we only build the
dependencies what is listed in the .product file and the required plugin
listed in feature.xml of each feature folder?
You can't dynamically resolve the dependencies of a given module inside Maven. You'd need an external script to do the resolution, and then you could invoke Maven using the -pl option to only build some folders.
That's difficult, not so portable, not elegant, not sustainable.
The most straightforward approach is to use a Maven profile for the product and statically list the "product" modules inside this profile. So when profile is not enabled, those modules wouldn't build.
The most elegant approach, not only from build perspective but also in term of better separating your 2 deliveries and better model their depedencies is to have 2 builds, 2 Git repos and so on. One would be for the feature and the common parts with your product, and would publish a p2 repository; the other one would be your product and its specific modules and would reference/consume the p2 repo of the feature+common part.