Ant、Maven 和 Jdeveloper SOA 扩展

发布于 2024-10-02 06:09:40 字数 3105 浏览 1 评论 0原文

我们正在进行一个大型 Java EE 项目/计划。到目前为止,我们一直在使用 Eclipse 和 Maven 进行开发。我们的目标应用程序服务器是 WebLogic(现在是 Oracle)。
我们已决定开始使用 Oracle 业务规则(Oracle SOA Suite 11g 的一部分)。 Soa Suite 的开发仅限于 JDeveloper。它有一些很好的 ant 脚本来构建和部署 SOA 组合(这就是规则的打包和部署方式)。
我的任务是使用 antrun 从 Maven 运行这些 ant 脚本,我已经得到了一些方法,但不是全部......
我的主要问题是:有人成功做到这一点吗? (有没有人尝试过......?无法真正找到任何谷歌搜索......)

下面是我的pom的相关部分:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
      <execution>
        <phase>compile</phase>
        <configuration>
          <target>
            <property name="oracle.home" value="C:\Oracle\Middleware\jdeveloper"/>
            <property name="oracle.soa.mgmt.home" value="C:\Oracle\Middleware\jdeveloper"/>
            <property name="common.components.home" value="C:\Oracle\Middleware\oracle_common"/>
            <property name="env.JAVA_HOME" value="${java.home}"/>
            <property name="env.PWD" value="."/>
            <ant antfile="${oracle.home}\bin\ant-sca-compile.xml"/>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

Maven是从Oracle/中间件树之外的项目目录运行的。这几乎有效...
实际上,它给出了以下结果:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building BilagorReglerSCA
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks

main:

scac:
Validating composite "C:\JDeveloper\mywork\BilagorReglerSCA\BilagorRegler\composite.xml"
     [scac] oracle.fabric.common.wsdl.XSDException: Error loading schema from file:/C:/JDeveloper/mywork/BilagorReglerSCA/BilagorRegler/BilagorRegler_DecisionService.wsdl [Cause=Error in getting XML input stream: oramds:/soa/shared/rules/BpelProcess.xsd: oracle.mds.exception.MDSException: MDS-00054: Filen som ska laddas oramds:/soa/shared/rules/BpelProcess.xsd finns inte.]
     [scac]     at oracle.fabric.common.wsdl.SchemaBuilder.loadEmbeddedSchemas(SchemaBuilder.java:496)
     [scac]     at oracle.fabric.common.wsdl.SchemaBuilder.loadSchemasFromWSDL(SchemaBuilder.java:365)
...

短语“Filen som ska laddas oramds:/soa/shared/rules/BpelProcess.xsd finns inte.”意味着“您尝试加载的文件不存在”(为什么我的客户坚持安装瑞典语版本的 Windows,而不是国际版本?)。
ant-sca-compile.xml 包含许多与此类似的导入语句:

     <fileset dir="${common.components.home}/modules">
        ...
        <include name="oracle.mds_11.1.1/oramds.jar"/>

我假设需要 oramds.jar 来处理 oramds-URL:s,它在 JDeveloper 生成的 WSDS/XSD:s 中使用。

任何帮助表示赞赏...

We are in the middle of a large Java EE project/programme. Up to this point, we've been using Eclipse and Maven for our development. The appserver we are targeting is WebLogic (Oracle, these days).
It has been decided we are going to start using Oracle Business Rules (Part of Oracle SOA Suite 11g). Development for Soa Suite is confined to JDeveloper. It has some nice ant scripts to build and deploy SOA Composites (which is how rules are packaged and deployed).
I have been tasked with getting these ant scripts to run from maven using antrun, and I've gotten some of the way, but not all...
My main question is: has anyone succeeded doing this? (Has anyone even attempted..? Can't really find anything googling...)

Below is the relevant part of my pom:

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.6</version>
    <executions>
      <execution>
        <phase>compile</phase>
        <configuration>
          <target>
            <property name="oracle.home" value="C:\Oracle\Middleware\jdeveloper"/>
            <property name="oracle.soa.mgmt.home" value="C:\Oracle\Middleware\jdeveloper"/>
            <property name="common.components.home" value="C:\Oracle\Middleware\oracle_common"/>
            <property name="env.JAVA_HOME" value="${java.home}"/>
            <property name="env.PWD" value="."/>
            <ant antfile="${oracle.home}\bin\ant-sca-compile.xml"/>
          </target>
        </configuration>
        <goals>
          <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

Maven is run from the project dir, outside the Oracle/Middleware tree. This almost works...
Actually, it gives the following result:

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building BilagorReglerSCA
[INFO]    task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] Nothing to compile - all classes are up to date
[INFO] [antrun:run {execution: default}]
[INFO] Executing tasks

