SlideShare uma empresa Scribd logo
1 de 62
Baixar para ler offline
OSGi with Maven
Improved developer productivity thanks to standard tools
Thank you!
To correct me:
luke | code-house.org
twitter: @ldywicki
code: https://github.com/Code-House/eclipsecon (under ASL 2.0)
Is it a perfect marriage?
Is it a perfect marriage?
Let's face the truth
Source: https://twitter.com/vorburger/status/1044203455055892481
Google trends
About me
Self employed consultant since 2008, a middleware specialist.
● Open Source enthusiast since forever
● Apache Karaf
○ committer since 2010
○ project management committee since 2012
● I worked for
Red Hat, FUSE Source, been involved in projects for Alcatel-Lucent, Nokia Siemens Networks,
Polish Post Bank, Royal Bank of Scotland etc.
● Eclipse user since 2003
● Maven user since 2006
Few words about world
How does it look a like outhere
Tool usage
Source: https://snyk.io/blog/jvm-ecosystem-report-2018-tools
Build tools
Source: https://snyk.io/blog/jvm-ecosystem-report-2018-tools
Artifact repositories
Source: https://snyk.io/blog/jvm-ecosystem-report-2018-tools
Testing tools
Source: https://snyk.io/blog/jvm-ecosystem-report-2018-tools
Runtimes
Source: https://snyk.io/blog/jvm-ecosystem-report-2018-platform-application
OSGi is not classified in runtimes
● Some of server runtimes can run OSGi
● OSGi can be run inside a WAR
● There are a lot of people who knows Maven, Tomcat, IntellIJ and Eclipse and development model
promoted by these tools
Communication troubles
Pay attention to what you say
There is a problem finding people
knowing OSGi.
Closer look on Maven
Maven is ...
● build tool
○ compiler
○ test runner
○ packager
○ site generator
But it is also
● Tool promoting convention over configuration
● Repository client
● A dependency manager
● A pluggable machina
a word about configuration
● Global
$M2_HOME/conf/settings.xml
● Local, user settings
~/.m2/settings.xml
● Project
pom.xml
a bit about inheritance
● Projects can be organised into a tree:
○ super pom (implicit)
■ organisation POM
● project A
○ child project 1
○ child project 2
● project B
○ first child
○ second child
what is inherited
● dependency management
● dependencies
● plugins
○ executions
○ configurations
● resources configuration
Convention over configuration
● You palce sources in src/
○ code in main/java, resources in main/resources
○ tests in test/java
● Results end up in target/
● There are standard build phases (pre-test, test, package etc.)
● Plugins are hooked into phases
● Depending on plugin developer, there are various defaults
Repository client
● Maven brought remote repository idea to mainstream
● Elements are identified by:
○ group id
○ artifact id
○ version
○ classifier
○ type (packaging)
Location: ${group id}/${artifact id}/${version}/${artifact id}-${version}[-${classifier}].${type}
● One project may have multiple repositories
● The central.maven.org is enabled by default
● You are free to define own repositories
○ in project descriptor
○ local or global maven settings
Dependency manager
● Maven recognizes basic dependency scopes
○ compile
○ runtime
○ test (not transitive)
○ provided (not transitive)
● system / import scopes are special kind
● Dependencies can be managed / forced by parent and also overridden
Transient dependencies
What dependency management do
#include <dependency.h>
<dependencyManagement>
<dependency>
<groupId>org.eclipse.smarthome</groupId>
<artifactId>smarthome</artifactId>
<version>0.10.0-SNAPSHOT</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencyManagement>
Pluggable machina
● Maven internally uses simple IoC based on classpath scanning
● Classpath can be extended via plugin dependencies & extensions
● There is whole new extension mechanism in 3.x (enabling polyglot maven)
● Almost all, if not all, components are injected via IoC
● … did I mention that maven supports version ranges?
Versions and ranges under Maven
● 2 becomes 2.0.0 when comparing
● Special values in qualifier:
○ "alpha" < "beta" < "milestone" < "cr" / "rc" < "snapshot" < "final" / "ga" < "sp"
● 2.0-Snapshot matches [1,2.0) boundary (excludes 2.0 release)
● Customisable via SPI:
○ Version Scheme
○ Version Range Resolver
○ OSGi compatible version: https://github.com/Code-House/maven-osgi-resolver
Commonalities
Comparison
Element OSGi Maven
Build unit Bundle Project / Module
Dependency unit Package, req /cap Dependency
Platform definition Target Platform (PDE) Dependency management
Version ranges Yes Yes
Repositories OBR, P2 Maven repos
Project organisation
Systems are like onions
Source: http://www.downvids.net/shrek-moments-quot-ogres-are-like-onions-quot--317773.html, Shrek movie was made by DreamWorks
Each bigger system have
● Domain model
● Persistence
● Communication interface
● Many provider/consumer relationship between these parts
Properly structured project is
easier to run and maintain.
Most of OSGi projects is properly
structured.
Some Maven based projects have
good structure.
Basic project structure
● root
○ model
○ api
○ core
○ dao
■ api
■ core
○ web
■ api
■ core
○ features
Manifest is just another resource
How to generate manifest
<packaging>bundle</packaging>
<!-- … -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Export-Package>org.code_house.eclipsecon.mvnosgi.api</Export-Package>
<Private-Package>org.code_house.eclipsecon.mvnosgi.core</Private-Package>
<Bundle-Activator>org.code_house.eclipsecon.mvnosgi.core.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
bndlib ✔
Manifest defaults
Bundle-SymbolicName: ${project.groupId}.${project.artifactId}
Bundle-Version: ${project.version}
Bundle-Name: ${project.name}
Bundle-Description: ${project.description}
Bundle-Vendor: ${project.organization.name}
Bundle-License: ${project.license*.url}
Import-Package: *
Export-Package: *
Private-Package: *.impl.*, *.internal.*
Deployment
How to bring bundles to runtime
Quick look on Karaf
Pax URL
● By default Java runtime supports following URI schemes:
○ http[s]:
○ file:
● Java / OSGi framework allows to provide new schemes (ie. bundle:)
● Pax URL provides:
○ wrap:
○ classpath:
○ mvn:
○ and few more (exploded dir and similar)
Deploying bundles
● install mvn:org.code-house.eclipsecon.mvnosgi/api/RELEASE
● install mvn:org.code-house.eclipsecon.mvnosgi/core/RELEASE
● install mvn:org.code-house.eclipsecon.mvnosgi.dao/api/RELEASE
● install mvn:org.code-house.eclipsecon.mvnosgi.dao/core/RELEASE/jar
● install mvn:org.code-house.eclipsecon.mvnosgi.web/api/LATEST/x86_64/jar
Karaf feature
<feature name="book-service" version="${project.version}">
<feature>scr</feature>
<feature>cxf-jaxrs</feature>
<feature>aries-blueprint</feature>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi/core/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi/api/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi/model/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi.dao/api/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi.dao/core/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi.web/core/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi.web/api/1.0.0-SNAPSHOT</bundle>
<bundle>mvn:org.code-house.eclipsecon.mvnosgi/dto/1.0.0-SNAPSHOT</bundle>
<!-- … rest of stuff ... -->
</feature>
Testing
How to bring bundles to runtime
OSGi -> junit -> test
junit -> OSGi -> test
Demo time
Arquillian
Pax Exam
Pax Tinybundles
InputStream inp = bundle()
.activator(TestActivator.class)
.add(BookService.class)
.add(TestBookService.class)
.symbolicName("test-bundle")
.set(Constants.EXPORT_PACKAGE, "demo")
.set(Constants.IMPORT_PACKAGE, "demo")
.build();
Exam containers
● OSGi
● Karaf
● Tomcat
● Weld
● JBoss / Wildfly 8 / Wildfly 9
Example test
@RunWith(PaxExam.class)
@ExamReactorStrategy(PerMethod.class)
public class ExampleIntegrationTest {
@Configuration public Option[] config() {
return options(junitBundles());
}
@Test …
}
Unit testing - Felix Connect
● Emulates OSGi framework
○ Activators
○ Service lookups
○ Bundles and classloaders
● Perfect candidate for unit testing based on plain maven classpath
Felix Connect
String bundleFilter = "(&(Bundle-SymbolicName=*)(!(Bundle-SymbolicName=org.osgi.*)))";
List<BundleDescriptor> descriptors = new ClasspathScanner().scanForBundles(bundleFilter, loader);
// setup felix-connect to use our bundles
Map<String, Object> config = new HashMap<>();
config.put(PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS, bundles);
PojoServiceRegistry reg = new PojoServiceRegistryFactoryImpl().newPojoServiceRegistry(config);
BundleContext bundleContext = reg.getBundleContext();
JUnit 5
AssertJ
// entry point for all assertThat methods and utility methods (e.g. entry)
import static org.assertj.core.api.Assertions.*;
// basic assertions
assertThat(frodo.getName()).isEqualTo("Frodo");
assertThat(frodo).isNotEqualTo(sauron);
Questions
Thank you!
To correct me:
luke | code-house.org
twitter: @ldywicki
code: https://github.com/Code-House/eclipsecon (under ASL 2.0)

