简体   繁体   中英

How to inherit build chain in Maven POM?

Seems like you can only inherit plugin configurations. Can I inherit the full tag?

I want all my projects to use the same build chain. I was hoping to create a single parent pom w/ such a build chain. Sounds like a rather logical (and necessary) request, doesn't it?

You can a pom file for a particular project like this:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>com.soebes.smpp</groupId>
    <artifactId>smpp</artifactId>
    <version>2.3.0</version>
  </parent>

  <groupId>com.soebes.examples.j2ee</groupId>
  <artifactId>parent</artifactId>
  <version>3.4.6-SNAPSHOT</version>
  <packaging>jar</packaging>

You can put the needed plugin configuration into the given parent. Like this example .

Apart from that you don't need to define the plugins in the build section only via pluginManagement where you define the configuration and the version of the appropriate plugins. Which can be seen here as an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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