2016-01-21 33 views
1

這是我的pom.xml文件和建設錯誤讀取組件

當我得到了錯誤

錯誤:

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single (default-cli) on project load-xml-to-s3: Error reading assemblies: No assembly descriptors found.

<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>com.tte.s3.load</groupId> 
    <artifactId>load-xml-to-s3</artifactId> 
    <version>1.0</version> 
    <name>load-xml-to-s3</name> 
    <build> 
     <plugins> 
      <!-- TOBE USED LATER - DO NOT DELETE. - KC <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> 
       <artifactId>replacer</artifactId> <version>1.5.3</version> <executions> <execution> 
       <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> 
       </executions> <configuration> <file>target/classes/somefile.txt</file> <replacements> 
       <replacement> <token>SOME TOKEN</token> <value>SOME VALUE</value> </replacement> 
       </replacements> </configuration> </plugin> --> 

      <plugin> 
       <groupId>com.jolira</groupId> 
       <artifactId>onejar-maven-plugin</artifactId> 
       <version>1.4.4</version> 
       <executions> 
        <execution> 
         <configuration> 
          <mainClass>com.tte.s3.load.driver.Driver</mainClass> 
         </configuration> 
         <goals> 
          <goal>one-jar</goal> 
         </goals> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-assembly-plugin</artifactId> 

       <executions> 
        <execution> 
         <id>make-assembly</id> 
         <phase>assembly</phase> 
         <goals> 
          <goal>single</goal> 
         </goals> 
         <configuration> 

          <descriptors> 
           <descriptor>distribution.xml</descriptor> 
          </descriptors> 

         </configuration> 
        </execution> 

       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.1</version> 
       <configuration> 
        <source>1.8</source> 
        <target>1.8</target> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 
+0

嘗試在執行之外移動maven-assembly-plugin的配置。將它們嵌入插件標籤下 – Revive

回答

2

maven-assembly-plugindescriptors屬性預計從開始的一條路徑項目的基礎目錄。例如,如果文件位於src/assembly/distribution.xml之內,則這是您應該指定的路徑。

您在插件綁定的階段也存在問題。階段assembly不存在,您應該使用<phase>package</phase>來代替。

作爲一個副節點,您使用的是插件的舊版本(2.2-beta-5)。請考慮使用最新版本,即2.6

示例配置:

<plugin> 
    <!-- no need to specify the groupId, it defaults to "org.apache.maven.plugins" --> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <version>2.6</version> <!-- explicit version is safer for build consistency than implicit --> 
    <executions> 
     <execution> 
      <id>make-assembly</id> 
      <phase>package</phase> <!-- bind the execution to the "package" phase --> 
      <goals> 
       <goal>single</goal> 
      </goals> 
      <configuration> 
       <descriptors> 
        <descriptor>src/assembly/distribution.xml</descriptor> <!-- use the path to the file starting from base directory --> 
       </descriptors> 
      </configuration> 
     </execution> 
    </executions> 
</plugin> 

mvn clean install運行Maven將在包裝階段正確地調用插件。