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 votes

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 Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,864 views 12 18
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot