Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,560,497
Community Members
 
Community Events
185
Community Groups

Maven task does not support profile in Goal

Hi,

I have a bamoo build plan in which I added a maven task. In Goal I wrote 

package -P prod-profile

But the artifact generated (jar file) is created with the default profile configurations, as it seems that the -P above is ignored.

 

Is there anything wrong in my entry?

 

I appreciate your support and look forward to hear from you.

Thanks a lot and best regards

Regards

Rasha Elsayed

1 answer

1 accepted

0 votes
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 12, 2023

Hello @Rasha Elsayed

Welcome to Atlassian Community!

Check the pom.xml file for any activeByDefault set to false. Maven will only consider it if it is active.

Running mvn help:active-profiles will show the active profiles.

You also need to understand that the profile configuration needs to be carried on by the Project's pom.xml file. Or, you will have to replicate the profile configuration in one of the Agent's own locations (outside of the build scope):

  • %USER_HOME%/.m2/settings.xml
  • ${maven.home}/conf/settings.xml

Best regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Hello Eduardo,

thanks a lot for your reply. Actually I have 2 profiles:

  • dev-profile having activeByDefault = and
  • prod-profile does not set this property.

Running mvn package -P prod-profile from the command line on my local machine works correctly. The jar artifact is generated with the prod-profile configurations.

However in bamboo mvn task, when I enter package -P prod-profile in the Goal field, the jar file gets generated with the dev-profile configurations.

 

In addition, from command line

  • running mvn help:active-profiles shows only dev-profile
  • running  mvn help:active-profiles -P prod-profile shows prod-profile

So, it seems that the Maven task in bamboo ignores the -P setting in the goal, right?

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 12, 2023 • edited

Hello @Rasha Elsayed

You should set activeByDefault on prod-profile in pom.xml so mvn would consider it. That's validated when you run the help:active-profiles command.

Your local machine or the Agent may have other Maven settings that may be considering/not considering that profile.

Thank you,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Hi @Eduardo Alvarenga 

Thanks for your Response. I think i will replace the maven task with a script task in which i can run maven simply as 

mvn package -P prod-profile

 

Regards

Rasha

Like Eduardo Alvarenga likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events