Mais conteúdo relacionado

Mais procurados

Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausWomen in Technology Poland
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersKostas Saidis
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another buildIgor Khotin
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to MavenSperasoft
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the buildEyal Lezmy
 
Efficient Django
Efficient DjangoEfficient Django
Efficient DjangoDavid Arcos
 
Gradle plugins, take it to the next level
Gradle plugins, take it to the next levelGradle plugins, take it to the next level
Gradle plugins, take it to the next levelEyal Lezmy
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for androidzhang ghui
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developersTricode (part of Dept)
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6Kostas Saidis
 
Groovy in the Cloud
Groovy in the CloudGroovy in the Cloud
Groovy in the CloudDaniel Woods
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingAlessandro Molina
 

Mais procurados (20)

Architektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan KrausArchitektura html, css i javascript - Jan Kraus
Architektura html, css i javascript - Jan Kraus
 
Gradle by Example
Gradle by ExampleGradle by Example
Gradle by Example
 
Gradle
GradleGradle
Gradle
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java Developers
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Gradle - time for another build
Gradle - time for another buildGradle - time for another build
Gradle - time for another build
 
Maven
MavenMaven
Maven
 
Introduction to Maven
Introduction to MavenIntroduction to Maven
Introduction to Maven
 
Gradle plugin, take control of the build
Gradle plugin, take control of the buildGradle plugin, take control of the build
Gradle plugin, take control of the build
 
