Similar a 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
Similar a 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 (20)
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
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. Getting Started with Plugin Development
Matt Ryall
Confluence Technical Lead, Atlassian
Atlassian Summit 2010
1
Monday, June 14, 2010 1
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. Little-Known Fact #1:
Plugins don’t need to be written in Java.
3
Monday, June 14, 2010 3
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. Use web technologies instead
‣ HTML
‣ CSS
‣ JavaScript (with jQuery)
5
Monday, June 14, 2010 5
6. Little-Known Fact #2:
Plugins don’t need to be distributed in a JAR file.
6
Monday, June 14, 2010 6
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. 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. Little-Known Fact #3:
You don’t need to know Java to create a JAR file.
9
Monday, June 14, 2010 9
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. 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
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. 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. 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
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. 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
23. More examples
Devoxx Conference Twitter Ticker – JavaScript User Macro
23
Monday, June 14, 2010 23
24. More examples
Atlassian’s Staff Directory – just HTML, CSS and JavaScript
24
Monday, June 14, 2010 24
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