1. 程式人生 > >Maven deploy釋出問題

Maven deploy釋出問題

1、maven釋出包到私服倉庫時,問題報錯資訊如下:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project coordinate-config: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project coordinate-config: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter   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:319)   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:498)   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) Caused by: org.apache.maven.plugin.MojoExecutionException: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter   at org.apache.maven.plugin.deploy.DeployMojo.getDeploymentRepository(DeployMojo.java:231)   at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:117)   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)   at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)   ... 19 more

2、解決方法

1)在maven的setting.xml配置檔案裡新增如下許可權配置,id為私服倉庫對應的repositoryid

2)執行maven deploy命令時指定sever配置的id和私服倉庫的地址

mvn deploy -DaltDeploymentRepository=lyg-nexus::default::http://localhost:8081/repository/maven-releases/