4

特定のファイルjarから生成されたクラス ファイルを含むファイルを作成する方法はxsd?
からすべての Java ファイルをxsd作成し、コンパイルして作成する必要がありますjarか?
または、他の解決策があります。

誰でもプロセスを説明できますか?

4

3 に答える 3

3

futher XML<->POJO マッピングのために XSD から Java クラスを作成しようとしていると思います。私は正しいですか?

もしそうなら - それはあなたが使用するマッピングライブラリに依存します。JAXB 2 を使用しているとします。最も簡単な方法は、次のように XJC Maven プラグインを使用することです: http://mojo.codehaus.org/xjc-maven-plugin/usage.htmlすると、Maven はすべてを JAR にパッケージ化します。

于 2012-09-24T08:16:35.023 に答える
2
  1. Put your xsd file in some directory (call it resources for example)

  2. In command line navigate to the directory where the resources dir is located.

  3. Run jar cf jar-file %input-file_name% (input-file-name is 'resources' in your case)

Read more here.

I believe there are more elegant ways to ship static content (which the xsd is) However, you do not want to disclose your goal so that is how you create the jar.

Good luck!

于 2012-09-24T08:07:26.883 に答える