Plugin definition in settings.xml is not accepting build tag

543 Views Asked by At

I would like to define global plugin inside of my Settings.xml file looks like:

<settings>
  <profiles>
    <profile>
      <id>spotbugs</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>4.0.4</version>
            <configuration>
                <effort>Max</effort>
                <threshold>Low</threshold>
                <failOnError>true</failOnError>
                <plugins>
                    <plugin>
                        <groupId>com.h3xstream.findsecbugs</groupId>
                        <artifactId>findsecbugs-plugin</artifactId>
                        <version>1.10.1</version>
                    </plugin>
                </plugins>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <activeProfiles>
    <activeProfile>spotbugs</activeProfile>
  </activeProfiles>
</settings>

unfortunatley i get:

[WARNING] [WARNING] Some problems were encountered while building the effective settings [WARNING] Unrecognised tag: 'build' (position: START_TAG seen ...\n ... @5:14) @ /Users/gs/.m2/settings.xml, line 5, column 14 [WARNING]

is it possible to put plugin information like above into pluginRepositries? I would like to have global conifiguration for this plugin instead of editing every single pom.xml to use mvm spotbugs:spotbugs

1

There are 1 best solutions below

0
On

You can achieve this by put plugins configuration in one super/corporate pom i section:

<build>
    <pluginManagement>
        <plugins>
           ....
        </plugins>
    </pluginManagement>
<build>

In order to use it all your project must have set parent to this pom.