Note that there are some explanatory texts on larger screens.

plurals
  1. POcorrect use of the exclude term in maven assembly plugin
    primarykey
    data
    text
    <p>short: I need to filter all <code>.java</code> files and every <code>META-INF</code> folder from a set of jars and package the class files and resources from that jars into one single jar. I currently use the <code>maven-assembly-plugin</code>, but would try something else as long as it can easily be integrated into a maven build process.</p> <p>long: I use maven to manage different stages of development for my tool. <sub>basic stage is freeware, second has some more features, third stage is all features)</sub></p> <p>That works fine so far, I use profiles to add the different source directories to the classpath and the sources are neatly compiled into the <code>project.jar</code>.</p> <ul> <li>First problem: The <code>.java</code> sources included into the project via the profiles end up in the <code>project.jar</code>.</li> </ul> <p>Then I use the <code>maven-assembly-plugin</code> to construct a <code>final.jar</code> that also contains the dependencies and in the end use launch4j to produce an executable for windows (the current target platform).</p> <ul> <li>Second problem: The various <code>META-INF</code> parts from the dependency jars mix in the <code>final.jar</code> and I would want them all to be skipped.</li> </ul> <p>I have searched for examples of the <code>assembly.xml</code> using the <code>&lt;exclude&gt;</code> tag, but did not find any that used my combination of <code>dependencySet</code> and <code>&lt;exclude&gt;*.java&lt;/exclude&gt;</code>. <sub>I'm not even positive that I can do that.</sub></p> <p>Here is my assembly.xml: </p> <pre><code>&lt;assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"&gt; &lt;id&gt;jar-with-dependencies&lt;/id&gt; &lt;formats&gt; &lt;format&gt;jar&lt;/format&gt; &lt;/formats&gt; &lt;includeBaseDirectory&gt;false&lt;/includeBaseDirectory&gt; &lt;dependencySets&gt; &lt;dependencySet&gt; &lt;outputDirectory&gt;/&lt;/outputDirectory&gt; &lt;useProjectArtifact&gt;true&lt;/useProjectArtifact&gt; &lt;unpack&gt;true&lt;/unpack&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;useDefaultExcludes&gt;true&lt;/useDefaultExcludes&gt; &lt;!--&lt;useTransitiveFiltering&gt;true&lt;/useTransitiveFiltering&gt;--&gt; &lt;!--&lt;useStrictFiltering&gt;true&lt;/useStrictFiltering&gt;--&gt; &lt;excludes&gt; &lt;exclude&gt;META-INF&lt;/exclude&gt; &lt;exclude&gt;**/*.java&lt;/exclude&gt; &lt;exclude&gt;*.java&lt;/exclude&gt; &lt;exclude&gt;*:sources&lt;/exclude&gt; &lt;/excludes&gt; &lt;/dependencySet&gt; &lt;/dependencySets&gt; &lt;/assembly&gt; </code></pre> <p>My research so far:</p> <p>I have googled with <code>example assembly.xml exclude java</code> but could not find examples that covered my problem. (I have also googled a lot the past days but did not save all I found) I have read <a href="http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html" rel="nofollow">http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html</a> but could not apply that knowledge to my problem.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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