49

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>
Roman Nikitchenko
  • 11,946
  • 7
  • 65
  • 101
  • Can you show the assembly descriptor? It will probably show that somehow you reference an absolute path (_/a/b/c_), which is something to avoid to ensure build portability across environments – Tome Feb 13 '15 at 13:29
  • Yes this is the case if you are creating a tar file which can't contain a filesystem-root entry...which btw. does not really make sense. – khmarbaise Feb 13 '15 at 13:29
  • 1
    As you can see the outputDirectory defines a `/` which would in consequence mean to extract all contens to always same location. Apart from that this location is limited to the root account. Furthermore the questions is why you use `fileSets` to get the `src/main/resources` folder? Special reason for that? – khmarbaise Feb 13 '15 at 18:16
  • Yes, this is resulting .tar.gz assembly so "/" has nothing to root account and `src/main/resources` does not go into resulting artifact JAR but goes to .tar.gz package which includes needed additional things like scripts. I just have never tried to not provide anything through ``. So @Torsten answer suits me 100%. – Roman Nikitchenko Feb 13 '15 at 23:33
  • 1
    Had to scratch that itch a few days ago so I thought I might as well share it. Glad I could help. – Torsten Feb 14 '15 at 22:34

3 Answers3

64

The working solution is to specify the empty outputDirectory:

<fileSets>
    <fileSet>
        <directory>${basedir}/src/main/resources</directory>
        <outputDirectory></outputDirectory>
    </fileSet>
</fileSets>
Torsten
  • 5,831
  • 1
  • 31
  • 29
44

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>
patforna
  • 681
  • 6
  • 8
6

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>
Barett
  • 5,226
  • 6
  • 46
  • 53