atlascamp 2014: a p2 plugin and a saas platform walk into a bar
DESCRIPTION
In order to build Atlassian Connect, we had to work around all the legacy code and architecture that made it impossible to scale P2 plugins in our hosted OnDemand platform in the first place. Learn how the Connect team jumped through flaming hoops, juggled sharp objects, and used non-existent technology not only to build Atlassian Connect, but new also tools and techniques useful to any plugin developer.TRANSCRIPT
June 3-5, 2014 | Berlin, Germany
A P2 Plugin and a SaaS Platform Walk
Into a Bar…Jonathan Doklovic, Principal Developer, Atlassian
Stuff That Came out of Developing Atlassian Connect That Can Help
Make Writing P2 Plugins and Even Plain Old Java Projects Easier And
More Efficient
Jonathan Doklovic, Principal Developer, Atlassian
Nomenclature
P2
P2Connect Addons
P2
P2
P2
Building Made Easy
Git Flow
Git Flow vs.
GIT Flow + MavenK I S S Y O U R S A N I T Y G O O D B Y E
I want to merge A LOT
without conflicts!
Screw conflicts, I
want to change poms !
A LOT!
I want SNAPSHOTS!
I want to add files to your
working folder
I want to assume you only have one
master branch and commit to source control
myself!
Maven JGIT Flow Plugin
• No need to install git-flow!
• No maven-release-plugin!
• Smartly manages version changes between branches!
• Full GIT Flow lifecycle / merge strategy!
• Extra “goodies” for dealing with CI
K I S S T H E M A V E N R E L E A S E P L U G I N G O O D B Y E
bitbucket.org/atlassian/jgit-flow
Transformers Are Evil
<atlassian-plugin key="${project.groupId}.${project.artifactId}" name="${project.name}" plugins-version="2"> <plugin-info> <description>${project.description}</description> <version>${project.version}</version> <vendor name="${project.organization.name}" url="${project.organization.url}" /> ! <bundle-instructions> <Export-Package> com.atlassian.upm.api.util*;version="${upm.version}" </Export-Package> </bundle-instructions> </plugin-info> ! <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" /> ! <component key="someComponent" class="com.atlassian.example.SomeComponentClass" /> !</atlassian-plugin>
atlassian-plugin.xml
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.example"/> </beans>
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="org.example"/> </beans>
@Component @Autowired
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<atlassian-scanner:scan-indexes/> </beans>
@Named@Inject@JiraComponent@ConfluenceComponent@ClasspathComponent
@ComponentImport
@ConfluenceImport@JiraImport
@ExportAsService@ExportAsDevService
Atlassian Spring Scanner
• No jar transforms!
• No runtime classpath scanning!
• Moves all component related things into java!
• Makes OSGi BND actually work!
• Compile time scanning == super fast plugin loads
K I S S T R A N S F O R M S A N D C L A S S PAT H S C A N N I N G G O O D B Y E
bitbucket.org/atlassian/atlassian-spring-scanner
How Do You Install Nothing?
P2 ==
Dynamic Plugin Modulesbitbucket.org/atlassian/atlassian-pocketknife
• Modules are registered as OSGi Services!
• Complete control over module lifecycle!
• Super fast startup!
• No longer confined to what’s in atlassian-plugin.xml!
M A G I C A L M O D U L E S A P P E A R A N D D I S A P P E A R
Live, Breathe and Eat Code; Spit Out Docs
XSD
XSD
+
json-schema Generator
• Generate json-schema from JAVA POJOs!
• Easy to use annotations!
• Schema can be validated with ANY json-schema validator!
• Plain Ol’ JAVA library can be embedded in anything
json-schema + Maven
• Generate json-schema from JAVA POJOs!
• Easy to use annotations!
• Schema can be validated with ANY json-schema validator!
• Now embedded in a Maven plugin!
• Adds javadocs as schema descriptions!
• Compile time generation
json-schemagen
bitbucket.org/atlassian/json-schemagen
• json-schema from JAVA POJO’s!
• Runs as a Maven plugin!
• Javadocs included in schema!
• Easily generate example code!
• Keep you docs in your DVCS!
• Never let your docs get out of date!
W R I T E C O D E N O T D O C S
bitbucket.org/atlassian/jgit-f low
bitbucket.org/atlassian/atlassian-spring-scanner
bitbucket.org/atlassian/json-schemagen
bitbucket.org/atlassian/atlassian-pocketknife
Resources