Reputation: 1976
I'm currently working on a Maven based project in which I have unit tests that generate PDF files in, let's say "C:/result" directory (I definitely don't want these files to be created within any directory from my project).
Using the maven-assembly plugin, would it be possible to create an archive file (preferably zip or jar) that gathers the files that are thus generated in "C:/result"?
Basically, my goal would be to upload this archive as a regular artefact onto a Nexus server, every time I deploy a new version of my project.
Thx in advance.
Upvotes: 0
Views: 802
Reputation: 3119
You'd need to define an assembly descriptor similar to:
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory>C:/</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>results</directory>
<outputDirectory>./doc</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Save e.g. as src/assembly/bin.xml
, it will be referred from the pom.
The pom would contain in the build
section:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>out</id>
<configuration>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
</descriptors>
</configuration>
<phase>verify</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
see for more information maven assembly documentation.
Upvotes: 2