Getting Started with Plugin Development
                                        Matt Ryall
                             Co...
Why have you never developed a plugin?

          ‣ Don’t know how
          ‣ Not a Java programmer
          ‣ Too hard
...
Little-Known Fact #1:
                        Plugins don’t need to be written in Java.




                              ...
Plugins types that don’t use Java

         ‣ Web Items – Add custom links to your application
         ‣ Web Panels – Add...
Use web technologies instead

         ‣ HTML
         ‣ CSS
         ‣ JavaScript (with jQuery)




                     ...
Little-Known Fact #2:
                        Plugins don’t need to be distributed in a JAR file.




                     ...
Upload plugins directly

         ‣ If there’s no other files, just upload the XML descriptor file.
         ‣ This works fo...
XML file template
         <atlassian-plugin key="com.example.plugins.sample"
                 name="My Sample Plugin" plug...
Little-Known Fact #3:
                        You don’t need to know Java to create a JAR file.




                       ...
Use the plugin SDK

         ‣ First, create the plugin skeleton:
               • Run atlas-create-confluence-plugin and ...
Plugin structure with no Java code


                          ‣ POM includes instructions for SDK
                       ...
Great! Let’s see how it works…




                                                         12
Monday, June 14, 2010      ...
Example: Link to your Company Intranet

                                          ‣ Adding a link to Confluence’s global Br...
Step 1: Create a Web Item

         <web-item key="company-intranet" name="Company Intranet"
                   section="s...
Step 2: Drop it in the XML template
         <atlassian-plugin key="com.example.plugins.sample"
                 name="My ...
Last Step: Upload it into Confluence




                                               16
Monday, June 14, 2010           ...
Result: Link to your Company Intranet



                           ‣ Holy smokes, that was easy!




                    ...
Example: Project Status User Macro




                                              18
Monday, June 14, 2010             ...
Step 1: Create your User Macro
         <user-macro key="green" name="green" hasBody="false"
                 bodyType="ra...
Step 2: Drop it in the XML template
         <atlassian-plugin key="com.example.plugins.sample"
                 name="My ...
Last Step: Upload it into Confluence




                                               21
Monday, June 14, 2010           ...
Result: Project Status User Macro




                                             22
Monday, June 14, 2010               ...
More examples




                        Devoxx Conference Twitter Ticker – JavaScript User Macro
                       ...
More examples




                        Atlassian’s Staff Directory – just HTML, CSS and JavaScript
                    ...
Scripting support (alpha stage)

         ‣ Scripting Extender Plugin – Adds support for scripting languages in your plugi...
Thank you.




                                     26
Monday, June 14, 2010                 26
Upcoming SlideShare
Loading in …5
×

5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

2,965 views

Published on

5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin

Matt Ryall, Atlassian

Published in: Technology, Art & Photos
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total views
2,965
On SlideShare
0
From Embeds
0
Number of Embeds
898
Actions
Shares
0
Downloads
27
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

