Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deployment issue with Maven Plugin [duplicate]

Tags:

java

maven

I get this error when i try to run mvn clean deploy -P PROD

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project mysticpaste: Deployment failed: repository element was
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project mysticp
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:203)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:140)
        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:314)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:151)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:445)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:168)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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
        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:107)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:195)
        ... 19 more
[ERROR]
like image 899
theJava Avatar asked Dec 27 '10 10:12

theJava


People also ask

What can be done to overcome the issues in Maven deployment?

To overcome this issue, the deployment process should be automated so there will not be any intervention and also the deployment is successful.

Are Maven plugins reusable?

Plugins are the central feature of Maven that allow for the reuse of common build logic across multiple projects.

What is difference between mvn install and deploy?

mvn:install copies your packaged Maven module to your local repository (by default, in ~/. m2/repository ), to be accessed by other local Maven builds. mvn:deploy uploads your packaged Maven module to another (usually remote) repository, to be accessed by other, not necessarily local, Maven builds.

What does Maven deploy plugin do?

The deploy plugin is primarily used during the deploy phase, to add your artifact(s) to a remote repository for sharing with other developers and projects. This is usually done in an integration or release environment.


2 Answers

See deploy section of the maven book.

You need to define a <repositories> element in your settings.xml (not in your pom.xml, that's bad) or a <distributionManagement> element in your pom.xml.

like image 64
Geoffrey De Smet Avatar answered Sep 25 '22 14:09

Geoffrey De Smet


should it be like (no space b/w profile and -P switch)

 mvn clean deploy -PPROD
like image 25
Nishant Avatar answered Sep 24 '22 14:09

Nishant