Is it possible to specify a dependency on a particular maven phase?
I am using the maven-docbkx-plugin to generate HTML and PDF output from docbook sources. I have several books, and these link to each other using olinks. The olink database is generated in one maven phase (generate-resources), and the actual HTML and PDF generation, which looks up this database is executed in a subsequent maven phase (compile). I have divided the maven project into a multi-module project, as each book has tens of included sub-documents. The docbkx-maven-plugin configuration is all done in the parent, then it is just the top-level docbook source that needs to be specified in the child POM. But ... this does not work dependency-wise, as each module requires that the generate-resources of every other module has been run before it runs its compile phase, so that it can access the olink database of each of the other books. Is there a way to do this in maven? Or will I need to re-structure into two maven projects (which will break the modularity of this project considerably, as all of the configuration will need to be declared in each project)? The structure of the parent POM is: ... <build> <plugins> <pluginManagenent> <plugin> <groupId>com.agilejava.docbkx</groupId> <artifactId>docbkx-maven-plugin</artifactId> <version>2.0.14</version> <executions> <execution> <id>xrefdb</id> <phase>generate-resources</phase> <configuration> ... </configuration> <goals> <goal>generate-html</goal> </goals> </execution> <execution> <id>html</id> <phase>compile</phase> <configuration> ... </configuration> <goals> <goal>generate-html</goal> </goals> </execution> </executions> </plugin> </pluginManagement> </plugins> </build> </project> And the modules: <project> ... <build> <plugins> <plugin> <groupId>com.agilejava.docbkx</groupId> <artifactId>docbkx-maven-plugin</artifactId> <version>2.0.14</version> <configuration> ... </configuration> </plugin> </plugins> </build> </project>
I've done a bit more research on this, and from what I have read, what I am asking is not possible (but I would be happy to be advised otherwise). I have split my project into two, and given them a common parent from which they can draw their common configuration.
Another way I've solved this problem is to use maven profiles. I perform the first pass of all the modules in the first profile, then perform the second pass in a second profile. It means the project has to be run twice to build all of its artifacts, but it is much more maintainable than spreading the sources over multiple projects.
Maven - Reading a property from an external properties file
Want to build multimodule pom which builds 2 ear from same project in maven
maven deploy does not work the way it is supposed to. Or am i wrong?
Maven: Making Jars With Dependencies: Example From Book Doesn't Work
maven: which jaxb plugin to use? [duplicate]
Maven - delegate plugin execution to submodule
Set directory in Maven Antrun Plugin
Maven assembly:single issue
Where can I get the NaturalDocs Maven plugin?
define additional source directory in maven
Java: Maven: get pom.xml information in properties file (mercurial hash as version)
Jetty 8 Maven Plugin jetty:run-war not detecting WebApplicationInitializer
maven how to install a jar with a classifier and not install the default one
Maven proxy settings not working
Maven: No marketplace entries found to handle castor, antrun, and ear plugins