How to skip lifecycle phase in multi maven module

流过昼夜 提交于 2019-12-01 02:12:38

问题


I have a maven multi module project which call two sub modules. please note that this child module do not use the parent markup tag. Now I need to have the deploy phase executed only on one child module but not the other one. Could someone provide any advice on the best way of doing this ?

Thanks


回答1:


As mentioned in this FAQ for maven deploy plugin, as well as in this SO discussion, you should add the following in the pom of the module you do not want to deploy.

        <plugin>
           <artifactId>maven-deploy-plugin</artifactId>
           <version>X.Y</version>
           <configuration>
             <skip>true</skip>
          </configuration>
        </plugin>



回答2:


you can go into the directory of the submodule and execute the goal there.

it is also possible to execute a specific module from the 'parent' with the --also-make option. see http://maven.apache.org/guides/mini/guide-multiple-modules.html




回答3:


multiple-module maven project can specify on which submodule to execute phases with parent pom.xml.

  1. Go to where the parent pom.xml is
  2. execute: mvn --projects [target-module-artifactId] [phase/goal]. For example: mvn --projects submodule1 deploy


来源:https://stackoverflow.com/questions/5579256/how-to-skip-lifecycle-phase-in-multi-maven-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!