How to I make an IF inside atlassian-plugin.xml that change behaviour based on the server domain name?

I am looking for something like:

# if jira.baseurl == "http://xxx"

CCC
#else

xzzx

#end

But my velocity syntax si very limited at this moment.

2 answers

1 accepted

Well, if thats the question, the asnwer is that you can't embed velocity in your atlassian-plugin.xml, you can however have a webwork action, who's success/other response is redirected to a velocity template for rendering. For velocity syntax information, see : http://velocity.apache.org/engine/devel/user-guide.html

0 vote

Um, your question doesn't quite make sense.

The title says you're trying to do something in atlassian-plugin.xml, but then you talk about some velocity code. Rather than try to unscramble this muddle, I'll try to break it into pieces

  • atlassian-plugin.xml is for settings in your plugins. It's an xml file, not velocity
  • The velocity is broadly the right idea, but
    • The "if" clause needs to be in ()
    • there's no spaces in directives (#if, not # if)
    • I think the jira.baseurl is correct, but don't rely on me
    • It does however, need to be a variable - $jira.baseurl
  • Your velocity needs to go into a velocity template file, somewhere within your plugin

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

106 views 0 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you