Efficient Django
Efficient DjangoEfficient Django
Efficient Django
 
Gradle plugins, take it to the next level
Gradle plugins, take it to the next levelGradle plugins, take it to the next level
Gradle plugins, take it to the next level
 
Gradle,the new build system for android
Gradle,the new build system for androidGradle,the new build system for android
Gradle,the new build system for android
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
Liferay maven sdk
Liferay maven sdkLiferay maven sdk
Liferay maven sdk
 
NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6NetBeans Support for EcmaScript 6
NetBeans Support for EcmaScript 6
 
Android presentation - Gradle ++
Android presentation - Gradle ++Android presentation - Gradle ++
Android presentation - Gradle ++
 
Groovy in the Cloud
Groovy in the CloudGroovy in the Cloud
Groovy in the Cloud
 
GWT Reloaded
GWT ReloadedGWT Reloaded
GWT Reloaded
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
EuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears TrainingEuroPython 2013 - Python3 TurboGears Training
EuroPython 2013 - Python3 TurboGears Training
 

Semelhante a Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Code-House)

Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulMert Çalışkan
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN ControllerSumit Arora
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenMert Çalışkan
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers WorkshopJody Garnett
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using MavenScheidt & Bachmann
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to MavenEric Wyles
 
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptxCoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptxHervé Boutemy
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolelliando dias
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldDmitry Bakaleinik
 
How to setup a development environment for ONAP
How to setup a development environment for ONAPHow to setup a development environment for ONAP
How to setup a development environment for ONAPVictor Morales
 
CQCON CQ Maven Methods
CQCON CQ Maven MethodsCQCON CQ Maven Methods
CQCON CQ Maven MethodsAndrew Savory
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 

Semelhante a Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Code-House) (20)

Intelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest IstanbulIntelligent Projects with Maven - DevFest Istanbul
Intelligent Projects with Maven - DevFest Istanbul
 
Opendaylight SDN Controller
Opendaylight SDN ControllerOpendaylight SDN Controller
Opendaylight SDN Controller
 
BMO - Intelligent Projects with Maven
BMO - Intelligent Projects with MavenBMO - Intelligent Projects with Maven
BMO - Intelligent Projects with Maven
 
tools cli java
tools cli javatools cli java
tools cli java
 
