Home > database >  Maven root pom.xml insert file conten
Maven root pom.xml insert file conten

Time:09-29

Is there any possibility to inject parameters into root pom.xml of project from another file?

Maybe there something like "include" parameter?

CodePudding user response:

No there is no any option do that, you can add dependencies there only.

CodePudding user response:

In order to include a POM in another POM, you need to create the POM to include, first.

In order to do this, create a new maven project without src/main and srv/test and change <packaging>jar</packaging> to <packaging>pom</packaging>.

Write everything you want to include in that pom.xml and publish it to a maven repository.

After that, you can include it as a parent project or a pom dependency:

<parent>
    <groupId>include.pom.group-id</groupId>
    <artifactId>include-pom-artifacr-id</artifactId>
    <version>YOUR_VERSION</version>
</parent>

or

<dependency>
    <groupId>include.pomgroup-id</groupId>
    <artifactId>include-pom-artifacr-id</artifactId>
    <version>YOUR_VERSION</version>
    <type>pom</type>
    <scope>import</scope>
</dependency>
  • Related