Need to deploy a artifacts from two remote repositories based on environment specific. So I tried by using profiles in distribution management in pom.xml
<profiles>
<profile>
<id>dev-repository</id>
<activation>
<property>
<name>devRepo</name>
<value>true</value>
</property>
</activation>
<properties>
</properties>
<distributionManagement>
<repository>
<id>dev</id>
<url>https://nexus/dev</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
<profile>
<id>qa-repository</id>
<activation>
<property>
<name>!devRepo</name>
</property>
</activation>
<properties>
</properties>
<distributionManagement>
<repository>
<id>qa</id>
<url>https://nexus/qa</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</distributionManagement>
</profile>
</profiles>
Tried Activating the profiles
> mvn clean deploy -PdevRepo
I am getting the following error.
Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter
seems like pom can't recognize the distributionMangement tags.
But It's working fine without profiles for single distributionManagement.
Any one please advise on this ?
Reference
Setting up Maven to allow deployment to different repositories easily