0

super.war内にパッケージ化されるstandalone.jarがあります。Stanalone.jarはsuper.warの関数を使用します。私の混乱は、戦争でクラス内の機能を開発しているときに、super.warからメソッドを呼び出すにはどうすればよいですか?どちらもEclipseの異なるプロジェクトです。

詳細については、以下をご覧ください。

Super.warには、getMotorsというメソッドを持つMotorsというクラスがあります。standalone.jarには、super.warのgetMotorsを呼び出す必要があるCustomerというクラスがあります。さて、私の質問は、オブジェクトを作成し、jarにあるCustomersクラス内で戦争中のMotorsクラスのメソッドを呼び出すにはどうすればよいかということです。

助けてください。

ありがとうございました

4

2 に答える 2

2

You need the project containing the Motors class to be on the build path of the standalone.jar project.

If you also need the standalone.jar project to be on the build path of the WAR project, then it seems you have a cyclic dependency between these projects which you should break; perhaps by putting the common classes in a 3rd project/jar.

于 2012-10-11T15:30:30.023 に答える
1

You can't. By doing this, standalone.jar wouldn't be so standalone any more. :) You would probably create a circle-ref.

You'll have to find a way to use some common interface.

于 2012-10-11T15:30:07.637 に答える