Note that there are some explanatory texts on larger screens.

plurals
  1. POmaven assembly plugin: control over directories
    text
    copied!<p>I'm trying to convert some groovy (gradle) code to maven. Where possible, we're trying to use off-the-shelf plugins rather than custom ones. </p> <p>We wanted to use the maven assembly plugin to assemble a tar file that we'll use for deployment. The directory structure is important for our deployment tools, and I seem to be fighting against getting maven to get it to do what I want. </p> <p>The key problem on the bottom code snippet is the fact that the jar ended up in a <code>target</code> directory in the tar file. My question is: can this be avoided? or should I cut my losses and write a simple custom plugin to do this?</p> <p>(its possible I'm putting 2 and 2 together and getting 5, but it does seem related to this bug <a href="http://jira.codehaus.org/browse/MASSEMBLY-45" rel="nofollow">here</a>)</p> <p>Directory structure (After running the build)</p> <pre><code>. └── project1 ├── config │   └── foo.config ├── pom.xml ├── src │   └── main │   ├── assembly │   │   └── assembly.xml │   └── java │   └── com │   └── foo │   └── bar │   └── App.java └── target ├── archive-tmp ├── classes │   └── App.class ├── maven-archiver │   └── pom.properties ├── my-static-jar-name-bundle.tar └── my-static-jar-name.jar </code></pre> <p>Assembly file</p> <pre><code>&lt;assembly&gt; &lt;id&gt;bundle&lt;/id&gt; &lt;formats&gt; &lt;format&gt;tar&lt;/format&gt; &lt;/formats&gt; &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt; &lt;fileSets&gt; &lt;fileSet&gt; &lt;directory&gt;${basedir}&lt;/directory&gt; &lt;outputDirectory&gt;/spooge&lt;/outputDirectory&gt; &lt;includes&gt; &lt;include&gt;**/*.jar&lt;/include&gt; &lt;/includes&gt; &lt;/fileSet&gt; &lt;fileSet&gt; &lt;directory&gt;${project.basedir}/config&lt;/directory&gt; &lt;outputDirectory&gt;appconfig&lt;/outputDirectory&gt; &lt;includes&gt; &lt;include&gt;**/*.config&lt;/include&gt; &lt;/includes&gt; &lt;/fileSet&gt; &lt;/fileSets&gt; &lt;/assembly&gt; </code></pre> <p>contents of the tar file when the build has finished (note the jar is in a 'target' subfolder)</p> <pre><code>tar xvf project1/target/my-static-jar-name-bundle.tar x spooge/target/my-static-jar-name.jar x appconfig/foo.config </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload