You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Grigglestone <da...@gmail.com> on 2020/10/15 02:52:57 UTC

maven-assembly-plugin Windows vs Linux

https://stackoverflow.com/questions/64364051/maven-assembly-plugin-windows-vs-linux 
.. sorry to post in two places, but hoping to get someones attention :-[ ...

I have a project that uses the maven-assembly-plugin and I see a 
difference in behavior when building on Linux vs Windows. Exactly the 
same pom.xml and assembly.xml are used on each platform.

Windows:

mvn logging looks like this:

|[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ foo --- [INFO] 
Building jar: C:\foo\target\foo.jar [INFO] [INFO] --- 
maven-assembly-plugin:3.1.0:single (default) @ foo --- [INFO] Reading 
assembly descriptor: assembly.xml [INFO] Copying files to 
C:\foo\target\foo [WARNING] Assembly file: C:\foo\target\foo is not a 
regular file (it may be a directory). It cannot be attached to the 
project build for installation or deployment. |

And in the target directory I observe a directory C:\foo\target\foo 
which contains all the project's dependent jars.

Linux:

mvn logging looks like this:

|[INFO] --- maven-jar-plugin:3.1.0:jar (default-jar) @ foo --- [INFO] 
Building jar: /home/<user>/foo/target/foo.jar [INFO] [INFO] --- 
maven-assembly-plugin:3.1.0:single (default) @ foo --- [INFO] Reading 
assembly descriptor: assembly.xml [INFO] Copying files to 
/home/<user>/foo/target/foo-1.0.0001 [WARNING] Assembly file: 
/home/<user>/foo/target/foo-1.0.0001 is not a regular file (it may be a 
directory). It cannot be attached to the project build for installation 
or deployment. |

But in the target directory there is no directory target/foo (nor 
target/foo-1.0.001)

I should note that a downstream project is expecting the target/foo 
directory to exist which is why I'm investigating the difference in 
behavior between Windows and Linux.

This is plugin definition in my pom:

|<plugin> <artifactId>maven-assembly-plugin</artifactId> <executions> 
<execution> <phase>package</phase> <goals> <goal>single</goal> </goals> 
<configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> 
<descriptor>assembly.xml</descriptor> </descriptors> </configuration> 
</execution> </executions> </plugin> |

and this is the assembly descriptor:

|<assembly 
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.0" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/3.1.0 
http://maven.apache.org/xsd/assembly-3.1.0.xsd"> <id>tar</id> <formats> 
<format>dir</format> </formats> 
<includeBaseDirectory>false</includeBaseDirectory> <files> <file> 
<source>${project.build.directory}/${project.artifactId}.jar</source> 
<outputDirectory>./</outputDirectory> </file> </files> <dependencySets> 
<dependencySet> <unpack>false</unpack> <excludes> 
<exclude>${artifact}</exclude> </excludes> </dependencySet> 
</dependencySets> </assembly> |

I have tried tinkering with finalName in both the <configuration> and 
<build> sections to no avail and have also tried more recent versions of 
the plugin.

*The urgent question is why does a build on Windows give me the 
target\foo directory with the dependencies in, whilst after a build on 
Linux I don't see the equivalent ?*

Thanks very much for getting this far :-)