2013-04-25 6 views
1

두 개의 프로젝트 A와 B가 있습니다. B는 webapp입니다. A의 ivy.xml 뭔가처럼 보이는 있도록 프로젝트 B는에 따라 달라집니다 : 그런개미, 담쟁이, 여러 프로젝트 및 전이 종속성

<ivy-module version="2.0"> 
    <info organisation="com.confused" module="B" status="integration"/>  

    <dependencies> 
    <!-- confused dependencies --> 
    <dependency name="A" rev="latest.integration"/> 

    <!-- 3rd party dependencies --> 
    <dependency org="org.springframework" name="spring-core" rev="3.2.2.RELEASE"/> 
    <dependency org="org.springframework" name="spring-jdbc" rev="3.2.2.RELEASE"/> 
    <dependency org="org.springframework" name="spring-webmvc" rev="3.2.2.RELEASE"/> 
    </dependencies> 
</ivy-module> 

뭔가를 ... 그리고 내 모듈은 다음과 같습니다

<ivy-module version="2.0"> 
    <info organisation="com.confused" module="A" status="integration"/>  

    <dependencies> 
    <dependency org="org.slf4j" name="slf4j-api" rev="1.7.5"/> 
    <dependency org="ch.qos.logback" name="logback-classic" rev="1.0.11"/> 
    <dependency org="ch.qos.logback" name="logback-core" rev="1.0.11"/> 
    </dependencies> 
</ivy-module> 

모든 좋은 ... 제외 :

때 B를 빌드하면 lib 디렉토리에 A.jar와 함께 스프링 jar 파일이 채워집니다. 좋고 좋지만 webapp을 '배포'하려면 WEB-INF/lib에이 jar를 복사해야하며 A가 의존하는 로깅 항아리도 복사해야합니다. 개미/아이비가 항아리를 '해결'하도록하려면 어떻게해야합니까?

답변

2

당신은 당신의 의존성에 의존 구성을 넣어 했었지 ... ivy.xml 파일에 사용되는 메이븐 구성과 일치 구성의 비공식 세트의 종류가있다

. 이 ivy.template.xml 파일은이 파일을 사용하며 개발자는 ivy.xml 파일을 기반으로합니다.

구성을 매핑하면됩니다. 여기에 A의 ivy.xml 파일입니다 :

<ivy-module version="2.0"> 
    <info organisation="com.confused" module="A" status="integration"/>  

    <configurations> 
     <configuration .../> 
     <!-- These are the configurations from the ivy.template.xml file --> 
    </configurations> 

    <dependencies> 
     <dependency org="org.slf4j" name="slf4j-api" rev="1.7.5" 
      conf="compile->default"/> 
     <dependency org="ch.qos.logback" name="logback-classic" rev="1.0.11" 
      conf="compile->default"/> 
     <dependency org="ch.qos.logback" name="logback-core" rev="1.0.11" 
      conf="compile->default"/> 
    </dependencies> 
</ivy-module> 

참고 conf 매핑! compile->default은 컴파일 타임과 런타임 의존성에 이것을 사용한다고 말합니다. 이것을 default에 매핑하면이 특정 jar뿐만 아니라 모든 전이 의존성도 다운로드됩니다. 이제

, 당신과 같이 표시됩니다 "B"에 대한 ivy.xml :

<ivy-module version="2.0"> 
    <info organisation="com.confused" module="B" status="integration"/>  

    <configurations> 
     <configuration .../> 
     <!-- These are the configurations from the ivy.template.xml file --> 
    </configurations> 

    <dependencies> 
     <!-- Don't forget the organisation field!--> 
     <dependency org="com.confused" name="A" rev="latest.integration" 
      conf="compile->default"/> 

     <!-- 3rd party dependencies --> 
     <dependency org="org.springframework" name="spring-core" rev="3.2.2.RELEASE" 
      conf="compile->default"/> 
     <dependency org="org.springframework" name="spring-jdbc" rev="3.2.2.RELEASE" 
      conf="compile->default"/> 
     <dependency org="org.springframework" name="spring-webmvc" rev="3.2.2.RELEASE" 
      conf="compile->default"/> 
    </dependencies> 
</ivy-module> 

프로젝트 A의 항아리와 그 종속 프로젝트 "B"는 최대 달려 항아리의 단순히 또 다른 세트.

물론 "B"가 사용하려면 먼저 publish A 아이 방을 아이비 저장소에 저장해야합니다.

+0

예, 나는 이것에 newb이고, 윤곽을 완전히 이해하지 않았다. 나는 아직도하지 않지만, 지금 알아낼거야! 그러나, 나는 당신을 증명할만큼 충분한 것을 알아 냈다, 정말로 당신에게 감사해라! – ticktock

+0

구성은 종속성을 _group_하는 방법입니다. 예를 들어, 표준은 "컴파일"구성, "테스트"구성 및 "런타임"구성을 갖는 것입니다. main.classpath conf = "compile"/>'를 사용하여 클래스 경로를 만들 수 있습니다. 컴파일 및 테스트 또는 런타임이 아닌 jar 파일 만 포함됩니다. junit 테스트의 경우, d''와 같은 것을 사용하십시오. 'a-> b' 매핑은 동작에 영향을주는 방법이며 Maven의 구성과 일치하는 _standard_configs입니다. –

관련 문제