How to skip the release or specific modules in the maven repo

喜欢而已 提交于 2019-12-03 09:45:41
asgoth

To understand you correctly, you still want to run the test modules, but your don't want to deploy/release them. The maven-deploy-plugin to the rescue! To artifact will still be built, but not deployed.

  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-deploy-plugin</artifactId>
    <version>2.7</version>
    <configuration>
        <skip>true</skip>
    </configuration>
  </plugin>

However, the jenkins release plugin will still release all artifacts. Instead of using the jenkins release plugin, think about releasing with the maven-release-plugin, which is easy to do:

mvn release:prepare
mvn release:perform

Since the default goals are deploy and site, all should be ok.

Just make sure you have a scm tag in your root pom:

<scm>
    <connection>scm:svn|git:https://...</connection>
    <developerConnection>scm:svn|git:https://...</developerConnection>
</scm>

and that your versioning tool command (git, svn, ...) is available on the PATH.

You could add a maven command line option to specify modules to be built in jenkins.

-pl,--projects <arg>                   Comma-delimited list of specified
                                       reactor projects to build instead
                                       of all projects. A project can be
                                       specified by [groupId]:artifactId
                                       or by its relative path.

Aggregator projects' purpose is to combine building requirements for simple projects. If your basic projects have different building requirements, consider adding a new aggregator project.

Disable deployment to your Maven repository in your current aggregator project and create a new aggregator project containing only the modules you wish to deploy.

Add this new project to Jenkins, make it depend on your original project and configure it to be deployed to your repository.

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