Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I worked it out, and here are the details:</p> <p>First, there's no way to specify file includes or excludes if you use the built-in assembly descriptor jar-with-dependencies.</p> <p>The assembly plug-in documentation gives the sample <a href="http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#jar-with-dependencies" rel="nofollow noreferrer">jar-with-dependencies descriptor here</a>.</p> <p>I copied and pasted that descriptor to a file in my project directory called exec-jar.xml. Then in the pom, I changed the assembly plug-in to reference that descriptor. Here's the excerpt:</p> <pre><code>&lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt; &lt;version&gt;2.2-beta-3&lt;/version&gt; &lt;configuration&gt; &lt;descriptors&gt; &lt;descriptor&gt;exec-jar.xml&lt;/descriptor&gt; &lt;/descriptors&gt; &lt;archive&gt; &lt;manifest&gt; &lt;mainClass&gt;com.package.MyMainClass&lt;/mainClass&gt; &lt;/manifest&gt; &lt;/archive&gt; &lt;/configuration&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;make-assembly&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;single&lt;/goal&gt; &lt;/goals&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; </code></pre> <p>That bit of descriptor binds the assembly to the package phase of the life-cycle, and references the exec-jar.xml descriptor. Doing that package confirmed that the jar was built just as it was with the predefined descriptor.</p> <p>So then it becomes a matter of modifying exec-jar.xml to exclude the CXF files that conflict with the Spring files. Here is my assembly descriptor that accomplished that:</p> <pre><code>&lt;assembly&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;unpack&gt;true&lt;/unpack&gt; &lt;unpackOptions&gt; &lt;excludes&gt; &lt;exclude&gt;cxf*/META-INF/spring.handlers&lt;/exclude&gt; &lt;exclude&gt;cxf*/META-INF/spring.schemas&lt;/exclude&gt; &lt;/excludes&gt; &lt;/unpackOptions&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependencySet&gt; &lt;/dependencySets&gt; &lt;fileSets&gt; &lt;fileSet&gt; &lt;directory&gt;${project.build.outputDirectory}&lt;/directory&gt; &lt;/fileSet&gt; &lt;/fileSets&gt; &lt;/assembly&gt; </code></pre> <p>Now here's the rub. If you do this with the currently released assembly plug-in, version 2.1, it will fail on the tag as "unexpected." The tag is supported in unreleased version 2.2 of the plug-in. Note in my pom file excerpt above, I specify maven-assembly-plugin version 2.2-beta-3 which was the latest at the time of writing.</p> <p>This successfully built an executable jar, and Spring had all of the handlers and schemas it needed to initialize my app.</p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      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