220 likes | 332 Views
The Agile Dependency Manager. 김병곤 fharenheit@gmail.com. 20100911 v1.0. 소개. JBoss User Group 대표 통신사에서 분산 컴퓨팅 기반 개인화 시스템 구축 Process Designer – ETL, Input/Output, Mining Algorithm, 통계 … Apache Hadoop/Pig/HBase/Cassandra Distributed Cache Log Aggregator CEP(Complex Event Processing)
E N D
The Agile Dependency Manager 김병곤fharenheit@gmail.com 20100911 v1.0
소개 • JBoss User Group 대표 • 통신사에서 분산 컴퓨팅 기반 개인화 시스템 구축 • Process Designer – ETL, Input/Output, Mining Algorithm, 통계… • Apache Hadoop/Pig/HBase/Cassandra • Distributed Cache • Log Aggregator • CEP(Complex Event Processing) • Mining Algorithm – Association Rule, K-Means, CF, … • SW마에스트로엔터프라이즈분과멘토 – Hadoop 멘토링 • 다수 책 집필 및 번역 • JBoss Application Server 5, EJB 2/3 • Oreilly RESTful Java 번역중 2
Ant에서 Ivy의 필요성 • 프로젝트를 구성하는 각종 라이브러리의 관리 문제 • 라이브러리를 자동으로 다운로드 해준다면…. • 각종 라이브러리간 종속성 문제 • 이 라이브러리가 동작하려면 다른 라이브러리도 필요하다! • 소스코드에 라이브러리가 포함되어 있는 문제 • 소스코드 Check Out이 너무 느리다 • CVS/Subversion Repository가 커진다 4
Ivy란? • Tool • for Managing • Project Dependencies • = Apache Maven • Dependency Management 5
Ivy를 쓰려면? JDK Apache Ant Internet Line 7
DEMO Ivy를 동작시키기 위한 최소의 파일은? <ivy-module version="2.0"> <info organisation="org.apache" module="hello-ivy"/> <dependencies> <dependency org="commons-lang" name="commons-lang" rev="2.0"/> <dependency org="commons-cli" name="commons-cli" rev="1.0"/> </dependencies> </ivy-module> Ivy Style <project xmlns:ivy="antlib:org.apache.ivy.ant" name="hello-ivy" default="run"> ... <target name="resolve" description="--> retrieve dependencies with ivy"> <ivy:retrieve /> </target> </project> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.0</version> </dependency> Maven Style 8 $PROJECT_HOME/ivy.xml (Ivy : Dependency) $PROJECT_HOME/build.xml (Ant : Build Script)
Repository • JAR 파일(Dependency)의 보관 창고 • Maven Style Repository를 그대로 활용 • 3가지 방식의 Repository • Local – 자신만 사용할 수 있는 Repository • Shared – 팀이 공유할 수 있는 Repository • Public – 외부에 공개되어 누구나 사용할 수 있는 Repository • 사내 Private Repository를운영하는것이좀더바람직 9
DEMO Atifactory, Nexus Maven Repository 10
Multiple Resolver <ivysettings> <settings defaultResolver="chain-example"/> <resolvers> <chain name="chain-example"> <filesystem name="libraries"> <artifact pattern="${ivy.settings.dir}/repository/[artifact]-[revision].[ext]" /> </filesystem> <ibiblio name="ibiblio" m2compatible="true" /> </chain> </resolvers> </ivysettings> commons-lang-2.0.jar • Repository에 접근하는 다양한 방법을 제공 • Third Party 모듈은 Public, 내부 구현 모듈은 Private • 개발한모듈을 Local Repository에 두고자 하는 경우 • 모듈이 분산되어 있는 경우 • $PROJECT_HOME/ivysettings.xml 12
DEMO Repository Configuration Custom Repository <?xml version="1.0" encoding="UTF-8"?> <ivysettings> <settings defaultResolver="chained"/> <resolvers> <chain name="chained"> <ibiblio name="java.net2" m2compatible="true" root="http://download.java.net/maven/2/"/> <ibiblio name="jboss" m2compatible="true" root="http://repository.jboss.org/maven2"/> <ibiblio name="ibiblio" m2compatible="true"/> </chain> </resolvers> </ivysettings> 사내 Maven Repository가 있다면? 13
DEMO RESTful Java Example Dependency Exclusion <?xml version="1.0" encoding="UTF-8"?> <ivy-module version="2.0” xmlns:xsi="hssp://www.w3.org/2001/XMLSchema-inssance” xsi:noNamespaceSchemaLocasion="hssp://ans.apache.org/ivy/schemas/ivy.xsd"> <info organisasion="com.jbossug.jaxrs" module="jaxrs-examples"/> <dependencies> <dependency org="log4j" name="log4j" rev="1.2.16”> <exclude org="javax.mail"/> <exclude org="javax.activation"/> <exclude org="org.apache.geronimo.specs"/> </dependency> <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6”/> </dependencies> </ivy-module> 불필요한 Dependency를빼고싶은경우 14
Ivy Integration : Step 1 Ivy Download & Install <property name="ivy.jar.dir" value="${basedir}/ivy"/> <property name="ivy.jar.file" value="${ivy.jar.dir}/ivy.jar"/> <!-- Ivy Download --> <target name="download-ivy" unless="skip.download"> <mkdir dir="${ivy.jar.dir}"/> <echo message="installing ivy..."/> <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/2.1.0/ivy-2.1.0.jar" dest="${ivy.jar.file}" usetimestamp="true"/> </target> <!-- Ivy Installation --> <target name="install-ivy" depends="download-ivy"> <path id="ivy.lib.path"> <fileset dir="${ivy.jar.dir}" includes="*.jar"/> </path> <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/> </target> Ant 내에서 Ivy를 동작하도록 하기 위한 설정 15
Ivy Integration : Step 2 Dependency Resolve & Build <property name="lib.dir" value="${basedir}/lib"/> <path id="lib.path.id"> <pathelement location="${build.dir}" /> <fileset dir="${lib.dir}"> <include name="*.jar" /> </fileset> </path> <target name="resolve"> <ivy:retrieve /> </target> <target name="go" depends="install-ivy, resolve"> <javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="lib.path.id"/> <java classname="example.Hello"> <classpath> <path refid="lib.path.id"/> </classpath> </java> </target> Dependency를 다운로드하고 빌드를 하기 위한 설정 16
IvyIDE Eclipse 기반 Ivy 지원 도구 ivy.xml 파일에 정의한 dependency를 Eclipse에서 관리 Dependency를 Java 프로젝트의 CLASSPATH에 추가 각종 파일의 편집 기능 및 자동 완성 기능 제공 17
IvyIDE 18
IvyIDE 19
IvyIDE 20
참고 • Sonatype Nexus 동영상 • http://vimeo.com/1875558 • IvyIDE • http://ant.apache.org/ivy/ivyde • Ivy Official Site • http://ant.apache.org/ivy • 발표 자료(Naver 개발자 센터) • http://dev.naver.com/projects/edward/src • http://dev.naver.com/projects/edward/download 21
Q & A Q & A 22