hyperjaxb3不生成文件

我正在尝试通过学习本教程来学习hyperjaxb。 我按照所有说明一直到标题部分What was Generated? 。 这包括以下步骤:

 1.) download the Basic Project Template for Hibernate and Maven 2.) unzip the file 3.) install the xml and xsd files in the assigned locations 4.) open up `cmd.exe` 5.) navigate to the directory of the unzipped root folder 6.) run mvn clean install 

但没有产生任何东西。 没有/generated-sources/xjc目录,也没有PurchaseOrderType.java 。 我对整个目录结构进行了关键词搜索,以确认运行mvn clean install后这些资源不存在。 我还将目录结构导入到一个新的eclipse maven项目中,并尝试run as...maven clean新的eclipse maven项目中run as...maven cleanrun as...maven build ,但同样缺乏结果。

我该怎么做才能让本教程生成预期生成的文件?

另外,有没有更好的方法从xsd生成JPA实体?


编辑:

根据@ kapep的建议,我尝试了mvn generate-sources并得到了以下结果:

然后我再次尝试mvn clean install ,得到以下结果:

您可以在打印屏幕中看到org.apache.maven.plugins:maven-compiler-plugin缺失的警告。 我在我的机器上的.m2存储库中找到了相应的文件夹并删除了它,然后在eclipse中做了一个maven update project来重新下载库。 然后我做了另一个mvn clean install ,并得到了同样的缺乏结果。 没有生成任何内容,没有java文件,没有generated-sources目录。 没有。

我还能尝试什么?


第二次编辑:

教程应用程序仍然不生成目标文件,但是,我能够通过将pom的maven-compiler-plugin部分更改为以下内容来消除打印屏幕中的警告消息:

  true maven-compiler-plugin 2.3.2  1.6 1.6   

请注意,除了指定版本之外,我还根据@Todd 在此post中的建议将sourcetarget1.5更改为1.6 。 我假设这些是指JDK版本。 我的安装使用JDK 1.6。 我不知道这是否会造成任何问题。

我还能尝试什么?

UPDATE

最后,看起来OP正在项目的根目录中寻找生成的类而不是target\generated-source\xjc ,尽管教程明确说明了要查看的位置:

如果浏览目标/ generated-sources / xjc目录,则会发现很少生成的java文件,例如PurchaseOrderType.java


再一次,我不明白这一点。 适合我。

我的步骤是:

  • hyperjaxb3-ejb-template-basic-0.6.0-maven-src.zip解压缩到某个位置
  • schema.xsd放入src/main/resources
  • po.xml放入src/test/samples
  • mvn clean install

