Eclipse 2023-06包括新的M2 E 2.3.0,而M2 E 2.3.0又包括maven 3.9(从3.8升级)。默认情况下,新的maven版本使用maven-resources v3.3.0插件。当尝试使用符号链接的文件构建现有项目时,我得到以下错误:
Failed to execute mojo org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources {execution: default-resources} (org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources:default-resources:process-resources)
org.eclipse.core.runtime.CoreException: Failed to execute mojo org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources {execution: default-resources}
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:340)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.lambda$0(MavenExecutionContext.java:291)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:290)
at org.eclipse.m2e.core.project.configurator.MojoExecutionBuildParticipant.build(MojoExecutionBuildParticipant.java:57)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.lambda$1(MavenBuilderImpl.java:139)
at java.base/java.util.LinkedHashMap.forEach(LinkedHashMap.java:721)
at org.eclipse.m2e.core.internal.builder.MavenBuilderImpl.build(MavenBuilderImpl.java:122)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:164)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$1.method(MavenBuilder.java:1)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$1(MavenBuilder.java:109)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:228)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.lambda$0(MavenBuilder.java:100)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeBare(MavenExecutionContext.java:394)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:275)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.execute(MavenExecutionContext.java:214)
at org.eclipse.m2e.core.internal.builder.MavenBuilder$BuildMethod.execute(MavenBuilder.java:83)
at org.eclipse.m2e.core.internal.builder.MavenBuilder.build(MavenBuilder.java:192)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:196)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:289)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: org.apache.maven.plugin.MojoExecutionException: copying /home/test.git/testProject/src/main/resources/I18NConstants_da.properties to /home/test.git/testProject/target/classes/I18NConstants_da.properties failed with NoSuchFileException: /home/test.git/testProject/target/classes/I18NConstants_da.properties
at org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:362)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:126)
at org.eclipse.m2e.core.internal.embedder.MavenExecutionContext.executeMojo(MavenExecutionContext.java:338)
... 32 more
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: copying /home/test.git/testProject/src/main/resources/I18NConstants_da.properties to /home/test.git/testProject/target/classes/I18NConstants_da.properties failed with NoSuchFileException: /home/test.git/testProject/target/classes/I18NConstants_da.properties
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:118)
at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:277)
at org.apache.maven.plugins.resources.ResourcesMojo.execute(ResourcesMojo.java:356)
... 34 more
Caused by: java.nio.file.NoSuchFileException: /home/test.git/testProject/target/classes/I18NConstants_da.properties
at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setMode(UnixFileAttributeViews.java:277)
at java.base/sun.nio.fs.UnixFileAttributeViews$Posix.setPermissions(UnixFileAttributeViews.java:299)
at java.base/java.nio.file.Files.setPosixFilePermissions(Files.java:2167)
at org.apache.maven.shared.filtering.FilteringUtils.copyFilePermissions(FilteringUtils.java:477)
at org.apache.maven.shared.filtering.FilteringUtils.copyFile(FilteringUtils.java:457)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:110)
... 36 more
这个新的bug会在以后的版本中修复吗?我现在如何解决这些问题?
1条答案
按热度按时间vnzz0bqm1#
原因是下面的bug MSHARED-1112,这个bug是maven-resources-plugin 3.2.0中引入的,在3.3.1中修复了。
还有一个bug你可能会碰到:MRESOURCES-265,这会导致资源文件,例如ISO-8859-1编码来破坏maven资源过滤。
我通过降级到3.0.1版本来缓解这些问题,如下所示: