Maven assembly plugin: Failed to retrieve numeric file attributes using: '/bin/sh -c ls -1nlaR
Asked Answered
H

4

6

I am running parallels with Debian on my OSX 10.7.5 and I have linked a directory with Java sources from OSX to the virtual Debian machine (using Parallels tools, which mount directories to /media/psf/).

Compilation works correctly, only problem I have is with Maven Assembly plugin: which complains:

Failed to retrieve numeric file attributes using: '/bin/sh -c ls -1nlaR

I googled following issue: http://jira.codehaus.org/browse/MASSEMBLY-588

They suggest using <directory>${baseDir}</directory> in jarlib.xml. With this modification, the code compiles, but when checking the contents with jar tf file.jar, it is completely missing all the compiled sources, only maven libraries are added.

The file, which works correctly on local filesystem is:

<assembly>
  <id>jar-with-dependencies</id>
  <formats>
    <format>jar</format>
  </formats>
  <includeBaseDirectory>false</includeBaseDirectory>
  <fileSets>
    <fileSet>
      <directory>target/classes</directory>
      <outputDirectory>/</outputDirectory>
    </fileSet>
  </fileSets>
  <dependencySets>
    <dependencySet>
      <outputDirectory>/lib</outputDirectory>
      <unpack>false</unpack>
      <scope>runtime</scope>
    </dependencySet>
  </dependencySets>
</assembly>

Is there a way to overcome this issue?

Edit:

Apache Maven 2.2.1 (rdebian-4)
Java version: 1.6.0_26
Java home: /usr/lib/jvm/java-6-sun-1.6.0.26/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.32-5-amd64" arch: "amd64" Family: "unix"
Hellbox answered 26/11, 2012 at 15:33 Comment(3)
Which Maven version? Which Java Version? You know that creating a jar which contains a sub folder lib is not supported by Java? Or what you like to achieve? May be you can elaborate a little bit more what you like to do?Mitran
Maven and Java version added above. I am not sure whether it is supported, but if I use the assembly plugin on local filesystem, everything works correctly. I would just like to assembly my project with mvn assembly:assembly.Catcall
You missed the version of the maven-assembly-plugin ? May be you can add the pom you are using?Mitran
R
2

/bin/sh -c ls -1nlaR {directory_structure/file}
I resolved it by renaming folder which was having Apostrophe(') in directory_structure.

This problem is created because maven assembly while executing command /bin/sh -c ls -1nlaR {directory_structure/file} not escaping the Apostrophe(').

Rathbun answered 17/9, 2016 at 22:59 Comment(0)
M
1

<outputDirectory>/lib</outputDirectory>

you can emit "/" like code below and try again.

<outputDirectory>lib</outputDirectory>
Music answered 17/10, 2015 at 14:21 Comment(0)
Y
0

On our system, this was solved by using the latest version of maven-assembly-plugin.

It appears that the underlying problem is with a dependency called Plexus.

Yoke answered 28/7, 2014 at 13:27 Comment(0)
T
0

I post a response here to this rather annoying problem in case anyone else is looking for a solution (in my case, I first encountered the problem after moving from my maven on Ubuntu 12.04 LTS to maven on Ubuntu 14.04LTS). First things first regarding my environment and some workarounds:

(a) My environment is Ubuntu 14.04LTS/amd64 with the latest maven, Java 7 (OpenJDK). (b) The file in question whose file information is not being retrieved is on an NFS filesystem that is imported into the machine I am working on (though this appears like it may not be the issue). (c) If I did an ls -1nlaR <long pathname on NFS mounted directory>/web.xml and then did the mvn war:war again, it did not produce any errors (i.e., BUILD SUCCESS for mvn war:war).

The workaround was to install libmaven-shared-utils-java:

$ apt-cache search plexus | grep maven
libmaven-shared-utils-java - Replacement for plexus-utils in Maven

As you may have already learned through your Googling the problem, plexus is the culprit, and Maven on Ubuntu has decided to move on from plexus, it seems. After installing the aforementioned shared utils, my maven builds are going through as they should.

Triacid answered 31/7, 2014 at 14:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.