Alexandr Nikitin
Alexandr Nikitin

Reputation: 7436

Is it possible to specify pluginManagement not in parent pom?

I am trying to setup maven plugin management for a multi-module project. I want to use pluginManagement section without inheritance (specify plugin versions not in parent pom). My project structure looks something like this

base_project
   -- pom.xml
   -- project-bom
        -- pom.xml
   -- project-a
        -- pom.xml

In the root pom.xml I have two modules only:

<modules>
    <module>project-bom</module>
    <module>project-a</module>
</modules>

In the project-bom pom.xml I specify dependencyManagement and pluginManagement sections with dependency and plugin versions I want to use:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.some</groupId>
            <artifactId>dependency</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.some</groupId>
                <artifactId>plugin</artifactId>
                <version>1.0.0</version>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

In project-a pom.xml I import the project-bom pom and use dependency and plugin:

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>com.project</groupId>
            <artifactId>project-bom</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>org.some</groupId>
        <artifactId>dependency</artifactId>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.some</groupId>
            <artifactId>plugin</artifactId>
        </plugin>
    </plugins>
</build>

I'm able to use dependency versions specified in the project-bom but it doesn't work for plugins. It gives me the following warning:

[WARNING] Some problems were encountered while building the effective model for <...>
[WARNING] 'build.plugins.plugin.version' for <org.some:plugin> is missing. 

Is it possible to specify pluginManagement not in parent pom and import it?

Upvotes: 3

Views: 2470

Answers (1)

Mustafa
Mustafa

Reputation: 6134

This is currently not possible. There's an open ticket in the Maven project to add this feature.

Upvotes: 7

Related Questions