代码之家  ›  专栏  ›  技术社区  ›  Prakruti Pathik

无法从glue with cucumber ant任务中识别步骤定义文件

  •  0
  • Prakruti Pathik  · 技术社区  · 5 年前

    连接完成生成.xml和类路径详细信息属性.xml文件

         <?xml version="1.0" encoding="UTF-8"?>
    
    <project name="DSP" basedir="." default="usage">
    
        <description>HP DSP Ant Build file</description>
    
        <!-- Global properties file -->
        <import file="${basedir}/properties.xml"/>
    
        <!-- Deployment specific property file -->
        <property file="${basedir}/config.properties" />
    
        <!-- Ensure that the JVM version is 1.7 -->
        <target name="get-jvm">
            <condition property="jvm.ok">
                <equals arg1="${ant.java.version}" arg2="1.7" />
            </condition>
        </target>
    
        <target name="check-jvm" depends="get-jvm" unless="jvm.ok">
            <echo message="Checking JVM Version.." />
            <fail message="Wrong JVM - ${ant.java.version}, DSP requires Java 1.7" />
        </target>
    
        <!-- check build environment -->
        <target name="check-environment" depends="check-jvm">
            <echo message="Checking ANT version and Availability of required JAR files.." />
    
            <!-- Ensure that Ant 1.6.2+ is being used -->
            <available classname="org.apache.tools.ant.DynamicAttribute" property="ant-1.6.2" />
            <fail unless="ant-1.6.2" message="HP DSP requires Ant 1.6.2 or higher for building" />
        </target>
    
        <target name="init" description="defines custom tasks" depends="check-environment">
            <echo message="HP DSP Build Initialization Passed..." />
        </target>
    
        <!-- clean the dist folder -->
        <target name="clean">
            <delete>
                <fileset dir="${dist.dir}" />
            </delete>
            <delete dir="${basedir}/xmlBeans/" />
        </target>
    
        <!-- Redeploys war file to the local jboss 'default' instance -->
        <target name="deploy" depends="war">
    
            <delete file="${jboss.home}/standalone/deployments/dsp.war" failonerror="no" />
            <sleep seconds="4"/>
            <copy file="${basedir}/dist/dsp.war" todir="${jboss.home}/standalone/deployments/" overwrite="yes" />
    
        </target>
    
        <target name="war" depends="dist-compile">
            <antcall target="copyPropertyFiles"/>
            <antcall target="copyAdditionalFiles"/>
            <echo level="info" message="copied all files to ${dist.dir}, packaging as WAR file." />
            <jar destfile="${dist.dir}/${webapp.name}.war" basedir="${webapp.dir}">
                <manifest>
                    <attribute name="Built-By" value="${user.name}"/>
                </manifest>
            </jar>
        </target>
    
        <target name="cucumber-compile" depends="dist-compile">
    
                <description>Compile the test Java code</description>
                <javac srcdir="${test.java.dir}" destdir="${web-classes.dir}" classpathref="compile.classpath" debug="${javac.debug}"/>
            </target>
    
    
        <target name="dist-compile" depends="prepare">
            <description>Compile the UDCR Java code</description>
            <javac srcdir="${src.java.dir}" destdir="${web-classes.dir}" classpathref="compile.classpath" debug="${javac.debug}"/>
        </target>
    
        <target name="compile" depends="prepare">
            <description>Compile the UDCR Java code</description>
            <javac srcdir="${src.java.dir}" destdir="${classes.dir}" classpathref="compile.classpath" debug="${javac.debug}"/>
        </target>
    
        <target name="prepare" depends="init,clean,createFolders">
            <!--<fixcrlf srcdir="${src.dir}" includes="**/*.properties" eol="lf"/>
            <fixcrlf srcdir="${src.dir}" includes="**/*.xml" eol="lf"/> -->
            <echo level="info" message="Initialization Passed." />
        </target>
    
        <!-- create empty directories in the dist folder -->
        <target name="createFolders">
            <echo level="info" message="Creating empty directories" />
            <mkdir dir="${dist.dir}" />
            <mkdir dir="${webapp.dir}" />
            <mkdir dir="${web-inf.dir}" />
            <mkdir dir="${web-classes.dir}" />
            <mkdir dir="${web-lib.dir}" />
            <mkdir dir="${web-schema.dir}" />
            <mkdir dir="${web-wsdl.dir}" />
            <mkdir dir="${cucumber-report.dir}" />
        </target>
    
    
        <target name="copyPropertyFiles">
            <echo message="Copying spring-conf, i18n and other properties to ${web-classes.dir}" />
            <!-- Convert the i18n files to UTF-8 -->
            <native2ascii encoding="UTF-8" src="${resources.dir}/i18n" dest="${web-classes.dir}/i18n" includes="*.properties" />
    
            <!-- Copy the spring configuration files to the target folder -->
            <copy todir="${web-classes.dir}">
                <fileset dir="${resources.dir}/">
                    <include name="spring-conf/**"/>
                </fileset>
            </copy>
            <copy todir="${web-classes.dir}">
                <fileset dir="${resources.dir}/">
                    <include name="**"/>
                    <exclude name="i18n/**"/>
                    <exclude name="spring-conf/**"/>
                </fileset>
            </copy>
            <!-- move overwrite="true" file="${web-classes.dir}/spring-conf/dsm-security-saml.xml" tofile="${web-classes.dir}/spring-conf/dsm-security.xml" / -->
        </target>
    
    
        <target name="copyAdditionalFiles">
            <echo message="Copying additional required files for the WAR file..." />
    
            <!-- Copy the common files to the webapp folder -->
            <copy todir="${webapp.dir}" includeEmptyDirs="no">
                <fileset dir="${build.webapp.dir}/">
                    <include name="**"/>
                    <exclude name="WEB-INF/**"/>
                </fileset>
            </copy>
    
            <!-- Copy the jsp and lib files to the WEB-INF folder -->
            <copy todir="${web-inf.dir}" includeEmptyDirs="no">
                <fileset dir="${build.dir}/">
                    <include name="*.xml"/>
                    <include name="*.tld"/>
                    <include name="pages/**"/>
                    <include name="lib/**"/>
                    <include name="schema/*.xsd"/>
                    <include name="wsdl/*.wsdl"/>
                </fileset>
            </copy>
        </target>
    
        <target name="copy_war_to_JBoss" >
            <echo message="Copying war to JBoss server" />
            <delete includeemptydirs="true">
                <fileset dir="${jboss.home}\standalone\deployments\dsp.war" includes="**/*"/>
            </delete>
    
            <copy todir="${jboss.home}\standalone\deployments\dsp.war" >
                <fileset dir="${basedir}\src\main\webapp\">
                </fileset>
            </copy>
        </target>
    
        <target name="cucumber" depends="cucumber-compile">
        <java classname="io.cucumber.core.cli.Main" fork="true" failonerror="false"
            classpathref ="compile.classpath">
                            <arg value="--plugin"/>
                            <!-- creates our junit report -->
                            <arg value="junit:${cucumber-report.dir}/InputFileValidation.xml"/>
                            <arg value="--plugin"/>
                            <arg value="pretty"/>
                            <arg value="--plugin"/>
                            <!-- creates our cucumber html friendly report -->
                            <arg value="html:${cucumber-report.dir}/cucumber-html-report"/>
                            <arg value="--plugin"/>
                            <!-- creates our cucumber json friendly report -->
                            <arg value="json:${cucumber-report.dir}/cucumber.json"/>
    
                            <arg value="--glue"/>
                            <arg value="src/test/java/steps"/>
                            <arg value="src/test/resources"/>
                        </java>
            <!-- writes out information to junit report -->
                        <junitreport todir="${cucumber-report.dir}">
                            <fileset dir="${cucumber-report.dir}">
                                <include name="InputFileValidation.xml"/>
                            </fileset>
                            <report format="frames" todir="${cucumber-report.dir}"/>
                        </junitreport>
    
                        <!-- checks our exit status, and determines success or failure -->
                        <fail message="Cucumber failed">
                            <condition>
                                <not>
                                    <equals arg1="${cucumber.exitstatus}" arg2="0"/>
                                </not>
                            </condition>
                        </fail>
                    </target>
    
        <!-- Default target -->
        <target name="usage">
            <echo message="------------------------------------------------------"   />
            <echo message="HP DSP build options"                                     />
            <echo message="------------------------------------------------------"   />
            <echo message="Available targets are :"                                  />
            <echo message="clean          --> Deletes all files in dist folder."     />
            <echo message="compile        --> Compiles DSP java sources."            />
            <echo message="war            --> Create a deployable WAR file of DSP."  />
            <echo message="deploy         --> Redeploys war to local JBoss instance."/>
            <echo message="------------------------------------------------------"   />
        </target>
    
    
    </project>
    
    Class path details from property.xml
        <!--  CLASSPATH for compilation -->
        <path id="compile.classpath">
            <fileset dir="${build.lib.dir}" includes="*.jar" />
            <fileset dir="${extralib.dir}" includes="*.jar" />
            <fileset dir="${test.resources.dir}/features" />
        </path>
    

    但是当我运行构建时,它会抱怨没有实现步骤。我验证了glue arg中给出的步骤定义包的路径。

    注:我尝试了很多谷歌建议,但最终都一无所获。我使用jdk7和ant是因为它是遗留项目实现。

    0 回复  |  直到 4 年前