这就是我得到的,干净整洁:

 [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.jvnet.hyperjaxb3:hyperjaxb3-ejb-template-basic-maven:jar:0.6.0 [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 75, column 12 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Hyperjaxb3 Samples [po-initial:maven] 0.6.0 [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hyperjaxb3-ejb-template-basic-maven --- [INFO] Deleting C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target [INFO] [INFO] --- maven-hyperjaxb3-plugin:0.6.0:generate (default) @ hyperjaxb3-ejb-template-basic-maven --- [INFO] Sources are not up-to-date; XJC execution will be executed. [WARNING] According to the Java Persistence API specification, section 2.1, entities must be top-level classes: "The entity class must be a top-level class." Your JAXB model is not customized as with top-level local scoping, please use the  global bindings customization. org.jvnet.hyperjaxb3.ejb.plugin.EjbPlugin [WARNING] According to the Java Persistence API specification, section 2.1, entities must implement the serializable interface: "If an entity instance is to be passed by value as a detached object (eg, through a remote interface), the entity class must implement the Serializable interface." Your JAXB model is not customized as serializable, please use the  global bindings customization element to make your model serializable. org.jvnet.hyperjaxb3.ejb.plugin.EjbPlugin [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ hyperjaxb3-ejb-template-basic-maven --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, ie build is platform dependent! [INFO] Copying 2 resources [INFO] Copying 0 resource [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ hyperjaxb3-ejb-template-basic-maven --- [WARNING] File encoding has not been set, using platform encoding Cp1252, ie build is platform dependent! [INFO] Compiling 5 source files to C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ hyperjaxb3-ejb-template-basic-maven --- [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, ie build is platform dependent! [INFO] Copying 2 resources [INFO] [INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ hyperjaxb3-ejb-template-basic-maven --- [WARNING] File encoding has not been set, using platform encoding Cp1252, ie build is platform dependent! [INFO] Compiling 5 source files to C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ hyperjaxb3-ejb-template-basic-maven --- [INFO] Surefire report directory: C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target\surefire-reports ------------------------------------------------------- TESTS ------------------------------------------------------- Running RoundtripTest Detected [file:/C:/Projects/workspaces/hj3/dist/hyperjaxb3-ejb-template-basic-0.6.0/target/classes/META-INF/persistence.xml]. RoundtripTest Loading entity manager factory properties. RoundtripTest Loading entity manager factory properties from [file:/C:/Projects/workspaces/hj3/dist/hyperjaxb3-ejb-template-basic-0.6.0/target/test-classes/persistence.properties]. RoundtripTest Testing samples. RoundtripTest Sample directory [C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\src\test\samples]. RoundtripTest Testing sample [po.xml]. RoundtripTest Unmarshalling. RoundtripTest Opening session. RoundtripTest Saving the object. RoundtripTest Opening session. RoundtripTest Loading the object. RoundtripTest Closing the session. RoundtripTest Initial object:    Alice Smith 123 Maple Street Mill Valley CA 90952   Robert Smith 8 Oak Avenue Old Town PA 95819  Hurry, my lawn is going wild!   Lawnmower 1 148.95 Confirm this is electric   Baby Monitor 1 39.98 1999-05-21    RoundtripTest Source object:    Alice Smith 123 Maple Street Mill Valley CA 90952   Robert Smith 8 Oak Avenue Old Town PA 95819  Hurry, my lawn is going wild!   Lawnmower 1 148.95 Confirm this is electric   Baby Monitor 1 39.98 1999-05-21    RoundtripTest Result object:    Alice Smith 123 Maple Street Mill Valley CA 90952   Robert Smith 8 Oak Avenue Old Town PA 95819  Hurry, my lawn is going wild!   Lawnmower 1 148.95 Confirm this is electric   Baby Monitor 1 39.98 1999-05-21    RoundtripTest Checking the document identity. RoundtripTest Finished testing sample [po.xml]. RoundtripTest Finished testing samples. RoundtripTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.456 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ hyperjaxb3-ejb-template-basic-maven --- [INFO] Building jar: C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target\hyperjaxb3-ejb-template-basic-maven-0.6.0.jar [INFO] [INFO] --- maven-install-plugin:2.4:install (default-install) @ hyperjaxb3-ejb-template-basic-maven --- [INFO] Installing C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\target\hyperjaxb3-ejb-template-basic-maven-0.6.0.jar to C:\Repository\org\jvnet\hyperjaxb3\hyperjaxb3-ejb-template-basic-maven\0.6.0\hyperjaxb3-ejb-template-basic-maven-0.6.0.jar [INFO] Installing C:\Projects\workspaces\hj3\dist\hyperjaxb3-ejb-template-basic-0.6.0\pom.xml to C:\Repository\org\jvnet\hyperjaxb3\hyperjaxb3-ejb-template-basic-maven\0.6.0\hyperjaxb3-ejb-template-basic-maven-0.6.0.pom [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.185 s [INFO] Finished at: 2014-10-09T00:56:18+01:00 [INFO] Final Memory: 22M/101M [INFO] ------------------------------------------------------------------------ 

我不知道它为什么不适合你。 请务必发布mvn clean install -Xdir /b/s日志,这样我就可以检查你的设置了。