java - maven: How to add resources which are generated after compilation phase -
i have maven project uses wsgen generate xsd files compiled java classes.
problem want add generated xsd files jar resources.
since resource phase running before "process-classes" phase can't add them.
there way add additional resource after "process-classes" phase?
i suggest define output directory xsd files target/classes (may supplemental sub folder packaged later during package phase jar. can achieved using maven-resources-plugin.
<project> ... <build> <plugins> <plugin> <artifactid>maven-resources-plugin</artifactid> <version>3.0.2</version> <executions> <execution> <id>copy-resources</id> <phase>process-classes</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdirectory>${project.build.outputdirectory}</outputdirectory> <resources> <resource> <directory>${basedir}/target/xsd-out</directory> <filtering>false</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins> ... </build> ... </project>
you need take care resources plugin positioned after plugin used call wsgen part. can use prepare-package phase instead make sure resources correctly packaged.
Comments
Post a Comment