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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

244 views 1 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