【问题标题】:how to use idlj-maven-plugin to generate java files如何使用idlj-maven-plugin生成java文件
【发布时间】:2016-02-19 20:40:19
【问题描述】:

我有一个名为 common 的项目。我尝试使用 idlj-maven-plugin 从 IDL 文件生成 java 源代码,但一次又一次失败。我在 Idl/ 文件夹下有多个文件,它们与 pom.xml 位于同一路径。 我有另一个名为通道的项目,其中包含 IDL 文件,但是项目通道中的那些文件使用使用 include 共同定义的 idl 文件。如何使用 idlj-maven-plugin 生成 java 源代码?我需要使用 idlj 或 jacorb 作为编译器吗?我想念什么?谢谢!

对于普通项目,我的配置如下:

<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>
                    <compiler>jacorb</compiler>
                    <sourceDirectory>Idl</sourceDirectory>
                </configuration>
            </plugin>

【问题讨论】:

    标签: java maven corba jacorb idlj


    【解决方案1】:

    JacORB 使用 idlj-maven-plugin 来生成它的存根。插件配置可以在 https://github.com/JacORB/JacORB/blob/master/pom.xml#L415 找到,它在 hello 演示中的使用示例是 https://github.com/JacORB/JacORB/blob/master/demo/hello/pom.xml#L29

    请注意,idl 文件存储在(用于 hello 演示)src/main/idl/server.idl 中

    【讨论】:

    • 谢谢你,尼克,但我的 idl 文件在 Idl 文件夹下,我可以定义 sourceDirectory 吗?
    • 查看 IDLJMojo 的源代码,sourceDirectory 的默认值为 ${basedir}/src/main/idl,因此您应该能够配置和覆盖它。您可能应该为您希望使用的 JacORB 版本添加一个依赖项(根据我的示例)。
    • 非常感谢Nick,终于知道怎么配置了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-07
    • 1970-01-01
    相关资源
    最近更新 更多