小编Jua*_*013的帖子

Eclipse Maven Project中找不到persistence.xml

我无法修复persistence.xml file not foundeclipse问题,这是一个简单的测试项目(Maven Nature),用于非常基本的EJB测试,该文件确实在src/main/resources/META-INF/...这是pom.xml的内容.尝试将文件夹添加到项目的构建路径,更新maven项目.到目前为止没有运气,任何帮助将不胜感激,谢谢!

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>LibEE</groupId>
  <artifactId>LibEE</artifactId>
  <packaging>jar</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>

      <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>main.resources.Main</mainClass>

</manifest>
</archive>
</configuration>
</plugin>
   </plugins>
  </build>

  <dependencies>
    <dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.1.0</version>
    </dependency>

     <dependency>
    <groupId>org.ow2.spec.ee</groupId>
    <artifactId>ow2-ejb-3.0-spec</artifactId>
    <version>1.0.13</version>
</dependency>

<dependency>
<groupId>org.glassfish.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>


  </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

这是persistence.xml:

    <?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">

<persistence-unit name="LibEE" transaction-type="JTA">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/LibEE</jta-data-source> <!-- Refers to data …
Run Code Online (Sandbox Code Playgroud)

java eclipse jpa persistence.xml maven

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

eclipse ×1

java ×1

jpa ×1

maven ×1

persistence.xml ×1