title: difference: maven assembly:assembly versus assembly:single goals?
body: <p>I'm trying to build an alexa-app, with some annotations driven dependency injection (dagger 2) code. The <a href="https://github.com/amzn/alexa-skills-kit-java" rel="nofollow noreferrer">alexa-sample-skills-test</a> gives example pom and instructs to use the following command to build a jar with dependencies.</p>
  
  <pre><code>mvn assembly:assembly -DdescriptorId=jar-with-dependencies package
  </code></pre>
  
  <p>Building using the above fails with the exception and output listed in this <a href="https://stackoverflow.com/questions/36408706/java-lang-illegalstateexception-endpostable-already-set/36421345#36421345">link</a>. After a little digging into <a href="http://maven.apache.org/plugins/maven-assembly-plugin/" rel="nofollow noreferrer">maven docs</a>, I found out that the assembly:assembly goal uses non-standard build processes that can wreak havocs. The maven assembly-plugin docs instead, recommends to use the assembly:single goal. Hence, I use the following command instead:</p>
  
  <pre><code>mvn assembly:single -DdescriptorId=jar-with-dependencies package
  </code></pre>
  
  <p>Voila.. the code compilation and linking goes fine. I get a [project-name]-jar-with-dependencies.jar file. However, when I upload the jar in the amazon server and try to test the skill, the test fails. The log says that the class: echo.client.AccountInfoStreamHandler could not be found (ClassNotFoundException). This class just happens to a root launcher class, I suppose.</p>
  
  <p>Now, I nuke all the dagger 2 dependencies and repeat the same with the simplest code-base. The first maven command (assembly:assembly) works. The second maven command (assembly:single) fails with the same 'ClassNotFoundException' error. What am I doing wrong? I am not too familiar with maven, and this is really the FIRST time I'm trying to troubleshoot a maven command. Any suggestions, pointers, recommendations is greatly appreciated.</p>
  
  <p>For Reference, the POM file is below:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
    &lt;groupId&gt;com.apil.echo.accountant&lt;/groupId&gt;
    &lt;artifactId&gt;echo-device-client&lt;/artifactId&gt;
    &lt;packaging&gt;jar&lt;/packaging&gt;
    &lt;version&gt;1.0&lt;/version&gt;
    &lt;name&gt;Echo Device Client&lt;/name&gt;
  
    &lt;repositories&gt;
      &lt;repository&gt;
        &lt;id&gt;alexa-skills-kit-repo&lt;/id&gt;
        &lt;url&gt;file://${project.basedir}/repo&lt;/url&gt;
      &lt;/repository&gt;
      &lt;repository&gt;
        &lt;id&gt;Maven Central&lt;/id&gt;
        &lt;url&gt;http://repo1.maven.org/maven2/&lt;/url&gt;
      &lt;/repository&gt;
    &lt;/repositories&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.12&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;org.powermock&lt;/groupId&gt;
        &lt;artifactId&gt;powermock-module-junit4&lt;/artifactId&gt;
        &lt;version&gt;1.6.4&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.powermock&lt;/groupId&gt;
        &lt;artifactId&gt;powermock-api-mockito&lt;/artifactId&gt;
        &lt;version&gt;1.6.4&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
        &lt;artifactId&gt;jackson-core&lt;/artifactId&gt;
        &lt;version&gt;2.5.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
        &lt;artifactId&gt;jackson-annotations&lt;/artifactId&gt;
        &lt;version&gt;2.5.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
        &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
        &lt;version&gt;2.5.3&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
        &lt;groupId&gt;com.plaid&lt;/groupId&gt;
        &lt;artifactId&gt;plaid-java&lt;/artifactId&gt;
        &lt;version&gt;0.2.12&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;alexa-skills-kit&lt;/groupId&gt;
        &lt;artifactId&gt;alexa-skills-kit&lt;/artifactId&gt;
        &lt;version&gt;1.1&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
        &lt;artifactId&gt;jetty-server&lt;/artifactId&gt;
        &lt;version&gt;9.0.6.v20130930&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
        &lt;artifactId&gt;jetty-servlet&lt;/artifactId&gt;
        &lt;version&gt;9.0.6.v20130930&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;log4j&lt;/groupId&gt;
        &lt;artifactId&gt;log4j&lt;/artifactId&gt;
        &lt;version&gt;1.2.17&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
        &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
        &lt;version&gt;1.7.10&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
        &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
        &lt;version&gt;3.3.2&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.apache.directory.studio&lt;/groupId&gt;
        &lt;artifactId&gt;org.apache.commons.io&lt;/artifactId&gt;
        &lt;version&gt;2.4&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
        &lt;artifactId&gt;aws-lambda-java-core&lt;/artifactId&gt;
        &lt;version&gt;1.0.0&lt;/version&gt;
        &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.amazonaws&lt;/groupId&gt;
        &lt;artifactId&gt;aws-java-sdk-dynamodb&lt;/artifactId&gt;
        &lt;version&gt;1.9.40&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- using mockito for test --&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;org.mockito&lt;/groupId&gt;
        &lt;artifactId&gt;mockito-all&lt;/artifactId&gt;
        &lt;version&gt;1.9.5&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
        &lt;dependency&gt;
            &lt;groupId&gt;com.google.dagger&lt;/groupId&gt;
            &lt;artifactId&gt;dagger&lt;/artifactId&gt;
            &lt;version&gt;2.0&lt;/version&gt;
        &lt;/dependency&gt;
        &lt;dependency&gt;
            &lt;groupId&gt;com.google.dagger&lt;/groupId&gt;
            &lt;artifactId&gt;dagger-compiler&lt;/artifactId&gt;
            &lt;version&gt;2.0&lt;/version&gt;
            &lt;optional&gt;true&lt;/optional&gt;
        &lt;/dependency&gt;
  
    &lt;/dependencies&gt;
  
    &lt;properties&gt;
      &lt;property name="disableRequestSignatureCheck" value="false"/&gt;
      &lt;property name="supportedApplicationIds" value=""/&gt;
      &lt;property name="timestampTolerance" value="150"/&gt;
    &lt;/properties&gt;
  
    &lt;build&gt;
      &lt;pluginManagement&gt;
        &lt;plugins&gt;
          &lt;plugin&gt;
            &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
            &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.3&lt;/version&gt;
            &lt;configuration&gt;
              &lt;source&gt;1.7&lt;/source&gt;
              &lt;target&gt;1.7&lt;/target&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
            &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
            &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.2.1&lt;/version&gt;
            &lt;configuration&gt;
              &lt;mainClass&gt;Launcher&lt;/mainClass&gt;
              &lt;systemProperties&gt;
                &lt;systemProperty&gt;
                  &lt;key&gt;javax.net.ssl.keyStore&lt;/key&gt;
                  &lt;value&gt;/insert/your/path/java-keystore.jks&lt;/value&gt;
                &lt;/systemProperty&gt;
                &lt;systemProperty&gt;
                  &lt;key&gt;javax.net.ssl.keyStorePassword&lt;/key&gt;
                  &lt;value&gt;insert_your_password&lt;/value&gt;
                &lt;/systemProperty&gt;
                &lt;systemProperty&gt;
                  &lt;key&gt;com.amazon.speech.speechlet.servlet.disableRequestSignatureCheck&lt;/key&gt;
                  &lt;value&gt;${disableRequestSignatureCheck}&lt;/value&gt;
                &lt;/systemProperty&gt;
                &lt;systemProperty&gt;
                  &lt;key&gt;com.amazon.speech.speechlet.servlet.supportedApplicationIds&lt;/key&gt;
                  &lt;value&gt;${supportedApplicationIds}&lt;/value&gt;
                &lt;/systemProperty&gt;
                &lt;systemProperty&gt;
                  &lt;key&gt;com.amazon.speech.speechlet.servlet.timestampTolerance&lt;/key&gt;
                  &lt;value&gt;${timestampTolerance}&lt;/value&gt;
                &lt;/systemProperty&gt;
              &lt;/systemProperties&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
        &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>