GeoServer Developers Workshop
GeoServer Developers WorkshopGeoServer Developers Workshop
GeoServer Developers Workshop
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
S/W Design and Modularity using Maven
S/W Design and Modularity using MavenS/W Design and Modularity using Maven
S/W Design and Modularity using Maven
 
Maven
MavenMaven
Maven
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptxCoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
CoC NA 2023 - Reproducible Builds for the JVM and beyond.pptx
 
Maven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension toolMaven 2.0 - Project management and comprehension tool
Maven 2.0 - Project management and comprehension tool
 
Introduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS worldIntroduction to maven, its configuration, lifecycle and relationship to JS world
Introduction to maven, its configuration, lifecycle and relationship to JS world
 
4 maven junit
4 maven junit4 maven junit
4 maven junit
 
Using Maven2
Using Maven2Using Maven2
Using Maven2
 
Node.js an Exectutive View
Node.js an Exectutive ViewNode.js an Exectutive View
Node.js an Exectutive View
 
How to setup a development environment for ONAP
How to setup a development environment for ONAPHow to setup a development environment for ONAP
How to setup a development environment for ONAP
 
CQ Maven Methods
CQ Maven MethodsCQ Maven Methods
CQ Maven Methods
 
CQCON CQ Maven Methods
CQCON CQ Maven MethodsCQCON CQ Maven Methods
CQCON CQ Maven Methods
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 

Mais de mfrancis

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...mfrancis
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)mfrancis
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)mfrancis
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruumfrancis
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...mfrancis
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...mfrancis
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...mfrancis
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)mfrancis
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...mfrancis
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)mfrancis
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...mfrancis
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...mfrancis
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)mfrancis
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)mfrancis
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)mfrancis
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...mfrancis
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)mfrancis
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...mfrancis
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)mfrancis
 
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...mfrancis
 

