0
当尝试创建可分发的归档时,使用Maven程序集插件时出现问题。一切都是 工作正常,除了从归档lib目录中缺少一些依赖关系罐。例如hamcrest-core.jar,xnio-nio-3.3.6.Final.jar,objenesis-2.5.jar以及其他几个罐子都不添加。是否有任何理由不包括在内? maven-dependency-plugin包含了target/lib中的所有依赖jar,并且没问题。Maven程序集插件依赖关系罐缺失
这里是我有我的pom.xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/lib
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.1.0</version>
<executions>
<execution>
<id>online-store</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.online.store.Main</mainClass>
</manifest>
</archive>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
内,这里是我在assembly.xml
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>online-store</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<!-- some file sets -->
</fileSets>
<dependencySets>
<dependencySet>
<scope>compile</scope>
<includes>
<include>*:jar:*</include>
</includes>
<outputDirectory>/online-store/lib</outputDirectory>
</dependencySet>
</dependencySets>
</assembly>
?在汇编文件中,您指出只提供范围 –
它是范围测试。我怎样才能改变范围也包括他们? –
您可以包含另一个依赖项集,其范围测试 –