简体   繁体   English

如何使用简单的父项自定义多模块Maven项目的Maven部署

[英]How to customize a Maven deploy of a multi module maven project with simple parent

Hallo I have a multiple module maven Project. 哈罗我有一个多模块Maven项目。 Each project has it's own pom and the parent pom.xml has packaging type pom, all others jar. 每个项目都有自己的pom,父项目pom.xml的包装类型为pom,其他均为jar。

Parent Pom (packaging pom)
  Module1 (packaging jar)
  Module2 (packaging jar)
  ... 
  Module_n  (packaging jar)
  Extension1  (packaging jar)
  extension2 (packaging jar)
  ...

Now i want to configure the projects, that all modules are put to a local repository like C:\\repo\\modules and all extension put to c:\\repo\\extension\\ and alle dependency jars should be put to c:\\repo\\lib\\ 现在我要配置项目,所有模块都放置在本地存储库中,例如C:\\ repo \\ modules,所有扩展都放置在c:\\ repo \\ extension \\中,所有依赖项jar都应放置在c:\\ repo \\ lib \\

My first try in parent pom is the following: 我在父pom中的首次尝试如下:

    <properties>
      <Repository>file://${user.home}\repo</Repository>
   </properties
    <distributionManagement>
        <repository>
            <id>Deploy/id>
            <url>${Repository}</url>
        </repository>
    </distributionManagement>

The 1st problem here is, that all childprojects are put in an own directory named like the project name. 这里的第一个问题是,所有子项目都放在一个自己的目录中,该目录的名称类似于项目名称。 2. No dependency of a module or extension was deployed to the repository 3. I also need to copy some settings files from some projects to the repository. 2.没有将模块或扩展的依赖项部署到存储库中。3.我还需要将一些设置文件从某些项目复制到存储库中。 How I can do this. 我该怎么做。 Thanks for you help! 感谢您的帮助!

You should probably checkout the maven dependency plugin. 您可能应该检出Maven依赖插件。 Configure it in your main pom and on a per module basis specific where you want the dependency be copied. 在您的主pom中,并在每个模块的基础上,具体配置要将依赖项复制到何处。 See: 看到:

http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html http://maven.apache.org/plugins/maven-dependency-plugin/examples/copying-project-dependencies.html

As for you specific files, use the resources plugin to copy them. 至于您的特定文件,请使用资源插件进行复制。 See: 看到:

http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html http://maven.apache.org/plugins/maven-resources-plugin/examples/copy-resources.html

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

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