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

Sorin Sbarnea (Citrix)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 19, 2012

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

0 votes
Answer accepted
Andy Brook [Plugin People]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 22, 2012

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 20, 2012

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