我想用父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
提前致谢!
答案 0 :(得分:1)
请仔细阅读此内容试试看... 在paernt pom中添加模块标签,类似于
<modules>
<module>../ChildProjec1</module>
<module>../ChildProjec2</module>
<module>../ChildProjec3</module>
</modules>
并在父POM中添加'parent'标记
<parent>
<relativePath>../ParentProject1/</relativePath>
<groupId>soemthing..</groupId>
<artifactId>soemthing..</artifactId>
<version>1.0.0.0</version>
</parent>
请注意,父标记内的所有子标记也可用于子项目。
希望这会有所帮助......