osb 12c部署的Ant脚本

时间:2016-10-25 10:54:28

标签: java ant middleware osb wlst

我正在创建用于部署的OSB 12c ant脚本。我需要它与hudson集成。我创建的脚本如下:

<?xml version="1.0" encoding="UTF-8" ?>
<project name="CompileDeployOsbProject" default="main" basedir=".">

    <property file="build.properties"/>
    <property name="settingsFile" location="settings.xml" /> 

    <path id="configjar.path">
        <pathelement path="${osb.home}/tools/configjar/configjar.jar"/>
    </path>

    <taskdef name="configjar"
             classname="com.bea.alsb.tools.configjar.ant.ConfigJarTask"
             classpathref="configjar.path"/>

     <taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask">
        <classpath>
            <pathelement location="${wl.home}/server/lib/weblogic.jar"/>
        </classpath>
    </taskdef>

    <target name="setEnv">
      <exec executable="cmd">
        <arg value="/c"/>
        <arg value="${osb.home}/tools/configjar/setenv.bat"/>
      </exec>
    </target>

    <target name="compileOsbProjectJava" >
        <java classname="org.apache.tools.ant.launch.Launcher" fork="true" failonerror="true">
            <sysproperty key="weblogic.home" value="${wl.home}"/>
            <sysproperty key="osb.home" value="${osb.home}"/>
            <arg value="-buildfile"/>
            <arg file="build.xml"/>
            <arg value="compileOsbProject"/>
        </java>
    </target>

    <target name="compileOsbProject">
        <fail unless="settingsFile"/>
        <property name="task.debug" value="false"/>
        <property name="task.failonerror" value="true"/>
        <property name="task.errorproperty" value=""/>
        <configjar failonerror="${task.failonerror}"
                   errorProperty="${task.errorproperty}"
                   settingsFile="${settingsFile}"></configjar>
    </target>

    <path id="class.path">
      <fileset dir="${osb.home}/lib">
         <include name="*.jar"/>
      </fileset>
      <fileset dir="${osb.home}/lib/modules">
         <include name="*.jar"/>
      </fileset>
      <fileset dir="${mw.home}/oep/common/modules">
         <include name="com.bea.common.configfwk_1.3.0.0.jar"/>
      </fileset>
      <fileset dir="${wl.home}/server/lib">
         <include name="*.jar"/>
      </fileset>
      <fileset dir="${wl.home}/modules/features">
         <include name="*.jar"/>
      </fileset>
      <fileset dir="${mw.home}/oracle_common/modules">
         <include name="com.oracle.cie.config-wls_8.4.0.0.jar"/>
      </fileset>
    </path>

    <target name="deployOsbProject" depends="compileOsbProjectJava">
        <wlst fileName="importOsbProject.py" debug="true" failOnError="false" classpathref="class.path"  
              arguments="${username} ${password} ${adminUrl} ${configproject} ${configjar} ${customizationFile}">  
         <script>  
           adminUser=sys.argv[1]
           adminPassword=sys.argv[2]
           adminUrl=sys.argv[3]
           passphrase = "Osb Project Deployed using Ant Script Automation"
           project=sys.argv[4]
           importJar=sys.argv[5]
           customFile=sys.argv[6]
           connect(adminUser,adminPassword,adminUrl) 
           domainRuntime()
         </script>
        </wlst>
   </target>

    <target name="cleanup">
      <delete file="sbconfig.jar" />
      <delete dir="security" />
   </target>

   <target name="main" depends="setEnv, compileOsbProjectJava, deployOsbProject, cleanup"/>

</project>

在ant文件中我提到了ant.home和java.home的路径。

java.home               =       D:/Java/jdk1.8.0_77
ant.home                =       D:/Hudson/ant1.9.4/apache-ant-1.9.4

现在从ant错误运行此脚本如下: compileOsbProjectJava: [java] Error: Could not find or load main class org.apache.tools.ant.launch.Launcher

由于以下代码部分发生错误:

 <taskdef name="wlst" classname="weblogic.ant.taskdefs.management.WLSTTask">
    <classpath>
        <pathelement location="${wl.home}/server/lib/weblogic.jar"/>
    </classpath>
</taskdef>

据我所知,此类路径覆盖了我从setEnv目标设置的先前值。因此,这是错误的。这个错误的可能解决方案是什么。

0 个答案:

没有答案