maven-2build-processxdoclet

Removing generated resources from a jar file


Hello I am using maven2-xdoclet2-plugin to generate the hibernate mappings

The config of xdoclet is something similar to this:

<plugin>
    <groupId>org.codehaus.xdoclet</groupId>
    <artifactId>maven2-xdoclet2-plugin</artifactId>
    <version>2.0.7</version>
    <executions>
        <execution>
           <id>xdoclet</id>
           <phase>generate-sources</phase>
           <goals>
             <goal>xdoclet</goal>
           </goals>
        </execution>
    </executions>
    (... dependencies ...)
    <configuration>
        <configs>
          <config>
            <components>
              <component>
                <classname>org.xdoclet.plugin.hibernate.HibernateMappingPlugin</classname>
                <params>
                  <version>3.0</version>
                </params>
              </component>
            </components>
            <params>
              <destdir>${project.build.directory}/classes</destdir>
            </params>
           </config>
          </configs>
       </configuration>

When I run

mvn clean generate-resources

It get the following thing:

tree -L 2 target/classes/
target/classes/
|-- com
|   `-- company
|       `-- (the mappings generated)
`-- generated-resources
    `-- xdoclet
        `-- com
            `-- company
                `-- (the mappings generated)

So what I want to avoid is to have the directory "generated-resources" inside the jar file.

How can I do that? I Did a few google searches without too much luck.


Solution

  • I finally moved from maven2-xdoclet2-plugin to xdoclet-maven-plugin and it worked as expected ( I was also having some issues with the hibernate mapping generation ).

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xdoclet-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>xdoclet</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>xdoclet</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <tasks>
                        <hibernatedoclet
                            destdir="${project.build.outputDirectory}"
                            mergeDir="${project.basedir}/src/main/resources/hibernate">
                            <fileset dir="${project.basedir}/src/main/java"
                                includes="**/domain/**/*.java" />
                            <hibernate version="3.0" />
                        </hibernatedoclet>
                    </tasks>
                </configuration>
            </plugin>