Я борюсь с maven за включение управляемой зависимости с «предоставленной» областью действия в файл tar с помощью maven-assembly-plugin.
Я использую pom-файл супер-родителей в качестве основы для всех своих проектов. Большинство проектов будут развернуты на сервере приложений, поэтому две общие зависимости объявлены в разделе «Родитель суперпопулярности». ниже это соответствующий раздел управления от супер-родителя:
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.integration</groupId>
<artifactId>super-parent</artifactId>
<packaging>pom</packaging>
<version>1.1.3</version>
<name>super parent</name>
<url>http://maven.apache.org.check</url>
.
.
.
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
log4j.version = 2.0.8
в одном из унаследованных проектов (который является автономным приложением), я использую плагин maven-assembly-Независимый для включения зависимых библиотек в файл tar. и, конечно же, я хочу также включить библиотеку log4j.
ниже помпа, унаследованная от супер-родителя:
<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">
<parent>
<groupId>com.xxx.integration</groupId>
<artifactId>super-parent</artifactId>
<version>1.1.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>plugin-cc-checker</artifactId>
<name>plugin-cc-checker</name>
<version>2.1</version>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<dependencies>
<dependency>
<groupId>com.orca.integration</groupId>
<artifactId>integration-assembly-descriptor</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>make-assembly-according-to-distribution-xml</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>${artifactId}</finalName>
<!-- This is where we use our shared assembly descriptor -->
<descriptors>
<descriptor>distribution-app.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>xerces</groupId>
<artifactId>xerces</artifactId>
<version>${xerces.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>${commons-logging-api.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>excalibur</groupId>
<artifactId>excalibur-i18n</artifactId>
<version>${excalibur-i18n.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.snmp4j</groupId>
<artifactId>snmp4j</artifactId>
<version>${snmp4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>runtime</scope>
</dependency>
</dependencies>
</project>
Файл distribution-app.xml:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<!-- Add module dependencies and the jar that is created in the packaging
phase. Product name will be <project name>-app-<version no>.tar -->
<id>app-${version}</id>
<formats>
<format>tar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>resources/app</directory>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<excludes>
<!-- Since there is a bug in xalan 2.7.1 all applications required to
use xalan-orca jar file -->
<exclude>xalan:xalan</exclude>
</excludes>
<!-- includes> <include>*</include> </includes-->
</dependencySet>
</dependencySets>
<moduleSets>
<moduleSet>
<binaries>
<outputDirectory>/guy</outputDirectory>
<includes>
<include>log4j:log4j</include>
</includes>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
Почему плагин maven-assembly-plug отказывается включать log4j в файл tar?
PS, попытка изменить область для компиляции не сработала. Я не могу изменить объявление в супер родительском пом.