Issue
I use the Maven task in Azure DevOps Pipelines. I need to activate a concrete profile, but I don't understand how to do it. I try to pass a profile in 'options' and in 'goals' but it doesn't work. How can I activate a profile correctly?
- task: Maven@3
displayName: maven_project_profile
inputs:
mavenPomFile: 'my_project/pom.xml'
options: '-DskipTests=true -P someprofile'
goals: 'clean deploy -p someprofile'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
testRunTitle: 'fixBypassService'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.8'
mavenVersionOption: 'Default'
mavenAuthenticateFeed: false
effectivePomSkip: false
sonarQubeRunAnalysis: false
I can see in logs:
2020-01-13T08:45:13.1695224Z [command]/usr/share/apache-maven-3.6.2/bin/mvn -f /home/vsts/work/1/s/my_project/pom.xml -DskipTests=true -P someprofile clean deploy -P someprofile
But the profile 'someprofile' isn't activated in reality.
Solution
I was wrong. A profile is activated correctly if you pass it e.g. in goals:
- task: Maven@3
displayName: maven_project_profile
inputs:
mavenPomFile: 'my_project/pom.xml'
goals: 'clean deploy -P someprofile'
I couldn't see a result of activating because there were issues of accessing some resources inside an agent but this is no matter for the current post. Everything works correctly.
EDIT: the flag is capital P
Answered By - typik89