2010-10-10 5 views
7

मेरे पास एक बहु मॉड्यूल मेवेन प्रोजेक्ट है और मैं चाहता हूं कि उप परियोजनाएं तृतीय पक्ष निर्भरताओं के संस्करणों का उत्तराधिकारी हों जिन्हें मैंने मूल परियोजना में निर्दिष्ट किया है। ऐसा इसलिए है कि मुझे हर जगह संस्करण संख्या दोहराने की आवश्यकता नहीं है। हालांकि यह काम नहीं कर रहा और जब मैं बाहर बच्चों पर संस्करण संख्या छोड़ मैं त्रुटि मिलती है:एक बहु मॉड्यूल मेवेन प्रोजेक्ट में सुपर प्रोजेक्ट से निर्भरता संस्करणों के उत्तराधिकारी के लिए मैं अपनी उप परियोजनाओं को कैसे प्राप्त कर सकता हूं?

dependencies.dependency.version is missing 

क्या मैं इस काम के प्राप्त करने के लिए बदलने की जरूरत है?

+0

आप अपने pom.xml फ़ाइलों –

उत्तर

11

The <dependencyManagement> section of the parent POM इस उद्देश्य के लिए है:

dependencyManagement : is used by POMs to help manage dependency information across all of its children. If the my-parent project uses dependencyManagement to define a dependency on junit:junit:4.0 , then POMs inheriting from this one can set their dependency giving the groupId=junit and artifactId=junit only, then Maven will fill in the version set by the parent. The benefits of this method are obvious. Dependency details can be set in one central location, which will propagate to all inheriting POMs. In addition, the version and scope of artifacts which are incorporated from transitive dependencies may also be controlled by specifying them in a dependency management section.

+0

सुनिश्चित नहीं हैं कि ओपी वास्तव में किया था के प्रासंगिक भाग दिखाना चाहिए लेकिन यह सही जवाब :) है –

0

क्या मैं इस के लिए क्या निर्भरता संस्करणों है कि मैं माता पिता परियोजना में एक संपत्ति के रूप में दोहराने की आवश्यकता को परिभाषित है । तो:

<properties> 
    ... 
    <guice.version>2.0</guice.version> 
</properties> 

और फिर:

<dependency> 
    <groupId>com.google.inject</groupId> 
    <artifactId>guice</artifactId> 
    <version>${guice.version}</version> 
</dependency> 

वास्तव में क्या आप शायद के लिए पूछ रहे हैं नहीं है, लेकिन यह मतलब है कि आप केवल एक ही स्थान पर संस्करण बदलना होगा।

संबंधित मुद्दे

 संबंधित मुद्दे