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.
What is the purpose of providing a downloaded pom.xml on mvnrepository.com
Install Jetty After Tomcat installed
Grails: how to use maven repo instead of ivy-cache
Manifest.mf cannot find org.junit
Is there a way to see which artifacts in Central depend on a given artifact?
pom.xml in every directory or skip intermediate?
How to exclude INDEX.LIST from maven generated jar-with-dependencies?
Building a fat jar using maven
Maven fails to find Jive archetypes from repository when building initial jive project
Can maven parent project include a module at same directory level
Does Jenkins/Hudson require maven-surefire-plugin to publish test results?
Class not found CallableProcessingInterceptor: migrated to 3.1.4
Trouble implementing Maven in STS
Using maven programmatically
Modify TeamCity build parameters programatically
difference in maven using a single repository or a single mirror