2012-03-21 6 views
6

मैवेन के साथ एक पूर्ण शुरुआत करने वाला हूं। मैं Maven By Example पुस्तक का पालन कर रहा हूं। खंड 6.13 में लेखक बनाने दर्शाता निर्भरता के साथ एक जार आदेशमेवेन: निर्भरता के साथ जार बनाना: पुस्तक से उदाहरण काम नहीं करता

mvn install assembly assembly 

के माध्यम से शामिल मैं अध्याय 6 में उदाहरण का पालन किया है, सिवाय मैं इकाई परीक्षण के साथ भागों को छोड़ दिया। मैं यह सुनिश्चित करने के लिए उनके माध्यम से वापस चला गया कि मैंने एक कदम नहीं छोड़ा था।

[INFO] 
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ simple-weather --- 
[INFO] 
[INFO] <<< maven-assembly-plugin:2.2-beta-5:assembly (default-cli) @ simple-weather <<< 
[INFO] 
[INFO] --- maven-assembly-plugin:2.2-beta-5:assembly (default-cli) @ simple-weather --- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.094s 
[INFO] Finished at: Wed Mar 21 15:53:03 EDT 2012 
[INFO] Final Memory: 5M/10M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project simple-weather: Error readi 
ng assemblies: No assembly descriptors found. -> [Help 1] 
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException 
C:\home\Projects\simple-weather> 

समस्या प्लगइन्स अनुभाग में जार-साथ-निर्भरता वर्णनकर्ता के साथ है: हालांकि जब मैं उपरोक्त आदेश की कोशिश की मैं यह त्रुटि उत्पादन मिला है। मैं थोड़ी देर के लिए googled, लेकिन किताब से इसे करने के लिए एक अलग रास्ता नहीं मिला। इसलिए, मुझे यह जानने में दिलचस्पी होगी कि मैं कहां गलत हो रहा हूं।

<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>org.sonatype.mavenbook.custom</groupId> 
    <artifactId>simple-weather</artifactId> 
    <version>1.0</version> 
    <packaging>jar</packaging> 

    <name>simple-weather</name> 
    <url>http://www.sonatype.com</url> 


    <licenses> 
     <license> 
      <name>Apache 2</name> 
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> 
      <distribution>repo</distribution> 
      <comments>A business-friendly OSS license</comments> 
     </license> 
    </licenses> 

    <organization> 
     <name>Sonatype</name> 
     <url>http://www.sonatype.com</url> 
    </organization> 

    <developers> 
     <developer> 
      <id>jason</id> 
      <name>Jason Van Zyl</name> 
      <email>[email protected]</email> 
      <url>http://www.sonatype.com</url> 
      <organization>Sonatype</organization> 
      <organizationUrl>http://www.sonatype.com</organizationUrl> 
      <roles> 
       <role>developer</role> 
      </roles> 
      <timezone>-6</timezone> 
     </developer> 
    </developers> 


    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.14</version> 
     </dependency> 
     <dependency> 
      <groupId>dom4j</groupId> 
      <artifactId>dom4j</artifactId> 
      <version>1.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>jaxen</groupId> 
      <artifactId>jaxen</artifactId> 
      <version>1.1.1</version> 
     </dependency> 
     <dependency> 
      <groupId>velocity</groupId> 
      <artifactId>velocity</artifactId> 
      <version>1.5</version> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <version>2.3.2</version> 
     </dependency> 
    </dependencies> 

    <build> 
     <plugins> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.5</source> 
        <target>1.5</target> 
        <descriptorRefs> 
         <descriptorRef>jar-with-dependencies</descriptorRef> 
        </descriptorRefs> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 






</project> 

धन्यवाद किसी भी सुराग के लिए पहले से ज्यादा:

यहाँ मेरी pom.xml है।

+0

'एमवीएन इंस्टॉल असेंबली: असेंबली' - फिर से जांचें –

उत्तर

9

समस्या यह है कि आपके पास असेंबली प्लगइन के बजाय संकलन प्लगइन के लिए कॉन्फ़िगर किया गया है।

अपने/निर्माण/plugins अनुभाग

<plugin> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.3</version> 
    <configuration> 
    <descriptorRefs> 
     <descriptorRef>jar-with-dependencies</descriptorRef> 
    </descriptorRefs> 
    </configuration> 
</plugin> 

को यह जोड़ें और के रूप में यह कुछ भी नहीं कर रहा है अपने संकलक प्लगइन config से नीचे हटा दें।

<descriptorRefs> 
    <descriptorRef>jar-with-dependencies</descriptorRef> 
</descriptorRefs> 
+0

यह काम करता है। मदद के लिए बहुत बहुत धन्यवाद। – Steve

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