a) if I do "mvn clean package -P 1x,2x", will maven do "clean-compile-test-package" twice back to back using different dependency each time and produce two different jar files?
b) is it better to have explicit <dependencies/> & <build/> in each profile than tokenized <dependencies/> & <build/> outside <profles/>?
a) No, it will only be one build lifecycle executed where both profiles are
applied. I suspect that the properties from the last profile specified have
b) Using dependencies in profiles is not good practice. The reason is that
you're only looking at the build time but poms are also deployed to the
maven repo where they are used e.g. when others declare a dependency to the
If your want to different artifacts during a build you should have a
multi-module build with two modules (projects) producing one artifact each.