2017-01-10 5 views
2

私は、persistence.xmlを含む個別のjarを持っています。このjarは、そのエンティティを持つjarの親pomに依存関係として追加されています。静的製織を有効にしたい EclipseLink documentationによれば、設定としてpersistenceXMLLocationを指定できます。しかし、この場所は、私のpersistence.xmlの絶対ファイルパスかリポジトリ内のパスであるべきですか?また、製織を有効にしてエンティティのjarファイルを作成するにはどうすればよいですか?このプラグインを実行するためのmavenコマンドは何でしょうか?そのエンティティのプロジェクトのクラスパスにpersistence.xmlファイルを探して、ここで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 

は、プラグインが実行されたときに私が取得エラーです。

私が使用しています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

は、私が行方不明です何かはありますか?

+0

この最後のURL区切り文字は、-D:¥BRIDGE¥BRIDGE-PARTIAL¥DB¥persistence-config¥src¥main¥resources¥META-INF/persistence.xml – Rima

+0

@Rima:これは機能しません。とにかくこのエラーでは、メインプロジェクトのresourcesフォルダからpersistence.xmlを取得しようとしています – Amrita

答えて

1

あなたのような絶対パスで試してもうまくいかないです。

私は外部リソースファイルがベストプラクティスではないと思います。しかし、あなたはmaven-resources-plugin:2.6:リソースをプロセスリソース段階の<#maven-module>/target/classesにコピーするリソースでそれを行うことができます。

<resources> 
    <!-- ... --> 
    <resource> 
     <directory>D:/BRIDGE/BRIDGE-PARTIAL/DB/persistence-config/src/main/resources</directory> 
     <includes> 
      <include>META-INF/persistence.xml</include> 
     </includes> 
    </resource> 
</resources> 


そしてstaticweave-のmaven-pluginの:1.0.0:織りは、プロセス・クラスのフェーズで実行されます。したがって、persistence.xmlは<#maven-module> /target/classes/META-INF/persistence.xmlにあります。

使用相対パスとstaticweave-達人 - プラグインの構成で

<persistenceXMLLocation>META-INF/persistence.xml</persistenceXMLLocation> 

を設定します。

関連する問題