Uploaded image for project: 'Maven Shared Components'
  1. Maven Shared Components
  2. MSHARED-581

Filtered resource copyFiles fails on pre-existing symlink

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: maven-shared-utils-3.0.0, maven-filtering-3.1.1
    • Fix Version/s: None
    • Component/s: maven-shared-utils
    • Labels:
      None
    • Environment:

      Description

      I have a file shared between multiple projects via symlink:

      -rw-r--r--  1 steven  staff  149 Mar 30 16:56 client/src/test/resources/simplelogger.properties
      lrwxr-xr-x  1 steven  staff   64 Oct 16  2014 integration-tests/jersey-client/src/test/resources/simplelogger.properties -> ../../../../../client/src/test/resources/simplelogger.properties
      lrwxr-xr-x  1 steven  staff   64 Oct 16  2014 integration-tests/resteasy-client/src/test/resources/simplelogger.properties -> ../../../../../client/src/test/resources/simplelogger.properties
      

      This works fine from a clean build, but on an incremental build, it fails:

      Caused by: org.apache.maven.plugin.MojoExecutionException: /Users/steven/ot-code/service-discovery/integration-tests/jersey-client/target/test-classes/simplelogger.properties
      	at org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:348)
      	at org.apache.maven.plugins.resources.TestResourcesMojo.execute(TestResourcesMojo.java:75)
      	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
      	... 20 more
      Caused by: org.apache.maven.shared.filtering.MavenFilteringException: /Users/steven/ot-code/service-discovery/integration-tests/jersey-client/target/test-classes/simplelogger.properties
      	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:128)
      	at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:232)
      	at org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:342)
      	... 23 more
      Caused by: java.nio.file.FileAlreadyExistsException: /Users/steven/ot-code/service-discovery/integration-tests/jersey-client/target/test-classes/simplelogger.properties
      	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
      	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
      	at sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
      	at java.nio.file.Files.createSymbolicLink(Files.java:1043)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.apache.maven.shared.utils.io.Java7Support.createSymbolicLink(Java7Support.java:176)
      	at org.apache.maven.shared.utils.io.FileUtils.copyFile(FileUtils.java:821)
      	at org.apache.maven.shared.utils.io.FileUtils.copyFile(FileUtils.java:1939)
      	at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:121)
      	... 25 more
      

      Perhaps FileUtils.copyFile should not attempt to copy over an existing symlink? It should leave it be if the target is the same, otherwise unlink it first.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              stevenschlansker Steven Schlansker
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: