title: Wrapping a java command line application with launch4j and maven
body: <p>I would like to wrap a java based command line app and all it's dependencies into a single *.exe file using maven and launch4j. </p>
  
  <p>Now I have read all similar questions on SO like <a href="https://stackoverflow.com/questions/6060560/trying-to-integrate-launch4j-in-a-maven-project-using-alakai-plugin">this one</a> and <a href="https://stackoverflow.com/questions/9285386/maven-shade-plugin-launch4j">this</a> but I can not get it to work.</p>
  
  <p>Can anybody supply a simple pom.xml snippet, how to achieve this with all needed dependencies.
  And by the way, what maven build goal should I run in Eclipses run configuration?</p>
  
  <p>Here is what I have copied from SO:</p>
  
  <pre><code>&lt;!-- Launch4j --&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-shade-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.4&lt;/version&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;shade&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
              &lt;configuration&gt;
                  &lt;shadedArtifactAttached&gt;true&lt;/shadedArtifactAttached&gt; &lt;!-- Make the shaded artifact not the main one --&gt;
                  &lt;shadedClassifierName&gt;shaded&lt;/shadedClassifierName&gt; &lt;!-- set the suffix to the shaded jar --&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.bluestemsoftware.open.maven.plugin&lt;/groupId&gt;
              &lt;artifactId&gt;launch4j-plugin&lt;/artifactId&gt;
              &lt;version&gt;1.5.0.0&lt;/version&gt;
              &lt;executions&gt;
  
                  &lt;!-- Command-line exe --&gt;
                  &lt;execution&gt;
                      &lt;id&gt;l4j-cli&lt;/id&gt;
                      &lt;phase&gt;package&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;launch4j&lt;/goal&gt;
                      &lt;/goals&gt;
                      &lt;configuration&gt;
                          &lt;headerType&gt;console&lt;/headerType&gt;
                          &lt;outfile&gt;target/importer.exe&lt;/outfile&gt;
                          &lt;jar&gt;target/${artifactId}-${version}-shaded.jar&lt;/jar&gt; &lt;!-- 'shaded' is the value set on shadedClassifierName above --&gt;
                          &lt;errTitle&gt;App Err&lt;/errTitle&gt;
                          &lt;classPath&gt;
                              &lt;mainClass&gt;${mainClass}&lt;/mainClass&gt;
                          &lt;/classPath&gt;                
                          &lt;jre&gt;
                              &lt;minVersion&gt;1.5.0&lt;/minVersion&gt;
                              &lt;maxVersion&gt;1.6.0&lt;/maxVersion&gt;
                              &lt;initialHeapSize&gt;128&lt;/initialHeapSize&gt;
                              &lt;maxHeapSize&gt;1024&lt;/maxHeapSize&gt;
                          &lt;/jre&gt;
                      &lt;/configuration&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
          &lt;/plugin&gt;  
  </code></pre>
  
  <p>when I run the <strong>launch4j:launch4j</strong> goal in Eclipse (if this is the correct one?) I get:</p>
  
  <blockquote>
    <p>Failed to execute goal
    org.bluestemsoftware.open.maven.plugin:launch4j-plugin:1.5.0.0:launch4j
    (default-cli) on project importer: The parameters 'headerType', 'jre'
    for goal
    org.bluestemsoftware.open.maven.plugin:launch4j-plugin:1.5.0.0:launch4j
    are missing or invalid -> [Help 1]</p>
  </blockquote>
  
  <p>Maybe I'm just launching the false goal ...</p>