You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Elliotte Rusty Harold (Jira)" <ji...@apache.org> on 2019/12/19 15:54:00 UTC
[jira] [Resolved] (MSHARED-581) Filtered resource copyFiles fails
on pre-existing symlink
[ https://issues.apache.org/jira/browse/MSHARED-581?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Elliotte Rusty Harold resolved MSHARED-581.
-------------------------------------------
Resolution: Won't Fix
symlinks are painful at best, even more so in Java. I strongly recommend not using symlinks in your build. Atm we have no resources to contribute to this.
> Filtered resource copyFiles fails on pre-existing symlink
> ---------------------------------------------------------
>
> Key: MSHARED-581
> URL: https://issues.apache.org/jira/browse/MSHARED-581
> Project: Maven Shared Components
> Issue Type: Bug
> Components: maven-shared-utils
> Affects Versions: maven-shared-utils-3.0.0, maven-filtering-3.1.1
> Environment: Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T08:41:47-08:00)
> Maven home: /usr/local/Cellar/maven/3.3.9/libexec
> Java version: 1.8.0_77, vendor: Oracle Corporation
> Java home: /Users/steven/.jabba/jdk/1.8.77/Contents/Home/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "mac os x", version: "10.11.6", arch: "x86_64", family: "mac"
> Reporter: Steven Schlansker
> Priority: Major
>
> I have a file shared between multiple projects via symlink:
> {code}
> -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
> {code}
> This works fine from a clean build, but on an incremental build, it fails:
> {code}
> 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
> {code}
> 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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)