Upload
oemer-taskin
View
88
Download
1
Tags:
Embed Size (px)
Citation preview
OUTLINE
• What is Dependency Management?
• Dependency Management Tools
• Maven – Configuration – Commands – Extras
• Composer
IP II – Dependency Management 2
What is Dependency Management?
IP II – Dependency Management 3
• Most of applications need some of 3rd party packages – Internal Client(s)
– Library
– Utility etc.
What is Dependency Management?
IP II – Dependency Management 4
• Ex: Your app requires Hibernate Framework
– Download .jar file from: http://hibernate.org/ – add .jar file to classpath It’s most bad solution!
Dependency Management Tools - Maven
IP II – Dependency Management 7
• Maven is most popular dependency management tool @Java
• Managed by pom.xml file (Project Object Model)
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
<groupId>tr.edu.yildiz</groupId> <artifactId>ytulabs</artifactId> <packaging>jar</packaging> <version>1.0-SNAPSHOT</version> </project>
Dependency Management Tools - Maven
IP II – Dependency Management 8
• Supports modularity
<modules> <module>core</module> <module>webapp</module> </modules>
Dependency Management Tools - Maven
IP II – Dependency Management 9
• Every maven module has pom.xml file to manage module
<parent> <artifactId>tr.edu.yildiz</artifactId> <groupId>ytulabs</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>webapp</artifactId> <packaging>war</packaging>
<parent> <artifactId>tr.edu.yildiz</artifactId> <groupId>ytulabs</groupId> <version>1.0-SNAPSHOT</version> </parent> <artifactId>core</artifactId> <packaging>jar</packaging>
Maven dependencies
IP II – Dependency Management 10
• Dependency definition:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> <version>4.3.5.Final</version> </dependency>
Maven Commands
IP II – Dependency Management 11
• Install the package into the local repository
• Clean up artifacts
• Run unit test only (if exists)
mvn install
mvn clean
mvn test
Maven Commands
IP II – Dependency Management 13
• Maven dependencies are placed into ~/.m2/repository directory as default
Composer
IP II – Dependency Management 14
• Composer is dependency management for PHP • Managed by composer.json file
• Sample composer.json file: {
"name": "project-name", "description": "Description of project", "version": "1.0", "authors": [ { "name": "Omer Taskin", "email": "[email protected]", "role": "Leader" } ], "require": {
"zendframework/zend-config": "2.0.*", "zendframework/zend-http": "2.0.*" }
}