我正在尝试通过学习本教程来学习hyperjaxb
。我遵循了所有指示,直到标题部分What was Generated?
。这包括以下步骤:
1.) download the <a href="http://confluence.highsource.org/display/HJ3/Downloads">Basic Project Template for Hibernate and Maven</a>
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
并run as...maven build
在新的Eclipse Maven项目中进行了尝试,但同样缺少结果。
如何使本教程生成预期的生成文件?
另外,是否有更好的方法从xsd生成JPA实体?
根据@kapep的建议,我尝试mvn generate-sources
并获得了以下结果:
然后mvn clean install
,我再次尝试,并得到以下结果:
您可以在打印屏幕上看到org.apache.maven.plugins:maven-compiler- plugin
缺少的警告。我在.m2
机器上的存储库中找到了相应的文件夹并将其删除,然后maven update project
在eclipse中执行了一个操作,以重新下载该库。然后mvn clean install
,我又做了一个,结果也一样。没有生成任何内容,没有java文件,没有generated-sources
目录。没有。
我还能尝试什么?
教程应用程序仍然无法生成预期的文件,但是,通过将pom的maven-compiler-plugin部分更改为以下内容,我能够摆脱打印屏幕中的警告消息:
<plugin>
<inherited>true</inherited>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
请注意,除了指定版本之外,我还根据本帖子@Todd的建议,将source
and target
从更改为1.5
to
。我假设这些是指JDK版本。我的安装使用JDK 1.6。我不知道这是否会引起任何问题。1.6
我还能尝试什么?
更新
最终,OP似乎在项目的根目录中而不是在寻找生成的类target\generated- source\xjc
,尽管该教程明确指出了查找位置:
如果浏览target / 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 <jaxb:globalBinding localScoping="toplevel"/> 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
(e.g., through a remote interface), the entity class must implement
the Serializable interface."
Your JAXB model is not customized as serializable, please use the <jaxb:serializable/> 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, i.e. 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, i.e. 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, i.e. 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, i.e. 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
-------------------------------------------------------
T E S T S
-------------------------------------------------------
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:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purchaseOrder orderDate="1999-10-20">
<shipTo country="US">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<billTo country="US">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo>
<comment>Hurry, my lawn is going wild!</comment>
<items>
<item partNum="872-AA">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<comment>Confirm this is electric</comment>
</item>
<item partNum="926-AA">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
RoundtripTest
Source object:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purchaseOrder orderDate="1999-10-20" Hjid="1">
<shipTo country="US" Hjid="2">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<billTo country="US" Hjid="1">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo>
<comment>Hurry, my lawn is going wild!</comment>
<items Hjid="1">
<item partNum="872-AA" Hjid="1">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<comment>Confirm this is electric</comment>
</item>
<item partNum="926-AA" Hjid="2">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
RoundtripTest
Result object:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<purchaseOrder orderDate="1999-10-20" Hjid="1">
<shipTo country="US" Hjid="2">
<name>Alice Smith</name>
<street>123 Maple Street</street>
<city>Mill Valley</city>
<state>CA</state>
<zip>90952</zip>
</shipTo>
<billTo country="US" Hjid="1">
<name>Robert Smith</name>
<street>8 Oak Avenue</street>
<city>Old Town</city>
<state>PA</state>
<zip>95819</zip>
</billTo>
<comment>Hurry, my lawn is going wild!</comment>
<items Hjid="1">
<item partNum="872-AA" Hjid="1">
<productName>Lawnmower</productName>
<quantity>1</quantity>
<USPrice>148.95</USPrice>
<comment>Confirm this is electric</comment>
</item>
<item partNum="926-AA" Hjid="2">
<productName>Baby Monitor</productName>
<quantity>1</quantity>
<USPrice>39.98</USPrice>
<shipDate>1999-05-21</shipDate>
</item>
</items>
</purchaseOrder>
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 -X
和dir /b/s
日志,以便我可以检查您的设置。
问题内容: 我有以下代码。但是,文件和是0字节。为什么不工作? 问题答案: 问题出在您的用法上-这是不正确的,并且在实现中掩盖了一个非常重要的异常- 。 问题是您不能使用RSA密钥来加密长度超过密钥大小(示例中为128字节)的数据。您应该对大数据块使用对称加密算法,例如 AES 。 如果您出于某种原因(例如安全传输数据)使用非对称密钥- 您可以在此SO答案中找到一个很好的示例。
我正试图从各种类中生成清晰的文档,所有的JAX-RS都有注释,一些用java编写,一些用clojure编写。 我构建了一个maven项目,它只是依赖于包含服务类的war文件: 我无法生成任何服务文档。 当运行mvn发音:docs-X时,我看到我的类“注意到了”: [调试]注意到类 WEB-INF.classes.com.ws.scholar.resources.ClientResource in
使用 Hexo 生成静态文件快速而且简单。 $ hexo generate 监视文件变动 Hexo 能够监视文件变动并立即重新生成静态文件,在生成时会比对文件的 SHA1 checksum,只有变动的文件才会写入。 $ hexo generate --watch 完成后部署 您可执行下列的其中一个命令,让 Hexo 在生成完毕后自动部署网站,两个命令的作用是相同的。 $ hexo generate
问题内容: 我看到libgdx的1.3.0版本可用,所以我明白了,当我使用项目设置来设置项目时,我检查eclipse的“高级”>“ build”并点击“ generate”,但是当我尝试将其导入eclipse时,它说找不到项目。在1.3.0发行之前,版本1.2.0对我来说是完美的,现在我什至无法获得用于构建eclipse文件的版本。任何修复,我不使用gradle。 问题答案: 新的ADT 23.0
我正在为unity开发一个android插件,需要生成一个jar文件。为此,我遵循https://stackoverflow.com/a/20446513/3742608中的步骤,将构建变体设置为release,重建项目并执行MakeJar。然而,我的项目确实有gradle只在另一个文件夹“中间”中使用的文件夹: 我将一些内容更改为以下内容,但没关系,不会生成jar文件。 bundles/rele
我正在尝试将一个网站从Heroku迁移到AWS,但在代码构建方面遇到了麻烦。源代码在GitHub上,我使用的是CodePipeline-CodeBuild-Elastic Beanstalk。管道运行良好,代码似乎正在向Elastic Beanstalk过渡。然而,我被困在代码构建步骤。(buildspec.yml如下所示) 日志似乎可以很好地运行命令,但是当我将构建输出到S3存储桶时,没有构建文