Maven assembly plugin warning "The assembly descriptor contains a filesystem-root relative reference"

MavenCross PlatformMaven 3Maven Assembly-Plugin

Maven Problem Overview


Starting from some assembly plugin version maven builds issue the following warning:

> [WARNING] The assembly descriptor contains a filesystem-root relative > reference,which is not cross platform compatible /

Is there any recommended ready-to-use solution for this? Direct googling provided me with lot of trash and no real help. Re-check of Maven assembly plugin help did not provide answer for me, maybe someone else has better search skill and can help.

UPDATE

Yes, this is probably because of Linux-like outputDirectory but how should I rewrite this to be portable? Looked at assembly plugin documentation and not found any portability guide.

<fileSets>
    <fileSet>
        <directory>${basedir}/src/main/resources</directory>
        <outputDirectory>/</outputDirectory>
    </fileSet>
</fileSets>

Maven Solutions


Solution 1 - Maven

The working solution is to specify the empty outputDirectory:

<fileSets>
    <fileSet>
        <directory>${basedir}/src/main/resources</directory>
        <outputDirectory></outputDirectory>
    </fileSet>
</fileSets>

Solution 2 - Maven

Using an empty outputDirectory element works, but I wouldn't be surprised if somebody assumed it could be safely deleted.

So, to be more explicit, you could also avoid the warning by writing:

<outputDirectory>${file.separator}</outputDirectory>

Solution 3 - Maven

Note that this can happen at other locations besides just /. The above answers are correct, but don't cover this case.

Look for something like this in your assembly.xml:

<fileSets>
    <fileSet>
        <directory>${basedir}/src/main/resources</directory>
        <outputDirectory>/lib</outputDirectory>         <!-- <<< look for this -->
    </fileSet>
</fileSets>

and change to this:

<fileSets>
    <fileSet>
        <directory>${basedir}/src/main/resources</directory>
        <outputDirectory>lib</outputDirectory>
    </fileSet>
</fileSets>

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionRoman NikitchenkoView Question on Stackoverflow
Solution 1 - MavenTorstenView Answer on Stackoverflow
Solution 2 - MavenpatfornaView Answer on Stackoverflow
Solution 3 - MavenBarettView Answer on Stackoverflow