Maven Assembly Plugins corrupts exe dll - dll

I'm trying to create a zip file containing, among other stuff of my Java project, a .NET x64 EXE + its manifest + a .NET DLL dependency. It looks like maven assembly plugin corrupts the EXE and the DLL. In fact if I try to execute the file once extracted I get "This app can't run on this PC" (invalid x64 windows application), but if I copy the original files they work normally.
I've tried to google for a solution without success. Am I missing something in maven files?
Plugin declaration in pom.xml is:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/windows.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<finalName>${bundle.name}</finalName>
</configuration>
</execution>
</executions>
</plugin>
while windows.xml content is:
<?xml version="1.0"?>
<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>windows</id>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>${launcher.dir}/GetMachineId.exe</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>GetMachineId.exe</destName>
</file>
<file>
<source>${launcher.dir}/GetMachineId.exe.config</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>GetMachineId.exe.config</destName>
</file>
<file>
<source>${launcher.dir}/MessagingToolkit.QRCode.dll</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>MessagingToolkit.QRCode.dll</destName>
</file>
</files>
</assembly>

Found the issue.
I was actually using also maven-resources-plugin on ${launcher.dir} with filtering.
Excluding binary files from filtering solved the problem.
UPDATE:
In my pom.xml the maven-resources-plugin was configured like in the following:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>filtering-launcher-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${launcher.dir}</outputDirectory>
<resources>
<resource>
<directory>src/main/launcher</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
With src/main/launcher erroneously containing both text file (that actually required filtering) and binary ones (GetMachineId.exe, GetMachineId.exe.config, MessagingToolkit.QRCore.dll).
In order to solve the problem I've moved those binaries in a different folder (utils) and modified the assembly file like this:
<?xml version="1.0"?>
<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>windows</id>
<formats>
<format>zip</format>
</formats>
<files>
<file>
<source>utils/GetMachineId.exe</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>GetMachineId.exe</destName>
</file>
<file>
<source>utils/GetMachineId.exe.config</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>GetMachineId.exe.config</destName>
</file>
<file>
<source>utils/MessagingToolkit.QRCode.dll</source>
<outputDirectory>bin/utils</outputDirectory>
<destName>MessagingToolkit.QRCode.dll</destName>
</file>
<file>
<source>${launcher.dir}/config.xml</source>
<outputDirectory>bin</outputDirectory>
<destName>config.xml</destName>
</file>
</files>
</assembly>
This way maven-resources-plugin does not process with filtering the binaries, so they do not get corrupted. It looks like the filtering process treats always the files like they are text ones, so it modifies binaries in such a way that prevents their execution.
Another, more recent, strategy could be this one: https://maven.apache.org/plugins/maven-resources-plugin/examples/binaries-filtering.html

I've found an easier solution modifying the pom.xml just using the excludes and includes tags at resources -> resource.
Example:
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.dll</exclude>
</excludes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.dll</include>
</includes>
</resource>
</resources>

Related

how to avoid UTF-8 encoding for binary with maven-resources-plugin?

