maven部署目标失败 [英] maven deploy goal failing

查看:204
本文介绍了maven部署目标失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



当使用部署目标执行Run-As - >构建时,我收到以下错误: p>

 错误消息:org.codehaus.plexus.component.configurator.ComponentConfigurationException:类'org.apache.maven.artifact.repository.ArtifactRepository '不能被实例化

我不知道我甚至需要做一个部署,我有另一个构建一个编译目标,而从我所学到的运行方式 - >运行在服务器(tomcat)上就足以将我的应用程序部署到tomcat。



/ p>

解决方案 p

我需要运行这个构建'deploy' / div>

运行 mvn deploy 不会在Tomcat上部署应用程序,部署在这里是不同的, deploy 一个阶段 在集成或发布环境中完成,并将最终软件包复制到远程存储库以与其他开发人员和项目共享。 / p>

换句话说,除非您正在处理远程存储库以分发应用程序(这需要配置一个有效的 < distributionManagement /> 部分),只需忘记 deploy 现在,这不是你以为是这样的:)



所以,要运行你的应用程序和 从Tomcat部署从Eclipse使用运行方式>在服务器上运行。如果你想从Eclipse外部运行它,你可以使用 mvn tomcat:run ,但这不是真的适合这个(这个目标是一个方便的运行一个webapp没有在IDE中导入它)。如果您真的想从命令行在Tomcat上部署应用程序,Maven Tomcat插件支持许多部署。但是再一次,我不认为这是你现在正在寻找的。

I am using eclipse with maven2 plugin.

When doing a Run-As -> build with a goal of 'deploy' I am getting this error:

Error message:org.codehaus.plexus.component.configurator.ComponentConfigurationException: Class 'org.apache.maven.artifact.repository.ArtifactRepository' cannot be instantiated

I'm not sure I even need to do a 'deploy', I have another build that does a 'compile' goal, and from what I have learned doing a Run-As -> Run on Server (tomcat) is enough to deploy my application locally to tomcat.

Do I need run this build 'deploy' goal to run locally, should I just delete it and use 'run on server'?

解决方案

Running mvn deploy won't "deploy your application on Tomcat", deploy is something different here, deploy is a phase done in an integration or release environment and copies the final package to the remote repository for sharing with other developers and projects.

In other words, unless you are dealing with a remote repository to distribute your application (and this requires to configure a valid <distributionManagement/> section in your POM), just forget about deploy for now, this is not what you think it is :)

So, to run your application and "deploy it on Tomcat" from Eclipse, use Run As > Run on Server. If you want to run it from outside Eclipse, you can use mvn tomcat:run but this isn't really appropriate here (this goal is an handy way to run a webapp without importing it in a IDE). And if really you want to deploy your application on Tomcat from the command line, the Maven Tomcat plugin supports many methods for Deployment. But again, I don't think that this is what you're looking for for now.

这篇关于maven部署目标失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