main:

scac:
Validating composite "C:\JDeveloper\mywork\BilagorReglerSCA\BilagorRegler\composite.xml"
     [scac] oracle.fabric.common.wsdl.XSDException: Error loading schema from file:/C:/JDeveloper/mywork/BilagorReglerSCA/BilagorRegler/BilagorRegler_DecisionService.wsdl [Cause=Error in getting XML input stream: oramds:/soa/shared/rules/BpelProcess.xsd: oracle.mds.exception.MDSException: MDS-00054: Filen som ska laddas oramds:/soa/shared/rules/BpelProcess.xsd finns inte.]
     [scac]     at oracle.fabric.common.wsdl.SchemaBuilder.loadEmbeddedSchemas(SchemaBuilder.java:496)
     [scac]     at oracle.fabric.common.wsdl.SchemaBuilder.loadSchemasFromWSDL(SchemaBuilder.java:365)
...

The phrase "Filen som ska laddas oramds:/soa/shared/rules/BpelProcess.xsd finns inte." means the "file you are trying to load does not exist" (why does my client insist on installing Swedish language version of Windows, rather than international?).
ant-sca-compile.xml contains numerous import statements similar to this:

     <fileset dir="${common.components.home}/modules">
        ...
        <include name="oracle.mds_11.1.1/oramds.jar"/>

I assume oramds.jar is needed to process oramds-URL:s, which are used in the WSDS/XSD:s JDeveloper generates.

Any help appreciated...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我偏爱纯白色 2024-10-09 06:09:40

好的,所以我最终有机会与一位 Oracle 王牌顾问坐下来并让其发挥作用。

这就是我们想到的:

<properties>
    <oracle.fmw.soa.home>C:/Oracle/Middleware</oracle.fmw.soa.home>
    <!-- this is relative reference to JDK / Jrockit from ant-sca-compile|*.xml. For jdev it is ../../, for Soa Suite: TBD. -->
    <env.JAVA_HOME>../../jdk160_24</env.JAVA_HOME>
    <!-- For real server with Soa Suite installed use: Oracle_SOA1, for devenv use jdeveloper -->
    <oracle.fmw.productName>jdeveloper</oracle.fmw.productName>
    <antOutputDir>deploy</antOutputDir>
    <mvnOutputDir>target</mvnOutputDir>
</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>sca-compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <property name="scac.input" value="${basedir}/composite.xml" />
                            <property name="scac.application.home" value="${basedir}/.." />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-compile.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/"
                                target="scac" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-package</id>
                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target name="package">
                            <property name="build.compiler" value="extJavac" />
                            <property name="compositeName" value="${project.artifactId}" />
                            <property name="compositeDir" value="${basedir}" />
                            <property name="revision" value="${project.version}" />
                            <property name="scac.application.home" value="${basedir}/.." />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <property name="antOutputFile" value="sca_${project.artifactId}_rev${project.version}.jar" />
                            <property name="mvnOutputFile" value="${project.artifactId}-${project.version}.jar" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-package.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="package" />
                            <copy tofile="${mvnOutputDir}/${mvnOutputFile}" file="${antOutputDir}/${antOutputFile}" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-deploy</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target name="deploy">
                            <property name="serverURL" value="${weblogic.serverURL}" />
                            <property name="user" value="${weblogic.user}" />
                            <property name="password" value="${weblogic.password}" />
                            <property name="sarLocation" value="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" />
                            <property name="overwrite" value="true" />
                            <property name="forceDefault" value="true" />
                            <property name="partition" value="default" />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-deploy.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="deploy" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-test</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <property name="jndi.properties.input" value="${basedir}/sca-test.jndi.properties" />
                            <property name="scatest.input" value="scatestinput" />
                            <property name="scatest.format" value="junit" />
                            <property name="scatest.result" value="reports" />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-test.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="test" />
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

注意,ant-tag 的属性和参数集与我最初尝试的不同。

要在 CI 服务器上运行,显然需要本地安装 JDeveloper 或 SOA Suite。 weblogic.serverURLweblogic.userweblogic.password 需要设置为你相应的环境(我使用的配置文件为 local/dev/tst /ETC...)。

除此之外,它就像一个魅力......

OK, so I eventually got a chance to sit down with an ace Oracle consultant and get this to work.

This is what we came up with:

