我需要在Maven生成的jar的src / test / resource目录中包含一个zip文件。 知道怎么做吗?
答案 0 :(得分:0)
您应该将zip归档文件放在<html>
<body>
<div class="container">
<textarea>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam hendrerit rutrum finibus. Quisque tincidunt laoreet justo eget posuere. Quisque gravida imperdiet elit, ac volutpat tortor tempor placerat. Sed aliquam, metus ac vulputate varius, arcu diam pulvinar tortor, vel congue massa odio sed sem. Fusce auctor neque non nisl lobortis, nec vehicula nulla malesuada. Vestibulum pellentesque odio tempus, tincidunt augue hendrerit, venenatis libero. Pellentesque convallis luctus rutrum. Nunc vel mauris sit amet nibh laoreet hendrerit vitae vel tellus. Phasellus gravida dui ac venenatis aliquet.
Proin pulvinar pellentesque lorem, a imperdiet massa pulvinar eget. Quisque vitae est lorem. Maecenas porttitor quis dui sit amet ultricies. Phasellus accumsan, augue ac ornare tincidunt, eros diam sollicitudin enim, id vehicula quam justo quis leo. Aliquam at turpis est. Praesent rutrum felis eget justo suscipit finibus et nec enim. Quisque sed eleifend velit, eget fringilla purus. Nunc imperdiet metus luctus laoreet porttitor.
</textarea>
</div>
</body>
</html>
目录中,而不是src / test / resource中。
如果您想拥有更多控制权,请查看Maven资源插件文档:https://maven.apache.org/plugins/maven-resources-plugin/index.html
答案 1 :(得分:0)
根据isapir's answer中的建议,如果需要将压缩文件包含在jar文件中,则最好将其放在src/main/resource
下。但是,如果您确实需要从src/test/resource
文件夹中添加它,则可以按以下方式使用build-helper-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-resource</id>
<phase>generate-resources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<include>ABC.zip</include>
<directory>src/test/resource</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>