我正在尝试使用程序集maven插件.zip我的项目.jars和一些配置文件.zip我的项目 .
我希望JAR从模块 admin
batch_base_to_base
batch_engine
batch_generic
和一些文件到 misc
我的问题是我的程序集不接受我的配置文件,它确实占用了我的所有jar包括依赖项jar . 在我的项目结构和我的POM和汇编描述符下面 .
这是我的项目结构:
assembly-dr3.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>bin</id>
<formats>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<useAllReactorProjects>true</useAllReactorProjects>
<includes>
<include>com.mycompany.dr3:batch_engine</include>
<!-- for test but it still includes below modules
<include>com.mycompany.dr3:admin</include>
<include>com.mycompany.dr3:batch_generic</include>
<include>com.mycompany.dr3:batch_base_to_base</include>
-->
</includes>
<sources>
<fileSets>
<fileSet>
<directory>${project.basedir}/misc</directory>
<includes>
<include>configuration.json</include>
<include>environment_placeholders.json</include>
</includes>
</fileSet>
</fileSets>
</sources>
<binaries>
<outputDirectory>modules/maven-assembly-plugin</outputDirectory>
<unpack>false</unpack>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.mycompany.dr3</groupId>
<artifactId>dr3</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>dr3-package</artifactId>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptor>assembly-dr3.xml</descriptor>
</configuration>
<executions>
<execution>
<id>create-archive</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
1 回答
当我只想压缩文件夹子集时,我遇到了类似的问题 . 我的解决方案是直接使用
maven-antrun-plugin
完全按照你的意愿行事 . 就像是:我通常将此插件放在maven配置文件中,仅在需要时启动它 .