简体   繁体   English

将家长文档包含到zip文件中

[英]Include parents documentation into zip-file

I have a multimodule maven project and I want to create an ZIP-File in the end which contains an .ear and the documentation. 我有一个多模块Maven项目,我想最后创建一个ZIP文件,其中包含一个.ear和文档。

The documentation is made with docbkx and is part of the parent. 该文档是使用docbkx制作的 ,是父文档的一部分。 The .ear file is made in a module. .ear文件在模块中创建。

My structure: 我的结构:

partent
|-src/docbkx
|-moduleEJB
|-moduleEAR

Where I am now? 我现在在哪里?

  1. I can create an ZIP including my ear (using mvn clean package ) 我可以创建一个包含耳朵的ZIP文件(使用mvn clean package
  2. I can create the PDF output of my documentation (using mvn clean site ) 我可以创建文档的PDF输出(使用mvn clean site

I want now to include the generated PDF of my documentation into my ZIP-file. 我现在想将生成的文档的PDF文件包含到我的ZIP文件中。 How can I achieve that? 我该如何实现? I tried to include the target directory of my parent project but nothing happened - which seems logical because when I run mvn clean package the documentation PDF isn't made as it's part of the pre-site lifecycle. 我试图包括父项目的目标目录,但没有发生任何事情-这似乎是合乎逻辑的,因为当我运行mvn clean package ,由于pre-site生命周期的一部分,未创建文档PDF。

This is my assembly.xml 这是我的assembly.xml

<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>bin</id>
  <formats>
    <format>zip</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>${project.build.directory}</directory>
      <includes>
        <include>*.ear</include>
      </includes>      
      <outputDirectory>/</outputDirectory>
    </fileSet>
    <fileSet>
      <directory>${parent.project.build.directory}/docbkx/pdf</directory>
      <includes>
        <include>*.pdf</include>
      </includes>      
      <outputDirectory>docs/</outputDirectory>
    </fileSet>        
  </fileSets>
</assembly>

This is the part of docbooks execution of my parent.pom: 这是我的parent.pom执行docbook的一部分:

            <executions>
                <execution>
                    <phase>pre-site</phase>
                    <goals>
                        <goal>generate-pdf</goal>
                    </goals>
                    <configuration>
                    </configuration>
                </execution>
            </executions>

Thanks in advance 提前致谢

edit: I also tried to change the phase of docbkx to compile but still nothing in my final zip. 编辑:我也试图更改docbkx的阶段以进行编译,但最终的zip文件中仍然没有任何内容。

I got it myself. 我自己弄的 As the parent project is the last to build I created a new project named documentation to create the PDF. 由于父项目是最后一个要构建的项目,因此我创建了一个名为documentation的新项目来创建PDF。 I then added this to the zip using a fileset 然后我使用文件集将此添加到zip中

<fileSet>
  <directory>${project.build.directory}/../../documentation/target/docbkx/pdf</directory>
  <includes>
    <include>*.pdf</include>
  </includes>      
  <outputDirectory>docs/</outputDirectory>
</fileSet> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 播放压缩文件中的音频文件 - Playing audio files packed in zip-File 在名为zip-file的文件夹中使用骆驼解压缩文件 - Unzip file using camel in folder named like zip-file 解压缩后打开/下载zip文件时出现问题(Java / ZipInputStream) - Problem opening/downloading zip-file after decompression (Java/ZipInputStream) 在Java中创建Zip文件而不使用byte [] - Create Zip-File in java without using byte[] 如何使用 Liferay 将多个文件下载为 zip 文件? - How to download multiple files as a zip-file using Liferay? Java:递归地将文件添加到zip文件但没有完整路径 - Java: Add files to zip-file recursively but without full path 为什么我在使用java.util.zip.ZipFile打开一个空的ZIP文件时遇到异常? - Why I get an Exception on opening an empty ZIP-file with java.util.zip.ZipFile? 如何从客户端计算机下载zip文件,而不是使用Java在浏览器中打开文件? - how to download zip-file from client machine instead of opening file in browser using java? Java-使用子文件夹从不同位置创建包含多个文件的Zip文件 - Java - Create Zip-file with multiple files from different locations with subfolders 使用 Java 从 S3 并行下载多个文件到一个 zip 文件 - Download multiple files in parallel to a zip-file from S3 using Java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM