简体   繁体   English

JacORB:改变前缀和后缀

[英]JacORB: changing prefix and suffix

I would like to change package prefix and suffix in my ant build while generating java from idl. 我想在我的ant构建中更改包前缀和后缀 ,同时从idl生成java。 This has to be generic solution! 这必须是通用的解决方案! The idea goes like that: 这个想法是这样的:

I have idl files (ONE.idl, TWO.idl) with namespace ONE_cb in first and TWO_cb in second (as _cb suffix is required for c++ compatibility). 我有idl文件(ONE.idl,TWO.idl),第一个名称空间 ONE_cb ,第二个名称为TWO_cb(因为c ++兼容性需要_cb后缀)。 TWO_cb has atributes from ONE_cb, ONE_cb has only basic types. TWO_cb的属性来自ONE_cb,ONE_cb只有基本类型。 I want to change that to packages going like com.example.ONE and com.example.TWO . 我想将其更改为com.example.ONEcom.example.TWO之类的包。

I'm using JacORB 3.6. 我正在使用JacORB 3.6。 and I don't know how to do it. 而且我不知道该怎么做。
My code looks like that: 我的代码看起来像这样:

<target name="idlj-generate">
<idl2java
   srcdir="${psm.dir}/${project}/"
   destdir="${build.generated.dir}"
   includepath="${psm.dir}"
   all="true">
      <define key="__JACORB_GENERATE__"/>
      <i2jpackage names=":com.example"/>
      <i2jpackage names="_cb:"/>
</idl2java>
</target>

It doesn't work. 它不起作用。 As I stated before it has to be generic solution. 正如我之前所说,它必须是通用解决方案。 adding 加入

<i2jpackage names="TWO_cb:TWO"/> //option 2
<i2jpackage names="ONE_cb:ONE"/> //option 2b

Is not acceptable 是不能接受的

Thank you for Your time. 感谢您的时间。

If I understand you correctly you have something like 如果我理解你,你会有类似的东西

module ONE_cb
{
...
}

but you want it to be 但你想要它

com.example.ONE { ... }

This is feasible with i2jpackage eg 这对于i2jpackage是可行的,例如

idl -forceOverwrite -d /tmp/generated -i2jpackage ONE_cb:com.example.ONE myfile.idl

The problem you have is that you are compiling both files at once. 您遇到的问题是您正在同时编译这两个文件。 Remove the "all" and try compiling them in two phases. 删除“全部”并尝试分两个阶段进行编译。

If you are using Maven I would also recommend trying org.codehaus.mojo:idlj-maven-plugin as you can do multiple executions very easily with that. 如果您正在使用Maven,我还建议您尝试使用org.codehaus.mojo:idlj-maven-plugin,因为您可以非常轻松地执行多次执行。

To use multiple i2jpackage I got it working with 为了使用多个i2jpackage,我得到了它

idl -forceOverwrite -d /tmp/generated -all -i2jpackagefile /tmp/file antBugJac608-2.idl

(where antBugJac608-2 #includes antBugJac608). (其中antBugJac608-2 #include antBugJac608)。

For various research I concluded that generic solution is immpossible. 对于各种研究,我得出结论,通用解决方案是不可能的。 Only way to perform changing prefix and suffix the same time is to explicite set all included names. 只有在同一时间执行更改前缀和后缀的方法是明确设置所有包含的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM