2016-01-21 34 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将在包装阶段正确地调用插件。