2017-06-22 4 views
1

Ich werde mit mvn config verrückt. mvn clean deploy erzeugt nur die Haupt-JAR-Datei. nicht die javadoc, dources und sign etc Dateien. Wenn ich explizit mvn clean jar:jar javadoc:jar source:jar gpg:sign deploy aufrufen - es produziert Javadoc und Quellen usw. aber das Hauptglas ist leer.mvn produziert nicht alle artifcats

Was ist los !! ?

<build> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-source-plugin</artifactId> 
        <version>2.2.1</version> 
        <executions> 
         <execution> 
          <id>attach-sources</id> 
          <phase>deploy</phase> 
          <goals> 
           <goal>jar-no-fork</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-javadoc-plugin</artifactId> 
        <version>2.9.1</version> 
        <executions> 
         <execution> 
          <id>attach-javadocs</id> 
          <phase>deploy</phase> 
          <goals> 
           <goal>jar</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-gpg-plugin</artifactId> 
        <version>1.5</version> 
        <executions> 
         <execution> 
          <id>sign-artifacts</id> 
          <phase>verify</phase> 
          <goals> 
           <goal>sign</goal> 
          </goals> 
         </execution> 
        </executions> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <version>2.3.2</version> 
        <configuration> 
         <source>1.8</source> 
         <target>1.8</target> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-resources-plugin</artifactId> 
        <version>2.7</version> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-surefire-plugin</artifactId> 
        <version>2.20</version> 
        <configuration> 
         <suiteXmlFiles> 
          <suiteXmlFile>suite.xml</suiteXmlFile> 
         </suiteXmlFiles> 
         <properties> 
          <property> 
           <name>suitethreadpoolsize</name> 
           <value>1</value> 
          </property> 
         </properties> 
        </configuration> 
       </plugin>   
      </plugins> 
    </build> 
+0

Sie müssen keine Phase für maven-jar-plugin hinzufügen. Definieren Sie nur die Version des Plugins. Alle ausgeschlossen usw. sind nicht notwendig, denn das ist der Standard ... – khmarbaise

+0

@khmarbaise danke für Ihre Eingabe. Ich habe den Pom aktualisiert. immer noch sehe ich nicht die Javadoc und Sources-Dateien – KitKarson

+1

Ändern Sie die Phase für Javadoc, Source-Plugin zu 'Paket' anstelle von deploy und versuchen' mvn sauberes Paket' – khmarbaise

Antwort

1

Verschieben Sie die Plugins außerhalb des Abschnitts <pluginManagement>. Dieser Abschnitt wird verwendet, um Ihre Plugins zu verwalten, oder besser, handhaben Sie die Versionen von ihnen.

Aktivierung erfolgt außerhalb dieses Abschnitts:

<build> 
    <pluginManagement> 
    <plugins> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-source-plugin</artifactId> 
     <version>2.2.1</version> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-javadoc-plugin</artifactId> 
     <version>2.9.1</version> 
     </plugin> 
    </plugins> 
    </pluginManagement> 
    <plugins> 
     <!-- Activation occurs here. If you have declared the version of the 
      plugin in the section above, then you can omit the version in 
      this section. 
     --> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-source-plugin</artifactId> 
     <executions> 
      <execution> 
      <id>attach-sources</id> 
      <goals> 
       <goal>jar</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
     <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-javadoc-plugin</artifactId> 
     <executions> 
      <execution> 
      <id>attach-javadocs</id> 
      <goals> 
       <goal>jar</goal> 
      </goals> 
      </execution> 
     </executions> 
     </plugin> 
    </plugins>  
</build> 

mvn package sollte nun die Artefakte erzeugen Sie wollen und wenn Sie bereitstellen, werden sie automatisch abgeholt werden.

+0

Dank @Daniel. Ich aktualisierte Frage mit neuem pom gemäß Ihrem Vorschlag. Ich habe das 'pluginmanagement' entfernt. immer noch kein Glück. Javadoc und Quellen werden nicht generiert! – KitKarson

+0

Ich habe das Snippet aktualisiert, damit es den Best Practices besser entspricht, was bedeutet, dass die Artefakte während der Paketphase erzeugt werden sollten. Ich habe dies getan, indem ich die gebundene Phase der Ausführungen entfernt habe, die standardmäßig auf "Paket" gesetzt ist. – Daniel

+0

Danke Daniel für die Eingabe – KitKarson

Verwandte Themen