【问题标题】:Error reading assemblies: Descriptor with ID <xml path> not found读取程序集时出错:未找到 ID 为 <xml 路径> 的描述符
【发布时间】:2020-10-05 21:38:31
【问题描述】:

我一直在尝试将我的项目从 Java 8 迁移到 Java 11。到目前为止,我还更新了我的 Spring boot 项目,并且能够找到解决问题的方法。虽然对于这个,我在解决它时遇到了一些困难。 我的 Maven 版本是 3.6.1

一开始我的maven组装插件的值是这样的:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-assembly-plugin</artifactId>
    <configuration>
        <appendAssemblyId>false</appendAssemblyId>
        <descriptor>src/main/assembly/boot.xml</descriptor>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

虽然它会抛出一个错误,说明:

目标的执行make-assembly org.apache.maven.plugins:maven-assembly-plugin:3.1.1:single failed: 参数“descriptor”已从插件中删除,请验证 文档。 -> [帮助 1]

根据maven assembly documentationdescriptor 的使用总是不正确的。所以我将其更新为:

<configuration>
    <appendAssemblyId>false</appendAssemblyId>
    <descriptorRefs>
      <descriptorRef>src/main/assembly/boot.xml</descriptorRef>
    </descriptorRefs>
</configuration>

虽然还是不行。它会抛出这样的错误:

读取程序集时出错:带 ID 的描述符 'src/main/assembly/boot.xml' 未找到 -> [帮助 1]

即使 boot.xml 已经存在。

关于如何解决此问题的任何其他建议?提前谢谢!

【问题讨论】:

    标签: java spring-boot maven build maven-assembly-plugin


    【解决方案1】:

    好吧,我刚刚返回到我之前的配置并添加了描述符标签。现在看起来像这样:

    <descriptors>
        <descriptor>src/main/assembly/boot.xml</descriptor>
    </descriptors>
    

    它成功了!

    【讨论】:

      【解决方案2】:

      我在使用 3.3 时遇到了同样的问题。标签descriptor 不能单独工作。标签 descriptorRefs 如果用于 ID。如果你使用文件,你需要在descriptors标签内使用descriptor标签内configuration标签内plugin标签内。 这是我的实际工作配置。

      <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <version>3.3.0</version>
          <configuration>
            <descriptors>
              <descriptor>assembly.xml</descriptor>
            </descriptors>
            <finalName>sofia-web-server-${project.version}</finalName>
          </configuration>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>single</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-05-30
        • 1970-01-01
        • 2016-07-17
        • 1970-01-01
        • 2011-11-16
        • 2014-07-31
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多