<properties>
    <oracle.fmw.soa.home>C:/Oracle/Middleware</oracle.fmw.soa.home>
    <!-- this is relative reference to JDK / Jrockit from ant-sca-compile|*.xml. For jdev it is ../../, for Soa Suite: TBD. -->
    <env.JAVA_HOME>../../jdk160_24</env.JAVA_HOME>
    <!-- For real server with Soa Suite installed use: Oracle_SOA1, for devenv use jdeveloper -->
    <oracle.fmw.productName>jdeveloper</oracle.fmw.productName>
    <antOutputDir>deploy</antOutputDir>
    <mvnOutputDir>target</mvnOutputDir>
</properties>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.6</version>
            <executions>
                <execution>
                    <id>sca-compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <property name="scac.input" value="${basedir}/composite.xml" />
                            <property name="scac.application.home" value="${basedir}/.." />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-compile.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/"
                                target="scac" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-package</id>
                    <phase>package</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target name="package">
                            <property name="build.compiler" value="extJavac" />
                            <property name="compositeName" value="${project.artifactId}" />
                            <property name="compositeDir" value="${basedir}" />
                            <property name="revision" value="${project.version}" />
                            <property name="scac.application.home" value="${basedir}/.." />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <property name="antOutputFile" value="sca_${project.artifactId}_rev${project.version}.jar" />
                            <property name="mvnOutputFile" value="${project.artifactId}-${project.version}.jar" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-package.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="package" />
                            <copy tofile="${mvnOutputDir}/${mvnOutputFile}" file="${antOutputDir}/${antOutputFile}" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-deploy</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target name="deploy">
                            <property name="serverURL" value="${weblogic.serverURL}" />
                            <property name="user" value="${weblogic.user}" />
                            <property name="password" value="${weblogic.password}" />
                            <property name="sarLocation" value="${basedir}/deploy/sca_${project.artifactId}_rev${project.version}.jar" />
                            <property name="overwrite" value="true" />
                            <property name="forceDefault" value="true" />
                            <property name="partition" value="default" />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-deploy.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="deploy" />
                        </target>
                    </configuration>
                </execution>
                <execution>
                    <id>sca-test</id>
                    <phase>deploy</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <target>
                            <property name="jndi.properties.input" value="${basedir}/sca-test.jndi.properties" />
                            <property name="scatest.input" value="scatestinput" />
                            <property name="scatest.format" value="junit" />
                            <property name="scatest.result" value="reports" />
                            <property name="oracle.home" value="${oracle.fmw.soa.home}/${oracle.fmw.productName}" />
                            <ant
                                antfile="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin/ant-sca-test.xml"
                                dir="${oracle.fmw.soa.home}/${oracle.fmw.productName}/bin"
                                target="test" />
                        </target>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Note, both different sets of properties and parameters to the ant-tag than what I was originally attempting with.

To run on a CI-server, you obviously need a local install of JDeveloper or SOA Suite. weblogic.serverURL, weblogic.user and weblogic.password needs to be set to your corresponding environment (I use profiles for local/dev/tst/etc...).

Other than that, it works like a charm...

仙气飘飘 2024-10-09 06:09:40

我没有使用过 Maven + Oracle SOA 构建脚本,但通常在使用任何 Oracle 部署工具(ADF、SOA 等)时,您需要在 Oracle SOA 主目录或 JDev 主目录(带有 SCA 扩展)上安装构建运行所在的同一台机器。您需要正确设置 Ant 环境变量,例如 oracle.home 和 common.components.home 等

I've not used Maven + Oracle SOA build scripts but generally when using any of the Oracle deployment tools (ADF, SOA, etc) you will need to have either an Oracle SOA Home or a JDev home (with the SCA extension) on the same machine that the build is running on. You'll need to set the Ant environment variables correctly e.g. oracle.home and common.components.home etc

坚持沉默 2024-10-09 06:09:40

使用ant-sca-package.xml(不是ant-sca-compile.xml):

<ant antfile="ant-sca-package.xml" dir="${env.BEA_HOME}/jdeveloper/bin">
  <property name="compositeDir" value="@{compositeDir}" />
  <property name="compositeName" value="@{compositeName}" />
  <property name="revision" value="${deploy.revision}" />
</ant>

Use ant-sca-package.xml (not ant-sca-compile.xml):

<ant antfile="ant-sca-package.xml" dir="${env.BEA_HOME}/jdeveloper/bin">
  <property name="compositeDir" value="@{compositeDir}" />
  <property name="compositeName" value="@{compositeName}" />
  <property name="revision" value="${deploy.revision}" />
</ant>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文