gpt4 book ai didi

java - maven 资源插件错误

转载 作者:行者123 更新时间:2023-11-30 09:05:03 29 4
gpt4 key购买 nike

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 installmvn 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

最佳答案

Maven 似乎无法解析您的“env”属性。检查是否有配置文件或必须明确激活的东西才能定义“env”属性。在附加配置文件中定义此类属性是常见的做法。

为了从命令行使用-P激活配置文件:

mvn -Pprod install

最后,您可以像这样显式运行 mvn 命令来定义属性:

mvn -Denv=prod install

如果是 Eclipse,请在项目上单击 RMB,从菜单中选择“Maven->Select Maven Profiles...”,然后选择在构建项目时应激活的所有配置文件。

要检查是否有可用的配置文件,请使用:

mvn help:all-profiles

关于java - maven 资源插件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24967722/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com