私はElipse Indigo、maven 2.2.1、m2e 1.0.2、wtp 0.15.2のmaven統合、JiBX 1.2.3のm2eコネクタを使用しています。
私は、jibx バインディングを含む共有 Maven jar アーティファクトを持っています。この .project ファイルは次のようになります。
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-binding</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jibx.eclipse.JibxBindingBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.jibx.eclipse.JibxNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>
m2e Maven Eclipse Pluginをセットアップするために与えられた指示に従いました。build-helper-maven-plugin (Eclipse コネクタ付き) を使用して、ソース フォルダーに生成されたソースを含めました。
これを Eclipse でコンパイルすると、JiBX バインディングは正常に実行されます。JiBX コンソールに出力が表示され、target/classes ディレクトリに変更されたクラスが表示されます。
次に、この生成された jar を戦争アーティファクトで使用します。
プロジェクト ファイル:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-webapp</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
私の生成しorg.eclipse.wst.common.component
たファイルは(一部)です:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="my-webapp">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="my-binding-1.79.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/my-binding/my-binding">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="my-webapp"/>
<property name="java-output-path" value="/my-webapp/target/classes"/>
</wb-module>
</project-modules>
「公開せずにモジュールを提供する」および「自動的に公開しない」オプションを設定して wtp を実行します。jar 内の jibx で変更されたクラスを参照しようとするとjava.lang.NoSuchMethodError
、JiBX で生成されたメソッドを参照するときに標準が取得されます。バインディング プロジェクトのターゲット ディレクトリには、jibx で変更されたクラス ファイルがまだ含まれています。
パスが間違っている可能性がありますが、jar アーティファクトの .project ファイルを変更して wtp の追加された性質をスキップすると、次のように my-binding プロジェクトを再構築するとうまくいくようです。
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>my-binding</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jibx.eclipse.JibxBindingBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.jibx.eclipse.JibxNature</nature>
</natures>
</projectDescription>
.. webapp を再起動すると、問題なく動作します。webapp を再構築すると、性質がバインディング プロジェクトに追加され、再び破損します。
ここにはトリックがありません (古い wtp-eclipse ダンスが過去のものであることを願っていました)。何か案は?
更新: さらにプレイした後、これを共有クラスの壊れたバインディングに絞り込みました
コマンドラインからビルドする場合、すべてのバインディングが一度にビルドされるように見えます (または、少なくとも依存関係の jar 内のクラスを変更しないでください)。しかし、Eclipse プラグインを使用してビルドすると、さまざまなプロジェクトが「以前のバインディング」、これの構造化されたバインディングのセクションによると、ファクトリ クラスが壊れます。
共通のクラス バインディングをプリコンパイル済みのインクルードにプルする作業を行っていますが、それは小さな仕事ではありません。かなり多くの共有クラスがあり、変更を行うときに誰かが共有オブジェクト バインディングを見逃すことは避けられません。各プロジェクトに関連付けられたバインディングにラベルを付ける (名前を付ける) 方法はありますか?これにより、複数のファクトリ クラスを上書きするのではなく、共通のクラス パッケージに存在させることができます。
com.alfonzo.common
shared.class
foobar1_JiBX_bindingFactory.class
foobar2_jibx_bindingFactory.class
したがって、プロジェクト foobar1 は、共有クラスを含むバインディングを構築してそのファクトリーを参照でき、プロジェクト foobar2 は別のファクトリーを参照できます。
それとも私はこれを完全に誤解していますか?...