我正在尝试用idlj-maven-plugin在Maven项目中包含一个Corba .idl文件。.idl文件指定了某个模块,比如
module Tester
{
interface Test {
void sayHello();
}
}我希望生成的类属于包com.mycompany.tester。我试过使用
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>idlj-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<debug>true</debug>
<compiler>jacorb</compiler>
<sourceDirectory>../../idl</sourceDirectory>
<source>
<packageTranslations>
<packageTranslation>
<type>Tester</type>
<package>com.mycompany.tester</package>
</packageTranslation>
</packageTranslations>
</source>
</configuration>
</plugin>但它似乎完全没有效果。我还尝试将idlj用作<compiler>,或者使用
<additionalArguments>
<additionalArgument>
-i2jpackage Tester:com.mycompany.tester
</additionalArgument>
</additionalArguments>但似乎没有任何效果。
有什么想法吗?
发布于 2012-08-28 05:01:51
我已经设法让一切都以这种方式工作:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>idlj-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<debug>true</debug>
<compiler>jacorb</compiler>
<sourceDirectory>../../idl</sourceDirectory>
<sources>
<source>
<additionalArguments>
<list>-i2jpackage</list>
<list>Tester:com.mycompany.tester</list>
</additionalArguments>
</source>
</sources>
</configuration>
</plugin>在使用<additionalArguments>时,我使用的是<compiler>idlj</compiler>
<additionalArguments>
<list>-pkgTranslate</list>
<list>Tester</list>
<list>com.mycompany.tester</list>
</additionalArguments>发布于 2015-02-16 09:26:05
使用idlj命令更容易
==== your tester.idl ====
module tester
{
interface Test {
void sayHello();
}
}
===========================您可以使用带有选项-pkgPrefix的idlj将java文件生成到某个包,如下所示
idlj -pkgPrefix tester com.mycompany -fall tester.idl发布于 2020-03-24 01:10:22
尽管idlj-maven-plugin用法页面中的示例提供了不同的建议,但您必须将源选项包装在sources元素中:
<configuration>
<compiler>jacorb</compiler>
<sources>
<source>
<packagePrefix>com.acme</packagePrefix>
</source>
</sources>
</configuration>https://stackoverflow.com/questions/12149000
复制相似问题