从 jar 文件中删除生成的资源
你好,我正在使用 maven2-xdoclet2-plugin 生成 hibernate 映射
xdoclet 的配置与此类似:
<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>
当我运行
mvn clean generate-resources
它时,得到以下内容:
tree -L 2 target/classes/
target/classes/
|-- com
| `-- company
| `-- (the mappings generated)
`-- generated-resources
`-- xdoclet
`-- com
`-- company
`-- (the mappings generated)
所以我想避免的是在里面包含目录“ generated-resources” jar 文件。
我怎样才能做到这一点?我做了一些谷歌搜索,但运气不佳。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您将映射文件打包到 JAR 文件中,因为映射文件生成到错误的输出目录。您已配置:
因此映射文件将在用于构建输出 JAR 文件的
target/classes/
文件夹内生成。尝试其他目录,例如:You get the mapping files packed into the JAR file because the mapping files are generated to the wrong output directory. You configured:
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:我最终从 maven2-xdoclet2-plugin 迁移到 xdoclet-maven-plugin 并且它按预期工作(我在 hibernate 映射生成方面也遇到了一些问题)。
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 ).