Sto provando a configurare un progetto Maven multimodule per produrre un zip di distribuzione tramite il plug-in di assembly, che dovrebbe includere javadoc aggregato per tutti i sottomoduli nel progetto.Come evitare il doppio biforcarsi durante la generazione di javadoc aggregati in un progetto multimodulo
La struttura del progetto è (semplificato, in realtà ci sono circa 20 moduli):
Project X Core
+- pom.xml (1)
+- module-A
| +- pom.xml (2)
+-module-B
| +- pom.xml (3)
+-assembly
+- pom.xml (4)
dove assembly
è il modulo che produce la zip distribuzione. Il root root elenca tutti i sottomoduli come moduli, il pom di ogni submodule ha, a sua volta, il root pom come suo padre. Il plug-in di assembly è associato alla fase package
. Tutto questo funziona bene.
Il problema si verifica quando si tenta di creare javadoc aggregato (non javadoc jars, ma una directory con html), da includere nell'assembly. Per raggiungere questo obiettivo, ho configurato il Maven-javadoc-plugin come un plugin di generazione nel pom radice, come segue:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<source>1.6</source>
<encoding>utf8</encoding>
<quiet>true</quiet>
<links>
<link>http://docs.oracle.com/javase/6/docs/api/</link>
</links>
</configuration>
<executions>
<execution>
<id>create-javadoc</id>
<phase>package</phase>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
Inoltre, ho configurato il mio descrittore di assemblaggio, nel modulo di montaggio, per includere un fileset con i javadocs, prelevato dal dir bersaglio del suo progetto principale:
<fileSet>
<directory>../target/site/apidocs</directory>
<outputDirectory>docs/apidocs</outputDirectory>
</fileSet>
il problema affronto con questa configurazione è presente: vedo il seguente output quando si esegue mvn package
:
[INFO] Reactor Build Order:
[INFO]
[INFO] Project X Core
[INFO] Project X: module A
[INFO] Project X: module B
[INFO] Project X: assembly
[INFO] ------------------------------------------------------------------------
[INFO] Building Project X Core 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-core ---
[INFO]
[INFO] --- animal-sniffer-maven-plugin:1.13:check (default) @ projectX-core ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java16:1.0
[INFO]
[INFO] >>> maven-javadoc-plugin:2.10.1:aggregate (create-javadoc) > generate-sources @ projectX-core >>>
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Core 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-core ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: module A 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-modA ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: module B 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-modB ---
Downloading: https://example.org/repositories/snapshots/org/example/project/projectX-modB/1.0.0-SNAPSHOT/modB-1.0.0-20141121.022310-7.jar
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X: Assembly 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Downloading: https://example.org/repositories/snapshots/org/example/project/projectX-modC/1.0.0-SNAPSHOT/maven-metadata.xml
2/2 KB
(snip for brevity)
[INFO] ------------------------------------------------------------------------
[INFO] Building Project X: module A 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-modA ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ projectX-modA ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jeen/Projects/projectX/modA/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ projectX-modA ---
[INFO] Compiling 52 source files to /Users/jeen/Projects/projectX/modA/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ projectX-modA ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/jeen/Projects/projectX/modA/util/src/test/resources
[INFO]
[INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) @ projectX-modA ---
[INFO] Building jar: /Users/jeen/Projects/projectX/modA/target/modA-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] >>> maven-javadoc-plugin:2.10.1:aggregate (create-javadoc) > generate-sources @ projectX-modA >>>
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Core 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-core ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking Project X Module A 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO]
[INFO] --- maven-enforcer-plugin:1.0:enforce (enforce-maven) @ projectX-modA ---
[INFO]
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[INFO] Forking ProjectX Module B 1.0.0-SNAPSHOT
[INFO] >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
.....
Questo è solo uno snippet, ma questi messaggi "Forking" vengono ripetuti un gran numero di volte per ogni sottomodulo (in realtà, in realtà circa 60 volte per modulo). Questo mi preoccupa: sembra che ci sia un sacco di lavoro duplicato in corso. Una seconda cosa che mi preoccupa è che a quanto pare scarica istantanee remote di artefatti che fanno parte del reattore corrente (vedi i messaggi "Download" nello snippet qui sopra). Vorrei sottolineare che nonostante tutti questi messaggi duplicati, l'obiettivo è raggiunto: l'aggregato javadoc viene prodotto ed è incluso nell'assembly.
Quindi, la domanda è davvero: cosa (se mai) sto sbagliando? Devo semplicemente ignorare questi ripetuti messaggi "Forking" e i download di istantanee, o sono un'indicazione di una configurazione errata? Se quest'ultimo, qualcuno ha un'idea di come dovrei modificare il setup per farlo funzionare correttamente?
FWIW Ho già provato diverse configurazioni alternative, incluso lo spostamento della configurazione del plugin javadoc al sottomodulo dell'assembly, ma nessuna mi ha dato i risultati attesi.
Ho cercato di tenerlo breve e al punto, se sono necessarie ulteriori informazioni fammi sapere.
Eseguire Maven 3.2.3, a proposito.
sto avendo lo stesso problema.quando il mio multimodule maven build arriva nel sito gen dice (nei log) "preparare 'aggregare' il report richiede 'esecuzione di fasi bifore' generate-sources 'e arriva il messaggio" biforcazione "con" >>>>>>> " ... anche se ho provato la tua soluzione. Altre idee? Ho anche provato questo: https://maven.apache.org/plugins/maven-javadoc-plugin/examples/javadoc-nofork.html – tom
fyi ecco la mia domanda correlata https://stackoverflow.com/questions/47199146/maven -site-goal-cause-forking – tom