Refactor the subproject publish pom logic.