LPS-46537: Fix Build. Only copy the sonatype properties and the ivy properties if these properties are defined.

This could fix the issue with ivy.pom.property, but we think that this property could only be used on publish target