Maven assembly - Error reading assemblies

前端 未结 2 2019
温柔的废话
温柔的废话 2020-12-10 01:10

I have defined a personalized jar-with-dependencies assembly descriptor. However, when I execute it with mvn assembly:assembly, I get :

...
[INFO] META-INF/          


        
相关标签:
2条回答
  • 2020-12-10 01:44

    There are two problems here. First, when using your own descriptor, you must specify the path to your customized descriptor file (by the way, you can use any location but putting the descriptor in src/main/resources is maybe not the best choice, you don't really want the descriptor to be packaged in your application, I'd use the standard location which is src/main/assembly as mentioned in this page).

    <descriptors>
      <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
    </descriptors>
    

    Second, your configuration element is currently inside an execution block and is thus specific to this execution. In other words, it won't apply if you run assembly:assembly on the command line. So, if you want to call assembly:assembly with a custom descriptor, either use:

    mvn assembly:assembly -Ddescriptor=path/to/descriptor.xml
    

    Or move the configuration outside the execution element (to make the configuration global):

    <project>
      ...
      <build>
        ...
        <plugins>
          <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2-beta-5</version>
            <configuration>
              <descriptors>
                <descriptor>path/to/descriptor.xml</descriptor>
              </descriptors>
              ...
            </configuration>
          </plugin>
         </plugins>
         ...
       </build>
       ...
    </project>
    
    0 讨论(0)
  • 2020-12-10 02:01

    assembly is trying to open /assemblies/${ref}.xml in classpath check this

    http://maven.apache.org/plugins/maven-assembly-plugin/xref/org/apache/maven/plugin/assembly/io/DefaultAssemblyReader.html

    0 讨论(0)
提交回复
热议问题