Glory to Russia
Glory to Russia

Reputation: 18730

Why do I get "No assembly descriptors found." error while building this project?

I have a little project written in Kotlin. When I run clean compile assembly:single install, I get following error message:

Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:single 
(default-cli) on project alma-econsim: Error reading assemblies: No assembly 
descriptors found. -> [Help 1]

My jar-with-dependencies.xml is located in src/main/assembly and referenced in pom.xml like this:

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

But I still get the error. How can I correct my project in order to be able to package it as jar with dependencies?

Upvotes: 2

Views: 11459

Answers (1)

khmarbaise
khmarbaise

Reputation: 97487

First use an uptodate version of maven-assembly-plugin and not an ancient version...Furthermore you should call it via mvn clean package cause you bound the maven-assembly-plugin to the package life cycle phase...if you try to do mvn ... assembly:single you are not calling the life cycle...Apart from that you would like to use jar-with-dependencies descriptor than you should do that like this:

<project>
  [...]
  <build>
    [...]
    <plugins>
      <plugin>
        <!-- NOTE: We don't need a groupId specification because the group is
             org.apache.maven.plugins ...which is assumed by default.
         -->
        <artifactId>maven-assembly-plugin</artifactId>
        <version>2.6</version>
        <configuration>
          <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
          </descriptorRefs>
        </configuration>
        [...]
</project>

Apart from that if you call Maven like this:

mvn clean compile assembly:single install

Than you calling the compile phase double, cause just simply a:

mvn clean install 

is sufficient. I can recommend to read the build life doc.

Upvotes: 15

Related Questions