Question

I would like deploy several java project with a parent pom. My tree is :

pom.xml
 └── /project 1
      └── pom.xml
 └── /project 2
       └── pom.xml

For not duplicate code, I would like write in the parent pom to deploy my apps :

    <distributionManagement>
      <repository>
        <id>myName</id>
        <url>scp://myURL</url>
      </repository>
   </distributionManagement>

and

        <extensions>
          <extension>
             <groupId>org.apache.maven.wagon</groupId>
             <artifactId>wagon-ssh</artifactId>
             <version>2.4</version>
           </extension>
        </extensions>

When I use a command "mvn deploy" I have :

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.1:deploy (default-deploy) on project project1: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
[ERROR]
[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

Thanks in advance !

Was it helpful?

Solution

Please go through this & try it out... Add module tag in the paernt pom, something like

<modules>
   <module>../ChildProjec1</module>
   <module>../ChildProjec2</module>
   <module>../ChildProjec3</module>
</modules>

and add 'parent' tag in the parent POM

<parent>
    <relativePath>../ParentProject1/</relativePath>
    <groupId>soemthing..</groupId>
    <artifactId>soemthing..</artifactId>
    <version>1.0.0.0</version>
</parent>

Note all the subtags inside Parent tag will be available to child projects also.

Hope this helps...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top