Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project : Error loading property file 'D:\....
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
当我在Eclipse中导入git项目时会发生这种情况。我尝试了mvn install
,mvn package
,但它也给出了同样的错误。然后我也更新了我的项目,但仍然是同样的问题。怎么解决这个问题?
这是-e
:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-resources) on project anuragropu: Error loading
property file 'D:\.\main\environments\${env}.properties' -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.6:resources (default-
resources) on project anuragropu: Error loading property file 'D:\...\src\main\environments\${env}.properties'
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
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:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: Error loading property file 'D:\..\src\main\environments\${env}.
properties'
at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:307)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
Caused by: org.apache.maven.shared.filtering.MavenFilteringException: Error loading property file 'D:\..\src\main\environme
nts\${env}.properties'
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.loadProperties(DefaultMavenFileFilter.java:290)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.getDefaultFilterWrappers(DefaultMavenFileFilter.java:205)
at org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering.filterResources(DefaultMavenResourcesFiltering.java:161)
at org.apache.maven.plugin.resources.ResourcesMojo.execute(ResourcesMojo.java:301)
... 21 more
Caused by: java.io.FileNotFoundException: D:\..\src\main\environments\${env}.properties
at org.apache.maven.shared.filtering.PropertyUtils.loadPropertyFile(PropertyUtils.java:65)
at org.apache.maven.shared.filtering.DefaultMavenFileFilter.loadProperties(DefaultMavenFileFilter.java:284)
... 24 more
答案 0 :(得分:2)
看起来像你的" env"财产无法由Maven解决。检查是否存在必须明确激活的配置文件或某些内容以定义" env"属性。在其他配置文件中定义此类属性的常见做法。
要从命令行激活配置文件,请使用-P:
mvn -Pprod install
最后,您可以定义显式运行mvn命令的属性,如下所示:
mvn -Denv=prod install
如果Eclipse在项目上单击RMB,请选择" Maven->选择Maven配置文件..."从菜单中选择所有应在项目构建时激活的配置文件。
要检查是否有任何可用的配置文件,请使用:
mvn help:all-profiles