Mais de mfrancis (20)

Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
Eclipse Modeling Framework and plain OSGi the easy way - Mark Hoffman (Data I...
 
OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)OSGi and Java 9+ - BJ Hargrave (IBM)
OSGi and Java 9+ - BJ Hargrave (IBM)
 
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
Simplify Web UX Coding using OSGi Modularity Magic - Paul Fraser (A2Z Living)
 
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank LyaruuOSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
OSGi for the data centre - Connecting OSGi to Kubernetes - Frank Lyaruu
 
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
Remote Management and Monitoring of Distributed OSGi Applications - Tim Verbe...
 
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
OSGi with Docker - a powerful way to develop Java systems - Udo Hafermann (So...
 
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
A real world use case with OSGi R7 - Jurgen Albert (Data In Motion Consulting...
 
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
OSGi Feature Model - Where Art Thou - David Bosschaert (Adobe)
 
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
Migrating from PDE to Bndtools in Practice - Amit Kumar Mondal (Deutsche Tele...
 
OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)OSGi CDI Integration Specification - Ray Augé (Liferay)
OSGi CDI Integration Specification - Ray Augé (Liferay)
 
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
How OSGi drives cross-sector energy management - Jörn Tümmler (SMA Solar Tech...
 
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
It Was Twenty Years Ago Today - Building an OSGi based Smart Home System - Ch...
 
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)Popular patterns revisited on OSGi - Christian Schneider (Adobe)
Popular patterns revisited on OSGi - Christian Schneider (Adobe)
 
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
Integrating SLF4J and the new OSGi LogService 1.4 - BJ Hargrave (IBM)
 
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
OSG(a)i: because AI needs a runtime - Tim Verbelen (imec)
 
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
Flying to Jupiter with OSGi - Tony Walsh (ESA) & Hristo Indzhov (Telespazio V...
 
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
MicroProfile, OSGi was meant for this - Ray Auge (Liferay)
 
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
Prototyping IoT systems with a hybrid OSGi & Node-RED platform - Bruce Jackso...
 
How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)How to connect your OSGi application - Dirk Fauth (Bosch)
How to connect your OSGi application - Dirk Fauth (Bosch)
 
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...
Visualization of OSGi based Software Architectures in Virtual Reality - Lisa ...
 

Último

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Último (20)

Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Improved developer productivity thanks to Maven and OSGi - Lukasz Dywicki (Code-House)

  • 1. OSGi with Maven Improved developer productivity thanks to standard tools
  • 2. Thank you! To correct me: luke | code-house.org twitter: @ldywicki code: https://github.com/Code-House/eclipsecon (under ASL 2.0)
  • 3. Is it a perfect marriage?
  • 4. Is it a perfect marriage?
  • 5. Let's face the truth Source: https://twitter.com/vorburger/status/1044203455055892481
  • 7. About me Self employed consultant since 2008, a middleware specialist. ● Open Source enthusiast since forever ● Apache Karaf ○ committer since 2010 ○ project management committee since 2012 ● I worked for Red Hat, FUSE Source, been involved in projects for Alcatel-Lucent, Nokia Siemens Networks, Polish Post Bank, Royal Bank of Scotland etc. ● Eclipse user since 2003 ● Maven user since 2006
  • 8. Few words about world How does it look a like outhere
  • 14. OSGi is not classified in runtimes ● Some of server runtimes can run OSGi ● OSGi can be run inside a WAR ● There are a lot of people who knows Maven, Tomcat, IntellIJ and Eclipse and development model promoted by these tools
  • 16. There is a problem finding people knowing OSGi.
  • 17. Closer look on Maven
  • 18. Maven is ... ● build tool ○ compiler ○ test runner ○ packager ○ site generator But it is also ● Tool promoting convention over configuration ● Repository client ● A dependency manager ● A pluggable machina
  • 19. a word about configuration ● Global $M2_HOME/conf/settings.xml ● Local, user settings ~/.m2/settings.xml ● Project pom.xml
  • 20. a bit about inheritance ● Projects can be organised into a tree: ○ super pom (implicit) ■ organisation POM ● project A ○ child project 1 ○ child project 2 ● project B ○ first child ○ second child
  • 21. what is inherited ● dependency management ● dependencies ● plugins ○ executions ○ configurations ● resources configuration
  • 22. Convention over configuration ● You palce sources in src/ ○ code in main/java, resources in main/resources ○ tests in test/java ● Results end up in target/ ● There are standard build phases (pre-test, test, package etc.) ● Plugins are hooked into phases ● Depending on plugin developer, there are various defaults
  • 23. Repository client ● Maven brought remote repository idea to mainstream ● Elements are identified by: ○ group id ○ artifact id ○ version ○ classifier ○ type (packaging) Location: ${group id}/${artifact id}/${version}/${artifact id}-${version}[-${classifier}].${type} ● One project may have multiple repositories ● The central.maven.org is enabled by default ● You are free to define own repositories ○ in project descriptor ○ local or global maven settings
  • 24. Dependency manager ● Maven recognizes basic dependency scopes ○ compile ○ runtime ○ test (not transitive) ○ provided (not transitive) ● system / import scopes are special kind ● Dependencies can be managed / forced by parent and also overridden
  • 28. Pluggable machina ● Maven internally uses simple IoC based on classpath scanning ● Classpath can be extended via plugin dependencies & extensions ● There is whole new extension mechanism in 3.x (enabling polyglot maven) ● Almost all, if not all, components are injected via IoC ● … did I mention that maven supports version ranges?
  • 29. Versions and ranges under Maven ● 2 becomes 2.0.0 when comparing ● Special values in qualifier: ○ "alpha" < "beta" < "milestone" < "cr" / "rc" < "snapshot" < "final" / "ga" < "sp" ● 2.0-Snapshot matches [1,2.0) boundary (excludes 2.0 release) ● Customisable via SPI: ○ Version Scheme ○ Version Range Resolver ○ OSGi compatible version: https://github.com/Code-House/maven-osgi-resolver
  • 31. Comparison Element OSGi Maven Build unit Bundle Project / Module Dependency unit Package, req /cap Dependency Platform definition Target Platform (PDE) Dependency management Version ranges Yes Yes Repositories OBR, P2 Maven repos
  • 33. Systems are like onions Source: http://www.downvids.net/shrek-moments-quot-ogres-are-like-onions-quot--317773.html, Shrek movie was made by DreamWorks
  • 34. Each bigger system have ● Domain model ● Persistence ● Communication interface ● Many provider/consumer relationship between these parts
  • 35. Properly structured project is easier to run and maintain.
  • 36. Most of OSGi projects is properly structured.
  • 37. Some Maven based projects have good structure.
  • 38. Basic project structure ● root ○ model ○ api ○ core ○ dao ■ api ■ core ○ web ■ api ■ core ○ features
  • 39. Manifest is just another resource
  • 40. How to generate manifest <packaging>bundle</packaging> <!-- … --> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId> <configuration> <instructions> <Export-Package>org.code_house.eclipsecon.mvnosgi.api</Export-Package> <Private-Package>org.code_house.eclipsecon.mvnosgi.core</Private-Package> <Bundle-Activator>org.code_house.eclipsecon.mvnosgi.core.Activator</Bundle-Activator> </instructions> </configuration> </plugin>
  • 42. Manifest defaults Bundle-SymbolicName: ${project.groupId}.${project.artifactId} Bundle-Version: ${project.version} Bundle-Name: ${project.name} Bundle-Description: ${project.description} Bundle-Vendor: ${project.organization.name} Bundle-License: ${project.license*.url} Import-Package: * Export-Package: * Private-Package: *.impl.*, *.internal.*
  • 43. Deployment How to bring bundles to runtime
  • 44. Quick look on Karaf
  • 45. Pax URL ● By default Java runtime supports following URI schemes: ○ http[s]: ○ file: ● Java / OSGi framework allows to provide new schemes (ie. bundle:) ● Pax URL provides: ○ wrap: ○ classpath: ○ mvn: ○ and few more (exploded dir and similar)
  • 46. Deploying bundles ● install mvn:org.code-house.eclipsecon.mvnosgi/api/RELEASE ● install mvn:org.code-house.eclipsecon.mvnosgi/core/RELEASE ● install mvn:org.code-house.eclipsecon.mvnosgi.dao/api/RELEASE ● install mvn:org.code-house.eclipsecon.mvnosgi.dao/core/RELEASE/jar ● install mvn:org.code-house.eclipsecon.mvnosgi.web/api/LATEST/x86_64/jar
  • 47. Karaf feature <feature name="book-service" version="${project.version}"> <feature>scr</feature> <feature>cxf-jaxrs</feature> <feature>aries-blueprint</feature> <bundle>mvn:org.code-house.eclipsecon.mvnosgi/core/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi/api/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi/model/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi.dao/api/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi.dao/core/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi.web/core/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi.web/api/1.0.0-SNAPSHOT</bundle> <bundle>mvn:org.code-house.eclipsecon.mvnosgi/dto/1.0.0-SNAPSHOT</bundle> <!-- … rest of stuff ... --> </feature>
  • 48. Testing How to bring bundles to runtime
  • 49. OSGi -> junit -> test
  • 50. junit -> OSGi -> test
  • 54. Pax Tinybundles InputStream inp = bundle() .activator(TestActivator.class) .add(BookService.class) .add(TestBookService.class) .symbolicName("test-bundle") .set(Constants.EXPORT_PACKAGE, "demo") .set(Constants.IMPORT_PACKAGE, "demo") .build();
  • 55. Exam containers ● OSGi ● Karaf ● Tomcat ● Weld ● JBoss / Wildfly 8 / Wildfly 9
  • 56. Example test @RunWith(PaxExam.class) @ExamReactorStrategy(PerMethod.class) public class ExampleIntegrationTest { @Configuration public Option[] config() { return options(junitBundles()); } @Test … }
  • 57. Unit testing - Felix Connect ● Emulates OSGi framework ○ Activators ○ Service lookups ○ Bundles and classloaders ● Perfect candidate for unit testing based on plain maven classpath
  • 58. Felix Connect String bundleFilter = "(&(Bundle-SymbolicName=*)(!(Bundle-SymbolicName=org.osgi.*)))"; List<BundleDescriptor> descriptors = new ClasspathScanner().scanForBundles(bundleFilter, loader); // setup felix-connect to use our bundles Map<String, Object> config = new HashMap<>(); config.put(PojoServiceRegistryFactory.BUNDLE_DESCRIPTORS, bundles); PojoServiceRegistry reg = new PojoServiceRegistryFactoryImpl().newPojoServiceRegistry(config); BundleContext bundleContext = reg.getBundleContext();
  • 60. AssertJ // entry point for all assertThat methods and utility methods (e.g. entry) import static org.assertj.core.api.Assertions.*; // basic assertions assertThat(frodo.getName()).isEqualTo("Frodo"); assertThat(frodo).isNotEqualTo(sauron);
  • 62. Thank you! To correct me: luke | code-house.org twitter: @ldywicki code: https://github.com/Code-House/eclipsecon (under ASL 2.0)