Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to include dependency with 'provided' scope with maven-assembly-plugin
    primarykey
    data
    text
    <p>I am fighting with maven to include a managed dependency with 'provided' scope into tar file by using the maven-assembly-plugin.</p> <p>I use super parent pom file as a base for all of my projects. most of the projects will be deployed under application server so two common dependencies are declared under the super parent pom. below it is the relevant management section from the super parent:</p> <p> <pre><code>http://maven.apache.org/maven-v4_0_0.xsd"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;groupId&gt;com.xxx.integration&lt;/groupId&gt; &lt;artifactId&gt;super-parent&lt;/artifactId&gt; &lt;packaging&gt;pom&lt;/packaging&gt; &lt;version&gt;1.1.3&lt;/version&gt; &lt;name&gt;super parent&lt;/name&gt; &lt;url&gt;http://maven.apache.org.check&lt;/url&gt; . . . &lt;dependencyManagement&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;${junit.version}&lt;/version&gt; &lt;scope&gt;test&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;${log4j.version}&lt;/version&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/dependencyManagement&gt; </code></pre> <p>log4j.version=2.0.8</p> <p>in one of the inherited project (which is a standalone application), i am using maven-assembly-plugin with dependencySets in order to include the dependent libraries into a tar file. and of course I want also to include the log4j library. </p> <p>below is the pom inherited from super parent:</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;parent&gt; &lt;groupId&gt;com.xxx.integration&lt;/groupId&gt; &lt;artifactId&gt;super-parent&lt;/artifactId&gt; &lt;version&gt;1.1.3&lt;/version&gt; &lt;/parent&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;artifactId&gt;plugin-cc-checker&lt;/artifactId&gt; &lt;name&gt;plugin-cc-checker&lt;/name&gt; &lt;version&gt;2.1&lt;/version&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;com.orca.integration&lt;/groupId&gt; &lt;artifactId&gt;integration-assembly-descriptor&lt;/artifactId&gt; &lt;version&gt;1.1.1&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;make-assembly-according-to-distribution-xml&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;single&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;finalName&gt;${artifactId}&lt;/finalName&gt; &lt;!-- This is where we use our shared assembly descriptor --&gt; &lt;descriptors&gt; &lt;descriptor&gt;distribution-app.xml&lt;/descriptor&gt; &lt;/descriptors&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; &lt;/plugins&gt; &lt;/build&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;xerces&lt;/groupId&gt; &lt;artifactId&gt;xerces&lt;/artifactId&gt; &lt;version&gt;${xerces.version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;commons-logging&lt;/groupId&gt; &lt;artifactId&gt;commons-logging-api&lt;/artifactId&gt; &lt;version&gt;${commons-logging-api.version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;excalibur&lt;/groupId&gt; &lt;artifactId&gt;excalibur-i18n&lt;/artifactId&gt; &lt;version&gt;${excalibur-i18n.version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.snmp4j&lt;/groupId&gt; &lt;artifactId&gt;snmp4j&lt;/artifactId&gt; &lt;version&gt;${snmp4j.version}&lt;/version&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;log4j&lt;/groupId&gt; &lt;artifactId&gt;log4j&lt;/artifactId&gt; &lt;scope&gt;runtime&lt;/scope&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;/project&gt; </code></pre> <p>the distribution-app.xml file:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;assembly&gt; &lt;!-- Add module dependencies and the jar that is created in the packaging phase. Product name will be &lt;project name&gt;-app-&lt;version no&gt;.tar --&gt; &lt;id&gt;app-${version}&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;resources/app&lt;/directory&gt; &lt;outputDirectory&gt;/&lt;/outputDirectory&gt; &lt;/fileSet&gt; &lt;/fileSets&gt; &lt;dependencySets&gt; &lt;dependencySet&gt; &lt;outputDirectory&gt;/lib&lt;/outputDirectory&gt; &lt;excludes&gt; &lt;!-- Since there is a bug in xalan 2.7.1 all applications required to use xalan-orca jar file --&gt; &lt;exclude&gt;xalan:xalan&lt;/exclude&gt; &lt;/excludes&gt; &lt;!-- includes&gt; &lt;include&gt;*&lt;/include&gt; &lt;/includes--&gt; &lt;/dependencySet&gt; &lt;/dependencySets&gt; &lt;moduleSets&gt; &lt;moduleSet&gt; &lt;binaries&gt; &lt;outputDirectory&gt;/guy&lt;/outputDirectory&gt; &lt;includes&gt; &lt;include&gt;log4j:log4j&lt;/include&gt; &lt;/includes&gt; &lt;/binaries&gt; &lt;/moduleSet&gt; &lt;/moduleSets&gt; &lt;/assembly&gt; </code></pre> <p>Why maven-assembly-plugin refuse to include the log4j into the tar file? PS, trying to change scope to compile didn't work as well. I can'r change the declaration in the super parent pom.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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