2

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?

vasilli
  • 43
  • 9
  • The build chain how you call it is the Maven life cycle and if you use the same packaging type the life cycle is always the same ...maybe I misunderstand your question? – khmarbaise Apr 01 '17 at 09:07
  • I didn't make myself clear. By "build chain" I meant the collection of in the section. How can I inherit that for all my projects w/o having to rewrite this section in every POM? Seems redundant and avoidable. – vasilli Apr 02 '17 at 23:53
  • Possible duplicate of [Define Maven plugins in parent pom, but only invoke plugins in child projects](https://stackoverflow.com/questions/12924634/define-maven-plugins-in-parent-pom-but-only-invoke-plugins-in-child-projects) – mat101 Feb 12 '19 at 10:26

1 Answers1

1

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.

khmarbaise
  • 92,914
  • 28
  • 189
  • 235
  • 1
    Ty, khmarbaise. This is exactly what I was trying to do b/f and somehow the build pluginManagement does not get inherited. I'll accept your answer for the time being and will try this again. But last time it didn't work for me. – vasilli Apr 06 '17 at 21:01