3

I have maven parent project with several child projects. On deploy I want to execute some complex scp tasks. When i run mvn deploy i have error:

[INFO] Reactor Summary:
[INFO]
[INFO] Child project1 ............................... FAILURE [0.331s]
[INFO] Child project 2 .............................. SKIPPED
[INFO] Child project 3 .............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy
(default-deploy) on project Parent: Deployment failed: repository element 
was not specified in  the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]  

I read the question Deployment issue with Maven Plugin it says that i need to define repository in settings.xml. But i don't have any repository, all I want to do on deploy phase is execute script that copy files on server and do other work. And I want to execute this script only in parent project and scip this phase in child. I've not worked with maven very much, so maybe i'm just missing some maven concept.

Community
  • 1
  • 1
Ivan Oval
  • 151
  • 2
  • 8
  • Does this answer your question? [repository element was not specified in the POM inside distributionManagement element or in -DaltDep loymentRepository=id::layout::url parameter](https://stackoverflow.com/questions/27153024/repository-element-was-not-specified-in-the-pom-inside-distributionmanagement-el) – pringi Oct 13 '22 at 10:39

1 Answers1

3

If you don't have a repository (meaning: deployment/project repository, not local that you must have), then don't run mvn deploy, but rather mvn install. Maven Release Plugin (bound to the deploy phase by default) is for installing your artifacts in your project repository, labelling it in the source control repository, stuff like that. Which means: you have to define repositories and source control connection in your main POM, and perhaps credentials for your repository access in settings.xml.

If you want to skip certain projects (included as <modules>, right?), I think your best option is to use profiles with different <modules> sections inside for every profile.

MaDa
  • 10,511
  • 9
  • 46
  • 84