【问题标题】:Error reading assemblies: No assembly descriptors found读取程序集时出错:未找到程序集描述符
【发布时间】:2011-03-03 16:20:25
【问题描述】:

我在构建项目时收到Error reading assemblies: No assembly descriptors found。我正在尝试为我的.sh 文件设置权限并排除一个讨厌的.jar 文件,这会使我的应用程序崩溃...不过我认为问题不在于这个.......

我的 maven-assembly 插件是这样添加到我的 pom.xml 文件中的:

<plugin>
       <artifactId>maven-assembly-plugin</artifactId>
       <version>2.2.1</version>
       <executions>
       <execution>
           <id>make-assembly</id>
           <phase>package</phase>
           <goals>
             <goal>single</goal>
           </goals>
           <configuration>
           <descriptors>
             <descriptor>src/main/assembly/src.xml</descriptor>
           </descriptors>
           </configuration>
      </execution>
      </executions> 
</plugin>

我的程序集描述符如下所示:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
  <id>my-assembly-descriptor</id>
  <formats>
    <format>jar</format>
    <format>war</format>
  </formats>
  <fileSets>
        <fileSet>
            <directory>${project.build.directory}</directory>
            <outputDirectory>${project.build.directory}</outputDirectory>
            <includes>
                <include>*.sh</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>
  </fileSets>
  <dependencySets>
    <dependencySet>
        <excludes>
        <exclude>spring-2.5.4.jar</exclude>
      </excludes>
    </dependencySet>
  </dependencySets>
</assembly>

我项目中的结构是:

Interface - src - main - assembly - src.xml

          - pom.xml

当尝试运行时 -> 调试为 -> 然后在目标中 assembly:single

我得到同样的错误。我在控制台中尝试了assembly:assembly,但我一无所获。我什至试图为我的程序集描述符设置错误的路径,但错误并没有改变。将${basedir}/ 放在我的程序集描述符的路径之前时,我得到了相同的结果。

我有 Ubuntu 10.10 Maverick Meerkat,我正在使用 Eclipse EE,...

谢谢!

【问题讨论】:

    标签: assemblies maven-assembly-plugin


    【解决方案1】:

    我一直在使用 maven-assembly-plugin2.3 版本,但我相信问题是一样的:如果在执行中声明了程序集配置,它可以从 mvn package 工作,但不能从mvn assembly:assembly工作。

    我找到的解决方案是在插件的顶层配置中声明配置,并保持执行尽可能小:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.3</version>
        <configuration>
            <descriptors>
                <descriptor>src/main/assembly/standalone.xml</descriptor>
            </descriptors>
            <finalName>standalone</finalName>
        </configuration>
        <executions>
            <execution>
                <id>standalone</id>
                <phase>package</phase>
                <goals>
                    <goal>single</goal>
                </goals>
            </execution>
        </executions>
    </plugin>
    

    【讨论】:

    • 谢谢,这个答案完美地解决了我的问题。是版本错误还是设计问题?其他大部分答案都写在里面了,困扰了我很久。
    【解决方案2】:

    看来你已经在&lt;build&gt;...&lt;pluginManagement&gt;...&lt;plugins&gt; 中配置了汇编插件。如果您在&lt;build&gt;...&lt;plugins&gt; 中配置插件,它应该可以工作。

    <build>
      <plugins>
        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>2.2.1</version>
          <executions>
            <execution>
              <id>make-assembly</id>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
              <configuration>
                <descriptors>
                  <descriptor>src/main/assembly/src.xml</descriptor>
                </descriptors>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </build>
    

    【讨论】:

    • 我无法确认这一点。对我来说它也不起作用。
    【解决方案3】:

    下面的命令我也遇到了同样的问题

    $mvn clean assembly:single

    但是下面的命令对我有用

    $mvn clean assembly:assembly

    【讨论】:

    • 这个目标在新版本中不再存在。
    猜你喜欢
    • 2015-05-30
    • 1970-01-01
    • 2020-10-05
    • 2011-01-28
    • 2016-07-17
    • 1970-01-01
    • 1970-01-01
    • 2018-07-04
    • 2017-10-08
    相关资源
    最近更新 更多