我有一個單獨的jar包含persistence.xml。這個jar被添加爲具有實體的jar的父pom中的依賴項。我想啓用靜態編織。 根據EclipseLink documentation,我可以指定persistenceXMLLocation作爲配置。但是,如果此位置是我的persistence.xml或其存儲庫中的路徑的絕對文件路徑。另外我怎樣才能建立我的實體jar啓用編織?執行這個插件的maven命令是什麼?如何使用Maven在遠程persistence.xml中啓用eclipseLink中的靜態編織?
以下是執行插件時,我得到的錯誤:
Failed to execute goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave (default-cli) on project BRBASE-techl-entities: Execution default-cli of goal de.empulse.eclipselink:staticweave-maven-plugin:1.0.0:weave failed:
[ERROR] Exception Description: An exception was thrown while trying to load persistence unit at url: file:/D:/BRIDGE/BRIDGE-PARTIAL/BRBASE_Branch_selective_fetch/src/core/techl/entities/target/classes/
[ERROR] Internal Exception: Exception [EclipseLink-30004] (Eclipse Persistence Services - 2.5.1.v20130824-981335c): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
[ERROR] Exception Description: An exception was thrown while processing persistence.xml from URL: file:/D:/BRIDGE/BRIDGE-PARTIAL/BRBASE_Branch_selective_fetch/src/core/techl/entities/target/classes/
[ERROR] Internal Exception: java.net.MalformedURLException: NullPointerException
在這裏,它尋找的實體項目的類路徑persistence.xml文件。
我使用mvn命令是:
de.empulse.eclipselink:staticweave-maven-plugin:weave
插件是:使用
<plugin>
<groupId>de.empulse.eclipselink</groupId>
<artifactId>staticweave-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
<configuration>
<logLevel>FINE</logLevel>
<persistenceXMLLocation>D:\BRIDGE\BRIDGE-PARTIAL\DB\persistence-config\src\main\resources\META-INF\persistence.xml</persistenceXMLLocation>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.5.1-RC1</version>
</dependency>
<dependency>
<groupId>com.mindtree.bridge.platform.db</groupId>
<artifactId>BRDB-persistence-config</artifactId>
<version>${db.version}</version>
</dependency>
</dependencies>
</plugin>
的EclipseLink版本:2.5.1-RC1
是有什麼我失蹤?
D:\ BRIDGE \ BRIDGE-PARTIAL \ DB \ persistence-config \ src \ main \ resources \ META-INF/persistence.xml中的最後一個URL分隔符 – Rima
@Rima:這是行不通的。無論如何,在錯誤中,它顯示它試圖從主項目的資源文件夾中獲取persistence.xml – Amrita