Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Engineering and Architecture

Similar presentations


Presentation on theme: "Software Engineering and Architecture"— Presentation transcript:

1 Software Engineering and Architecture
Dependency Management

2 Henrik Bærbak Christensen
Motivation Software Reuse The holy grail in software engineering for decades… Lot of hard work and research, and relatively little success Shaw: It is not the functionality, it is the packaging Until… The big open source organizations and the companies that does not earn their money from selling software began publishing libraries Apache, Eclipse, Goggle, Amazon, … Henrik Bærbak Christensen

3 Henrik Bærbak Christensen
Example I want to make a ”Hello World” web service ala Exercise: How much coding would that take given only raw Java language? Henrik Bærbak Christensen

4 Reusing Web Frameworks
One web framework is ‘Spark’ which allows pretty compact code… All nice and well… But… You need the Spark library Which depends on a lot of other reusable libraries… Core dependency: Eclipse Jetty, open source web server To clean ivy cache: c:\users\(user)\.ivy2 Henrik Bærbak Christensen

5 Henrik Bærbak Christensen
The Dependencies 17 Libraries! Tedious and error prone to Fetch all libraries in proper version Very long classpath in Java Henrik Bærbak Christensen

6 Henrik Bærbak Christensen
The Solution Dependency Management Tool to resolve the transitive closure of dependencies Locate and download library, recursively locate and download any dependencies Resolve conflicts A version 1 depends on B version 1 and C version 3 B version 1 depends on D version 2 C version 3 depends on D version 3 Tool will eject D version 2 and only provide D version 3 A Dependency Description Stating which libraries we need And – repositories of libraries Maven repository ‘mvnrepository.com’ is a major player! Henrik Bærbak Christensen

7 Henrik Bærbak Christensen
SWEA Context Gradle is a modern build management tool and it has already built-in dependency management !!! Earlier SWEA/dSoftArk used Ant which does not… And then had to use a plug-in tool, Ivy, to help out Henrik Bærbak Christensen

8 The Process Goal: I want Spark-java library in my project
Open mvnrepository.com and search for the library ‘sparkjava’ Take care: Apache has a project with the same name  Henrik Bærbak Christensen

9 Henrik Bærbak Christensen
The Process Select the project, version, and click the ‘gradle’ pane Now you can copy the gradle declaration… Which is the text that goes into your dependency description Henrik Bærbak Christensen

10 Henrik Bærbak Christensen
The Process … and paste it into your build.gradle Henrik Bærbak Christensen

11 Demo Gradle will: * Check if the .jar is in local cache * If not, download it from mvnrepository * Recurse on any dependencies * Set the CLASSPATH correctly Henrik Bærbak Christensen

12 Henrik Bærbak Christensen
JCenter / BinTray An alternative (which Gradle defaults to) to Maven Repository is JCenter. Is free to upload to And, less cumbersome than MvnRepository MiniDraw is hosted there Henrik Bærbak Christensen

13 Henrik Bærbak Christensen
DM in SWEA We will in SWEA only pull dependencies And you will always be given the build.gradle files Pushing to a repository is out-of-scope for our course Security you know Need to create credentials, secret tokens for pushing, and stuff... Henrik Bærbak Christensen

14 Henrik Bærbak Christensen
Summary Declarative approach State what you need, not how to get it A DSL (domain specific language) for defining dependencies A dependency description Tool (Gradle ) to resolve Public repositories with numerous libraries Possible to create own repos’ and publish team/organization specific libraries as well… Henrik Bærbak Christensen


Download ppt "Software Engineering and Architecture"

Similar presentations


Ads by Google