5 Thing You're Not Doing, 4 Things You Should Stop Doing & 3 Things You Should Keep Doing in Your Plugin - Atlassian Summit 2010 - Lightning Talks

  1. 1. Getting Started with Plugin Development Matt Ryall Confluence Technical Lead, Atlassian Atlassian Summit 2010 1 Monday, June 14, 2010 1
  2. 2. Why have you never developed a plugin? ‣ Don’t know how ‣ Not a Java programmer ‣ Too hard ‣ Too much initial set-up ‣ Don’t know the product APIs 2 Monday, June 14, 2010 2
  3. 3. Little-Known Fact #1: Plugins don’t need to be written in Java. 3 Monday, June 14, 2010 3
  4. 4. Plugins types that don’t use Java ‣ Web Items – Add custom links to your application ‣ Web Panels – Add additional content on the page ‣ Web Resources – Restyle or customise the page with CSS and JavaScript ‣ External Gadget Providers or Gadget Plugins – Custom Google gadgets ‣ Confluence User Macros – Create simple Confluence macros 4 Monday, June 14, 2010 4
  5. 5. Use web technologies instead ‣ HTML ‣ CSS ‣ JavaScript (with jQuery) 5 Monday, June 14, 2010 5
  6. 6. Little-Known Fact #2: Plugins don’t need to be distributed in a JAR file. 6 Monday, June 14, 2010 6
  7. 7. Upload plugins directly ‣ If there’s no other files, just upload the XML descriptor file. ‣ This works for: • Web Items • Web Panels • Web Resources (sometimes) • Confluence User Macros ‣ External Gadget Providers can be installed via URL 7 Monday, June 14, 2010 7
  8. 8. XML file template <atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info> ... your stuff goes here ... </atlassian-plugin> http://confluence.atlassian.com/display/CONFDEV/Creating+your+Plugin+Descriptor 8 Monday, June 14, 2010 8
  9. 9. Little-Known Fact #3: You don’t need to know Java to create a JAR file. 9 Monday, June 14, 2010 9
  10. 10. Use the plugin SDK ‣ First, create the plugin skeleton: • Run atlas-create-confluence-plugin and it will prompt for values ‣ Delete the src/main/java and src/test directories ‣ Put CSS, JS files in the src/main/resources directory ‣ Build a JAR with your files • Run atlas-package and it will build a new JAR file in the target/ directory 10 Monday, June 14, 2010 10
  11. 11. Plugin structure with no Java code ‣ POM includes instructions for SDK ‣ Plugin content is under src/main/resources/ ‣ Run atlas-package and the plugin JAR appears in target/ directory 11 Monday, June 14, 2010 11
  12. 12. Great! Let’s see how it works… 12 Monday, June 14, 2010 12
  13. 13. Example: Link to your Company Intranet ‣ Adding a link to Confluence’s global Browse menu • Also works in other places • Also works in other Atlassian applications ‣ Done in only 2½ steps http://confluence.atlassian.com/display/CONFDEV/Web+UI+Module 13 Monday, June 14, 2010 13
  14. 14. Step 1: Create a Web Item <web-item key="company-intranet" name="Company Intranet" section="system.browse/global" weight="40"> <label>My Company Intranet</label> <link>http://intranet.example.com/</link> </web-item> http://confluence.atlassian.com/display/CONFDEV/Web+UI+Module 14 Monday, June 14, 2010 14
  15. 15. Step 2: Drop it in the XML template <atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info> <web-item key="company-intranet" name="Company Intranet" section="system.browse/global" weight="40"> <label>My Company Intranet</label> <link>http://intranet.example.com/</link> </web-item> </atlassian-plugin> 15 Monday, June 14, 2010 15
  16. 16. Last Step: Upload it into Confluence 16 Monday, June 14, 2010 16
  17. 17. Result: Link to your Company Intranet ‣ Holy smokes, that was easy! 17 Monday, June 14, 2010 17
  18. 18. Example: Project Status User Macro 18 Monday, June 14, 2010 18
  19. 19. Step 1: Create your User Macro <user-macro key="green" name="green" hasBody="false" bodyType="raw" outputType="html"> <template><![CDATA[ <span style="background: green; color: white; padding: 4px 12px">GREEN</span> ]]></template> </user-macro> ‣ You might also want to create ones for {red} and {yellow}… http://confluence.atlassian.com/display/CONFDEV/User+Macro+Module 19 Monday, June 14, 2010 19
  20. 20. Step 2: Drop it in the XML template <atlassian-plugin key="com.example.plugins.sample" name="My Sample Plugin" plugins-version="2"> <plugin-info> <version>1.0</version> <vendor>My Company</vendor> </plugin-info> <user-macro key="green" name="green" hasBody="false" bodyType="raw" outputType="html"> <template><![CDATA[ <span style="background: green; color: white; padding: 4px 12px">GREEN</span> ]]></template> </user-macro> </atlassian-plugin> 20 Monday, June 14, 2010 20
  21. 21. Last Step: Upload it into Confluence 21 Monday, June 14, 2010 21
  22. 22. Result: Project Status User Macro 22 Monday, June 14, 2010 22
  23. 23. More examples Devoxx Conference Twitter Ticker – JavaScript User Macro 23 Monday, June 14, 2010 23
  24. 24. More examples Atlassian’s Staff Directory – just HTML, CSS and JavaScript 24 Monday, June 14, 2010 24
  25. 25. Scripting support (alpha stage) ‣ Scripting Extender Plugin – Adds support for scripting languages in your plugin ‣ Groovy Plugins – Lightning talk coming up next… ‣ JavaScript Plugins – At prototype stage, might be bundled soon. ‣ Java 6 Scripting Engine – Can use this with some Java code. ‣ Area of interest for some Atlassian developers – 20% projects and labs work ongoing. 25 Monday, June 14, 2010 25
  26. 26. Thank you. 26 Monday, June 14, 2010 26

×