如何使用maven-assembly-plugin更改moduleSet / sources的输出目录

时间:2015-11-27 14:33:42

标签: java maven maven-assembly-plugin

我想用moduleSet更改maven-assemble-plugin的输出目录。我试过moduleSet/sources/outputDirectory,但我得到一个奇怪的zip文件。

我的描述符:

<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

    <id>distribution</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>

    <moduleSets>
        <moduleSet>
            <useAllReactorProjects>true</useAllReactorProjects>
            <excludes>
                <exclude>*:test-distribution</exclude>
            </excludes>
            <sources>
                <includeModuleDirectory>false</includeModuleDirectory>
                <outputDirectory>sources</outputDirectory>
                <fileSets>
                    <fileSet>
                        <includes>
                            <include>src/**</include>
                        </includes>
                    </fileSet>
                </fileSets>
            </sources>
        </moduleSet>
    </moduleSets>
</assembly>

我的zip文件具有以下结构:

- test-distribution.zip
    - sources
        - src
             - main
             - test
        - target
        - pom.xml  (of first module)
    - src
        - main
        - test

/sources下是洞项目而不是src文件夹,/src下是源文件夹。

我想要的是:

- test-distribution.zip
    - sources
         - main
         - test

如何更改moduleSet/sources目录的名称?

1 个答案:

答案 0 :(得分:0)

使用fileSet/outputDirectoryfileSet/directory可以更改源目录的名称:

<head>
  <style>
    ...

    table.with-bg td.image-container {
      padding: 10px;
      background-color: white;
      background-image: -webkit-linear-gradient(left, #b6cae8, #ffffff);
      background-image: -moz-linear-gradient(left, #b6cae8, #ffffff);
      background-image: -o-linear-gradient(left, #b6cae8, #ffffff);  
      background-image: linear-gradient(#b6cae8, white);
      background: linear-gradient(#b6cae8, white);
    }
  </style>
</head>
<body link="#497cbe" vlink="#497cbe" alink="#497cbe">
    ...
        <td class="image-container" background="linear-gradient(#b6cae8, white);" bgcolor="transparent" valign="top" width="570" style="background-color: white; background-image: -webkit-linear-gradient(left, #b6cae8, #ffffff); background-image: -moz-linear-gradient(left, #b6cae8, #ffffff); background-image: -o-linear-gradient(left, #b6cae8, #ffffff);  background-image: linear-gradient(#b6cae8, white); background: linear-gradient(#b6cae8, white);">
          <!--[if gte mso 9]>
          <v:rect xmlns:v="urn:schemas-microsoft-com:vml" fill="true" stroke="false" style="width:570px;">
            <v:fill type="gradient" color="#ffffff" color2="#b6cae8" />
            <v:textbox style="mso-fit-shape-to-text:true" inset="0,0,0,0">
          <![endif]-->
    ...
</body>

但我不能说,sources/outputDirectory应该做什么。这个选项很奇怪。