2016-08-09 72 views
0

ich eine Wurzel pom haben:ausschließen findbugs von der Wurzel pom Plugin

<?xml version="1.0" encoding="UTF-8"?> 
<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> 

<groupId>packaging</groupId> 
<artifactId>profiles</artifactId> 
<version>1.0-SNAPSHOT</version> 
<packaging>pom</packaging> 

<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>findbugs-maven-plugin</artifactId> 
      <version>1.2</version> 
      <configuration> 
       <findbugsXmlOutput>true</findbugsXmlOutput> 
       <findbugsXmlWithMessages>true</findbugsXmlWithMessages> 
       <xmlOutput>true</xmlOutput> 
      </configuration> 
     </plugin> 
    </plugins> 
</build> 

<profiles> 
    <profile> 
     <id>dev</id> 
     <activation> 
      <activeByDefault>true</activeByDefault> 
     </activation> 
     <modules> 
      <module>../common-core</module> 
      <module>../spark-monitoring-module</module> 
      <module>../mass-analytics-connector-module</module> 
      <!--<module>../global-aggregation-job</module>--> 
      <module>../location-aggregation-job</module> 
      <module>../bdr-aggregation-job</module> 
      <module>../activities-aggregation-job</module> 
      <module>../recovery-aggregation-job</module> 
      <module>../link-analysis-aggregation-job</module> 
      <module>../spark-streaming-module</module> 
      <module>../coordinates-to-mgrs-converter</module> 
     </modules> 
    </profile> 
    <profile> 
     <id>all</id> 
     <modules> 
      <module>../common-core</module>    
      <module>../spark-monitoring-module</module> 
      <module>../mass-analytics-connector-module</module> 
      <module>../global-aggregation-job</module> 
      <module>../location-aggregation-job</module> 
      <module>../bdr-aggregation-job</module> 
      <module>../activities-aggregation-job</module> 
      <module>../recovery-aggregation-job</module> 
      <module>../link-analysis-aggregation-job</module> 
      <module>../spark-streaming-module</module> 
      <module>../parquet-writer-sim</module> 
      <module>../coordinates-to-mgrs-converter</module> 
     </modules> 
    </profile> 
    <profile> 
     <id>act</id> 
     <modules> 
      <module>../common-core</module> 
      <module>../bdr-aggregation-job</module> 
      <module>../activities-aggregation-job</module> 
     </modules> 
    </profile> 
</profiles> 

Als ich mvn sauberen Lauf findbugs installieren: findbugs in Jenkins, schafft es die findbugsXml.xml jedes Moduls und nicht die aktueller Job wegen Profilmodul (das keinen Code enthält). Ich möchte nicht, dass das finbugs plugin auf den Profilen pom läuft (es ist der root pom), wie schließe ich Profile vom findbugs plugin aus?

Antwort

2

Zwei Änderungen wirklich.

1) Bewegen Sie Ihre Plugin-Sektion (Build oben) in einen Plugin-Management-Bereich, so: Ich habe Ihre Plugin-Details aktualisiert, da sie ziemlich alt war.

<pluginManagement> 
    <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>findbugs-maven-plugin</artifactId> 
       <version>3.0.4</version> 
       <executions> 
        <execution> 
         <id>check</id> 
         <phase>package</phase> 
         <goals> 
          <goal>check</goal> 
         </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <xmlOutput>true</xmlOutput> 
        <xmlOutputDirectory>findbugsreports</xmlOutputDirectory> 
        <findbugsXmlOutput>true</findbugsXmlOutput> 
        <findbugsXmlOutputDirectory>target/site</findbugsXmlOutputDirectory> 
        <failOnError>false</failOnError> 
       </configuration> 
      </plugin> 
    </plugins> 
</pluginManagement> 
  1. In dem Poms, wo Sie einen Fehler finden müssen, hat einen minmal Build Abschnitt:
<build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>findbugs-maven-plugin</artifactId> 
     </plugin> 
    </plugins> 
</build> 

Wenn Sie ändern müssen eine allgemeine Eigenschaft dann tun Sie es in der Root-Pom, wenn Sie eine bestimmte Eigenschaft in das einzelne Kind POM daran beteiligt ändern müssen. Die Vorteile eines solchen Ansatzes bestehen darin, dass Sie Ihre Plugins auf dem höchstmöglichen Level verwalten und sie dort einfügen, wo Sie sich auf der untergeordneten Ebene fit fühlen. Dies schließt mehrere Konfigurationen aus, außer wenn es absolut notwendig ist.

+0

Gibt es eine Möglichkeit, dies zu tun, ohne diese Zeilen in jedem Modul hinzuzufügen, ich möchte es auf allen Modulen außer dem Stammmodul (Profile) anwenden? – user2199630

+0

Es tut mir leid, das ist wirklich wie es funktionieren sollte, überprüfen Sie bitte eine vollständige stackoverflow Antwort, die hier erwähnt wird; http://stackoverflow.com/questions/10483180/maven-what-is-pluginmanagement – PeterS

+0

es läuft immer noch und schlägt auf dem Hauptp ... – user2199630