读取程序集时出错:未找到程序集描述符

问题描述 投票:35回答:3

构建项目时得到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
3个回答
29
投票

我一直在使用maven-assembly-plugin的版本2.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>

6
投票

似乎您已经在<build>...<pluginManagement>...<plugins>中配置了程序集插件。如果您在<build>...<plugins>中配置了插件,它应该可以工作。

<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>

0
投票

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

$ mvn干净的汇编:单个

但是在命令工作]下>对我来说

$ mvn干净的Assembly:assembly

© www.soinside.com 2019 - 2024. All rights reserved.