문제

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.

도움이 되었습니까?

해결책 2

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>

다른 팁

You get the mapping files packed into the JAR file because the mapping files are generated to the wrong output directory. You configured:

<destdir>${project.build.directory}/classes</destdir>

So the mapping files will be generated inside the target/classes/ folder which is used to build the output JAR file. Try some other directory like:

<destdir>${project.build.directory}/generated</destdir>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top