I'm using the maven-resources-plugin to copy some resources from my project but one of my resources is a binary file. The output says it is Using 'UTF-8' encoding to copy filtered resources which I my problem!!!
Here is my plugin configuration.
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/autopublisher</outputDirectory>
<resources>
<resource>
<directory>src/autopublisher</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
Can I skip the UTF-8 conversion for binaries?
Thank you.
Well to solve my problem I added this to my configuration maven binary filtering:
<nonFilteredFileExtensions>
<nonFilteredFileExtension>dcm</nonFilteredFileExtension>
</nonFilteredFileExtensions>
Set up two separate <resource> elements, one with <filtering>false</filtering> and the other with <filtering>true</filtering>. Use the <includes> and <excludes> elements of <resource> to exclude your binary files by extension from one of them.
The resources plugin is however getting smarter about excluding e.g. images by default, so make sure you use the latest version.
I came across similar situation where a binary file (well a mix of txt and binary data) was inadvertently processed by the plugin, making it unusable at the end.
To solve this, I just had to make filtering a bit more explicit as to which types of file to filter and keeping all others, untouched, see below:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>filter-config-files</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/config-filtered</outputDirectory>
<resources>
<resource>
<directory>${project.build.directory}/nar/${project.name}-${project.version}-noarch</directory>
<!-- enabling filetering ONLY on these file types -->
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
<include>**/*.sh</include>
</includes>
</resource>
<resource>
<directory>${project.build.directory}/nar/${project.name}-${project.version}-noarch</directory>
<!-- now excluding filtering on ALL OTHER file types but still including them in the archive -->
<filtering>false</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
For a compiled binary that had no extension (it gets launched on the RHEL build server for some component tests), added a file extension for the Linux version it was intended to run under and used code-gijoe's answer above to ensure that maven did not "filter" it:
<nonFilteredFileExtensions>
<nonFilteredFileExtension>rhel</nonFilteredFileExtension>
</nonFilteredFileExtensions>

Renaming resources in Maven

I am trying to find a way to copy a resource file to a new name in the target directory in a Maven build. Pretty much everything I have found while searching suggests workarounds involving multiple sub-directories in /src/main/resources and selecting among them via profiles. However, in my case, this does not solve the problem, namely that the file I want has a "magic" name.
Basically what I want to do is have a /src/main/resources/default.DS_Store file get copied to ${project.build.directory}/.DS_Store. Since the .DS_Store file has special meaning in Mac OSX, it is not desirable to have a file with that name in the source tree, and in version control. However, I do want the data in the file to be in the source tree and version control, and have it renamed to the "magic" name during the build.
I'm starting to think that ant is the only way to do this automatically. Is there any easier way?
Using the antrun-maven-plugin makes it easy, but in case you are looking for a more mavenish way which is supported within eclipse m2e, then you can use the copy-rename-maven-plugin
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>rename-file</id>
<phase>compile</phase>
<goals>
<goal>rename</goal>
</goals>
<configuration>
<sourceFile>${project.build.outputDirectory}/default.DS_Store</sourceFile>
<destinationFile>${project.build.outputDirectory}/.DS_Store</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
And in case you have any feedback/issues with the plugin, you can reach out at https://github.com/coderplus/copy-rename-maven-plugin/
Example usage of the assembly plugin to copy and/or rename a file:
pom file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptors>
<descriptor>src/main/descriptors/example.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</project>
Descriptor file:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>example</id>
<formats>
<format>dir</format>
</formats>
<files>
<file>
<source>src/main/resources/something.properties</source>
<outputDirectory>/</outputDirectory>
<destName>something.properties</destName>
</file>
<file>
<source>src/main/resources/something.properties</source>
<outputDirectory>/</outputDirectory>
<destName>something_en.properties</destName>
</file>
</files>
</assembly>
I had the same problem using the copy-rename-maven-plugin solved my problem
<project>
...
<build>
<plugins>
<plugin>
<groupId>com.coderplus.maven.plugins</groupId>
<artifactId>copy-rename-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>copy-file</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<sourceFile>src/someDirectory/test.environment.properties</sourceFile>
<destinationFile>target/someDir/environment.properties</destinationFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I see 2 options to solve your problem:
Use the Maven-Ant-Plugin, and define an Ant rename task that will rename your file only at the packaging phase, in the build directory.
Use this dedicated Maven plugin (I didn't test it): http://code.google.com/p/maven-file-rename-plugin/
You can avoid the over head of Ant by using the Maven Assembly plugin and the file assembly descriptor.

maven-assembly plugin - how to create nested assemblies

I have a project whereby I'm trying to create a distribution zip file, which contains (amongst other files) an executable jar with dependencies of my java project.
So I sort of want it to look like this:
-wiki-search-1.0.0-dist.zip
-wiki-search.bat
-wiki-search-help.html
-wiki-search-1.0.0-jar-with-dependencies.jar
-jar content...
I'm using the assembly plugin, and the predefined descriptor "jar-with-dependencies" to create my executable jar file.
I'm specifying a separate assembly plugin entry in my pom, referencing a custom descriptor to try and build the distributable zip file.
So the part of my pom looks like this:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>quicksearch.QuickSearchApp</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
And my custom descriptor looks like this:
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>${project.basedir}/target/wiki-search-0.0.1-SNAPSHOT-jar-with-dependencies.jar</include>
</includes>
<outputDirectory>.</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/etc</directory>
<includes>
<include>*</include>
</includes>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
Everything works fine. The jar-with-dependencies is being built. My dist zip file is being built. But the dist zip file does not contain the jar-with-dependencies file.
With your existing configuration, your two separate configurations for the assembly plugin will be merged, and the configurations will also be merged.
To achieve your goal you should define a single assembly-plugin configuration with multiple nested executions, then define the configuration for each execution inside it. The assembly plugin will then execute each assembly sequentially, so the jar-with-dependencies jar will be available for inclusion in the dist jar. Also note the attached goal is deprecated in favour of the single goal.
Also note that paths in the assembly are relative to the root, and to include a particular file you should use the <files> element rather than the <filesets> element. You can also specify properties in the assembly to make it less fragile to change.
The rearranged configuration and assembly below should do what you're after:
Assembly descriptor:
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<files>
<file>
<source>
target/${project.artifactId}-${project.version}-jar-with-dependencies.jar
</source>
<outputDirectory>/</outputDirectory>
</file>
</files>
<fileSets>
<fileSet>
<directory>${project.basedir}/src/main/resources</directory>
<includes>
<include>*</include>
</includes>
<outputDirectory>/</outputDirectory>
</fileSet>
</fileSets>
</assembly>
Assembly plugin:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>jar-with-dependencies</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>quicksearch.QuickSearchApp</mainClass>
</manifest>
</archive>
</configuration>
</execution>
<execution>
<id>dist</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
You have two different configurations for the assembly plug-in, and you want them to be run in order (jar before zip), but I don't think Maven implies any order in how this will be resolved. My guess is that the zip file is being generated before the JAR file.
Even if that is not the case, I would suggest you create one module per artifact. Move the JAR assembly into its own module and have the now Zip-only module depend on it. That way Maven's dependency order resolution can kick in and build them in order.

Module:referencing another module from the desciptor

My assembly descriptor for module (APP1) is:
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>report</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<includes>
<include>*-APP2</include>[trying to refer to another module ie module-APP2]
</includes>
<sources>
<fileSets>
<fileSet>
<directory>/</directory>
<includes>
<include>**/target</include>
</includes>
</fileSet>
</fileSets>
<excludeSubModuleDirectories>false</excludeSubModuleDirectories>
<outputDirectoryMapping>/</outputDirectoryMapping>
</sources>
</moduleSet>
</moduleSets>
</assembly>
When I am running the mvn install cmd , I'm getting
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o '*-APP2'
where have I gone wrong?
I modified as :
<?xml version="1.0" encoding="UTF-8"?><assembly>
<id>report</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<includes>
<include>sampleMaven:module-APP2</include>
</includes>
<sources>
<fileSets>
<fileSet>
<directory>/</directory>
<includes>
<include>target/*</include>
</includes>
</fileSet>
</fileSets>
<excludeSubModuleDirectories>false</excludeSubModuleDirectories>
<outputDirectoryMapping>/</outputDirectoryMapping>
</sources>
</moduleSet>
</moduleSets>
</assembly>
still getting :
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o 'sampleMaven:module-APP2'
Updated on 18/sep:
Main proj pom.xml-->
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
sampleMaven
anu
0.0.1-SNAPSHOT
pom
APP1
<module>APP2</module>
2)For APP1, the pom.xml is-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
anu
sampleMaven
0.0.1-SNAPSHOT
4.0.0
sampleMaven
APP1
APP1
0.0.1-SNAPSHOT
pom
../APP2
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-3</version>
<executions>
<execution>
<id>assemblyone</id>
<phase>compile</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>App1</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>${basedir}/src/main/resources/assemblies/report.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> ...
3)Assembly descriptor is -->
report
jar
false
<sources>
<fileSets>
<fileSet>
<directory>/</directory>
<includes>
<include>target/*</include>
</includes>
</fileSet>
</fileSets>
<excludeSubModuleDirectories>false</excludeSubModuleDirectories>
<outputDirectoryMapping>/</outputDirectoryMapping>
</sources>
<binaries>
<outputDirectory>
${module.artifactId}-${module.version}
</outputDirectory>
<dependencySets>
<dependencySet/>
</dependencySets>
</binaries>
</moduleSet>
On running gettting-->Error stacktrace:
org.apache.maven.project.DuplicateProjectException: Project 'sampleMaven:APP2' is duplicated in the reactor
Update: The Maven book has a section on including moduleSets in assemblies. The approach you have in your example is deprecated. There is also a problem with build order when defining moduleSets from the parent. The parent must be built first so the child can inherit from it, but the child must be built so that the parent can includ it in its assembly.
The following approach addresses that cycle.
Define a parent pom that references an assembly module.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>name.seller.rich</groupId>
<artifactId>test-parent</artifactId>
<packaging>pom</packaging>
<version>1.0.0</version>
<modules>
<module>test-assembly</module>
</modules>
<dependencies>
</project>
In the assembly module, define a module with a relative path to the actual application module(s), and define the assembly plugin configuration:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>name.seller.rich</groupId>
<artifactId>test-assembly</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
<modules>
<module>../my-app2</module>
</modules>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-4</version>
<executions>
<execution>
<id>assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<finalName>App1</finalName>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/main/assembly/my-assembly.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and my-assembly.xml is defined as follows:
<?xml version="1.0" encoding="UTF-8"?><assembly>
<id>my-assembly</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<moduleSets>
<moduleSet>
<binaries>
<outputDirectory>
${module.artifactId}-${module.version}
</outputDirectory>
<dependencySets>
<dependencySet/>
</dependencySets>
</binaries>
</moduleSet>
</moduleSets>
</assembly>
Building the parent module will then result in a build order of:
test-parent
my-app2
test-assembly
So when the assembly comes to be packaged, my-app2 is built, and is available for inclusion. The binaries declaration will include the jars.
I am still looking a solution to build a mutli module application, and I think I am almost there !!! :-)
The trick is to build a seperate module and don't add it to parent because you want to build your parent (which builds all modules) and then invoke the assembly.
I got a zip file that contains all i need, only the executable jar doesn't include sources... but I'll try to figure it out asap. If I can make it work, I'll paste the solution here :)
Peace

Maven creating flat zip assembly

To Maven gurus out there:
I'm trying to package non-java project artifacts (.NET) into a single zip file. I'm having 2 problems:
If I change packaging in my POM to zip <packaging>zip</packaging>, I get this error message: [INFO] Cannot find lifecycle mapping for packaging: 'zip'.
Component descriptor cannot be found in the component repository: org.apache.mav
en.lifecycle.mapping.LifecycleMappingzip. OK, no big deal - I changed it to <packaging>pom</packaging> to get rid of useless jar that is otherwise created in the target dir
My main problem is that files I'm packaging into ZIP are nested within few directories but I need put these into top directory of ZIP. Here's my assembly file:
<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${basedir}/${project.artifactId}</directory>
<includes>
<include>**/Bin/Release/*.dll</include>
<include>**/Bin/Release/*.pdb</include>
</includes>
</fileSet>
</fileSets>
</assembly>
When I run this - I'll get ZIP file but files will be nested starting with C:\ followed by full path. To give you idea - project dumps it's binaries into the following structure
ProjectFoo\ProjectFoo\subproject1\Bin\Release\foo.dll and I need ZIP\foo.dll
Here's assembly plugin configuration:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>zip</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
Maybe I just need to use antrun and execute ant zip task?
As you've seen, there isn't a zip packaging type, so it makes sense to use pom packaging as you've chosen to.
You've encountered a bit of a hole in the assembly plugin's processing. You could resolve this by specifying multiple fileSets in the assembly with <outputDirectory>/<outputDirectory>, one for each directory you want to include, this is obviously a PITA, and probably not an acceptable solution.
An alternative approach is to use the Ant copy task to copy all the DLLs into a staging directory, then include that directory in the assembly.
The following configuration should do what you're after:
The antrun-plugin configuration:
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<phase>process-resources</phase>
<configuration>
<tasks>
<copy todir="${project.build.directory}/dll-staging">
<fileset dir="${basedir}/${project.artifactId}">
<include name="**/Bin/Release/*.dll"/>
<include name="**/Bin/Release/*.pdb"/>
</fileset>
<flattenmapper/>
</copy>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
The assembly:
<assembly>
<id>bin</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.build.directory}/dll-staging</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.dll</include>
<include>*.pdb</include>
</includes>
</fileSet>
</fileSets>
</assembly>