繁体   English   中英

如何使用Maven部署多项目?

[英]How to deploy multiproject with Maven?

我想用父pom部署几个java项目。 我的树是:

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

对于不重复的代码,我想在父pom中编写部署我的应用程序:

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

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

当我使用命令“ mvn deploy”时,我有:

[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

提前致谢 !

请仔细阅读并尝试一下...在paernt pom中添加模块标签,类似

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

并在父POM中添加“父”标签

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

请注意,父标记中的所有子标记也可用于子项目。

希望这可以帮助...

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM