Hardware: MacBook Pro (Retina, 15-inch, Mid 2015)\ OS: OS X El Capitan, 10.11.6

Problem: I have a standard maven project which I build using mvn clean install from the command line. I receive an error on the install process which says Permission Denied for the created jar file so it can't copy it over.

Looking in the directory I see:

$ cd target/
$ ls -al
total 230856
drwxr-xr-x  10 u1  g1        340 Dec 21 16:08 ./
drwxr-xr-x  12 u1  g1        408 Dec 21 16:08 ../
drwxr-xr-x   5 u1  g1        170 Dec 21 16:08 classes/
drwxr-xr-x   4 u1  g1        136 Dec 21 16:08 generated-sources/
drwxr-xr-x   3 u1  g1        102 Dec 21 16:08 jcasgen/
drwxr-xr-x   3 u1  g1        102 Dec 21 16:08 maven-archiver/
drwxr-xr-x   3 u1  g1        102 Dec 21 16:08 maven-status/
-rw-r--r--   1 u1  g1      38239 Dec 21 16:08 rules-0.0.1-SNAPSHOT-sources.jar
-rw-r--r--   1 u1  g1  118102157 Dec 21 16:08 rules-0.0.1-SNAPSHOT.jar
-rw-r--r--   1 u1  g1      53247 Dec 21 16:08 original-rules-0.0.1-SNAPSHOT.jar

If I do an ls -le I don't see any extended ACLs. If I try to copy the large JAR file:

$ cp rules-0.0.1-SNAPSHOT.jar ~
cp: rules-0.0.1-SNAPSHOT.jar: Permission denied
$ sudo cp rules-0.0.1-SNAPSHOT.jar ~
cp: rules-0.0.1-SNAPSHOT.jar: Permission denied
$ cp rules-0.0.1-SNAPSHOT-sources.jar ~

It's just that single file that won't copy. I have discovered that I can mv the file other places, but copying just doesn't work no matter where I put it.

What else is interesting is that I can move my code anywhere in the file system, rerun the build, and that single created file has the same issue.

I have booted to the recovery console and reset the ACLs and permissions for my home directory to no effect. I have run Disk Utility and it shows everything to be okay.

Has anyone seen anything like this before? Other Mac folks here are saying I'll need to boot single user and fsck -y the drive.

Additional Info

By default, the maven install step uses the maven-shade-plugin to build an uber-jar. It is this uber-jar that cannot be copied. If I disable the maven-shade-plugin, so that the final JAR is a normal jar, I don't see the problem.

I have Trend Micro running on my Mac if that could make a difference.

I have discovered that if I overwrite the uber-jar with different data (same name) the file become copyable. For example:

cat > rules-0.0.1-SHAPSHOT.jar

After that, I can copy the file.

I have tried to watch things with opensnoop but all I see is a "Permission Denied" on an open by java.

  • 1
    Is there a process running which has the file open (use lsof to check)? Does the file remain un-copyable after a reboot?
    – nohillside
    Dec 22, 2016 at 18:18
  • 1
    The file remains un-copyable after a reboot. lsof does not show any processes with it open. Dec 22, 2016 at 19:48
  • That added info - do you mean that maven still creates a jar and that jar can be copied?
    – mmmmmm
    Dec 22, 2016 at 22:15
  • I apologize, I should have been clearer. If I use the maven-shade-plugin and generate the jumbo-sized JAR file, that JAR file is not copyable. If I disable the shade support and generate a "regular" JAR, that file behaves as I expect. Could the larger JAR file have a string in it that triggers Trend Micro to not allow the copy? Dec 22, 2016 at 22:44
  • @MatthewMarkland Disable TrendM temporarily then you will see it
    – klanomath
    Dec 22, 2016 at 22:55

1 Answer 1


Although this is an unsatisfying answer, updating to the latest version of the maven-shade-plugin "fixed" the problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .