org.apache.maven.plugins:maven-resources-plugin:2.5:resources(没有这样的文件或目录) - > [帮助1]

时间:2016-11-04 17:33:11

标签: java maven pom.xml

我正在尝试使用Maven安装项目,但是我收到此错误

Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources (default-resources) on project locanda: /opt/h2/databases/locanda.h2.db (No such file or directory) -> [Help 1]

我尝试编辑我的项目文件夹添加/opt/h2/databases/locanda.h2.db但错误仍然出现。

您可以阅读我的pom.xml here。如果我删除该行:

<db.folder>/opt/h2/databases</db.folder>

安装结束没有问题。

这是错误的堆栈跟踪,使用clean install -X

检索
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources (default-resources) on project locanda: /opt/h2/databases/locanda.h2.db (No such file or directory) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.5:resources (default-resources) on project locanda: /opt/h2/databases/locanda.h2.db (No such file or directory)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    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:497)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: org.apache.maven.plugin.MojoExecutionException: /opt/h2/databases/locanda.h2.db (No such file or directory)
    at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:316)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 25 more
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: /opt/h2/databases/locanda.h2.db (No such file or directory)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:130)
    at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:267)
    at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:310)
    ... 27 more
Caused by: java.io.FileNotFoundException: /opt/h2/databases/locanda.h2.db (No such file or directory)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:162)
    at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1107)
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:1013)
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:2234)
    at org.apache.maven.shared.filtering.DefaultMavenFileFilter.copyFile(DefaultMavenFileFilter.java:123)
    ... 29 more

我的项目文件夹可以找到here

你能告诉我问题的原因吗?我正在努力学习Maven,我真的很感激一些帮助。

P.S。 我没有注意到IntelliJ。

2 个答案:

答案 0 :(得分:2)

尝试使用<db.folder>opt/h2/databases</db.folder>

我删除了第一个正斜杠。

答案 1 :(得分:1)

我猜它正在搜索文件“/opt/h2/databases/locanda.h2.db”,而不是在预期的区域,而是在默认的工作目录中