Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Error reading assemblies: No assembly descriptors found

Following this Guide I ran the command

mvn assembly:assembly

and got the Build Failure of

Error reading assemblies: No assembly descriptors found.

I've looked at numerous questions on this, but to no avail.

From this post, I created a .xml with this inside:

<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>jar-with-dependencies</id>
    <formats>
        <format>jar</format>
    </formats>
    <dependencySets>
        <dependencySet>
            <scope>runtime</scope>
            <unpack>true</unpack>
            <unpackOptions>
                <excludes>
                    <exclude>**/LICENSE*</exclude>
                    <exclude>**/README*</exclude>
                </excludes>
            </unpackOptions>
        </dependencySet>
    </dependencySets>
    <fileSets>
        <fileSet>
            <directory>${project.build.outputDirectory}</directory>
            <outputDirectory>${project.build.outputDirectory}</outputDirectory>
        </fileSet>
        <fileSet>
            <directory>src/main/resources/META-INF/services</directory>
            <outputDirectory>META-INF/services</outputDirectory>
        </fileSet>
    </fileSets>
</assembly>

and included this in the pom.xml:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-5</version>
    <configuration>
      <descriptors>
        <descriptor>jar-with-dependencies.xml</descriptor>
        </descriptors>
    </configuration>
  </plugin>

but still no luck.

I'm pretty new to this as you can probably tell, how can I get this running?

~~EDIT~~

In the pom.xml I changed

<descriptor>jar-with-dependencies.xml</descriptor>

To

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

~~EDIT 2~~

pom.xml now contains this:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-5</version>
    <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal>
        </goals>
        <configuration>
        <descriptors>
            <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
        </descriptors>
        </configuration>
        </execution>
        </executions>
</plugin>

~~EDIT 3~~

This pom.xml now works for me:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-5</version>
    <configuration>
        <descriptors>
            <descriptor>src/main/assembly/jar-with-dependencies.xml</descriptor>
        </descriptors>
        </configuration>
    <executions>
        <execution>
        <id>make-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal>
        </goals>
        </execution>
    </executions>
</plugin>
like image 494
MLMLTL Avatar asked Mar 26 '15 15:03

MLMLTL


1 Answers

For this to work, you need to create the file jar-with-dependencies.xml in src/main/assembly/ and this XML:

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

i.e. you need to specify the path to the file and the convention is to put the files into src/main/assembly/.

To use the ones provided by Maven, you need to use the descriptorRef element instead (wrapped in a descriptorRefs).

Also don't put the descriptor inside of the execution element or mvn assembly:assembly can't find it anymore (since you specifically moved it to the mvn package target).

[EDIT] I followed the tutorial myself and there is an important point which you might have missed: You need to select the correct archetype. In my case, that was 5 but the order can change. So read the whole list and look for the string openimaj-quickstart-archetype or things will break.

like image 164
Aaron Digulla Avatar answered Sep 23 '22 23:09

Aaron Digulla