如果你能帮助我解决这个问题,我会很高兴。
当我使用 maven < assembly > 插件将我的项目构建为 .zip 时。
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>dev</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
<include>/environments/dev/**/*.sh</include>
<include>/environments/dev/**/*.jil</include>
<include>/environments/dev/**/*.properties</include>
<include>/environments/dev/**/log4j2.xml</include>
</includes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
我收到以下文件结构:
build.zip----> environments__
|_DEV_
|_bin
|_properties
|_....
我的目标是:
在maven构建后得到以下文件结构:
build.zip---->
|_bin
|_properties
|_....
没有环境和 DEV 文件夹。
我已经阅读了 maven 文档(http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html),我们可以排除一些文件目录。这边走:
<assembly>
....
<fileSets>
<fileSet>
<directory>${basedir}</directory>
<includes>
....
</includes>
<excludes>
<exclude>/environments/dev</exclude>
</excludes>
</fileSet>
</fileSets>
<dependencySets>
<dependencySet>
<outputDirectory>/lib</outputDirectory>
<useProjectArtifact>true</useProjectArtifact>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
</assembly>
但这无济于事。我仍然有以前的文件结构。