问题描述
有人可以帮我写javax.persistence
的依赖项吗?我已经用谷歌搜索了,但是没有用.
Can someone help me write the dependency for javax.persistence
. I have googled it but nothing worked.
我跳入此页面,其中提供了有关如何写依赖关系,但我却无法写它.有人可以帮我吗?
I bumped into this page that gives some details on how to write the dependency, but yet i am unable to write it. Can someone help me out?
推荐答案
这是javax.persistence
的那个:
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
这适用于整个Java EE 6堆栈:
and this is for the whole Java EE 6 stack:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
修改
注意,我在这里指定了provided
范围,这意味着您的依赖项在编译和测试时可用,但不会打包到您的工件中.如果您希望将工件部署在应用程序服务器中,则通常需要这样做,因为它们提供了自己的api实现.
Edit
Note that I specified a provided
scope here, which means that your dependency is available at compile- and test-time, but will not be packaged into your artifacts. This is usually needed if you want to deploy your artifacts in an application server, since they provide their own implementation of the api.
这篇关于为javax.persistence编写Maven依赖关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!