> I 'm using cc 2.0 to do continuous integration. Someone talked about
> the topic in the archived mails. Currently my build is running in the
> way:
>
> cc 2.0 --call--> ant build.xml --call--> maven
>
> The problem of the model is cc 2.0 doesn't know the build result of
> maven. Anytime cc 2.0 will return a successful report. does anyone have
> better solution to integrate the two wonderful tools?

Use the ant:generate-build goal to create a build.xml that CC will play
nice with. I've attached the build.xml file that we give to CC, that
should get you started.

<?xml version="1.0"?>

<project name="extranet" default="build" basedir=".">
  
  <description>
    A thin ant wrapper around Maven to placate CruiseControl
  </description>

  <property environment="env"/>

  <!-- Allow any user specific values to override the defaults -->
  <property file="${user.home}/build.properties" />
  <!-- Allow user defaults for this build -->
  <property file="build.properties" />
  <!-- Set default values for the project -->
  <property file="project.properties" />

  <target name="prepare">
    <condition property="maven.script" value="maven.bat">
      <and>
        <os family="windows" />
        <equals arg1="${maven.script}" arg2="$${maven.script}"/>
      </and>
    </condition>
    <condition property="maven.script" value="maven">
      <equals arg1="${maven.script}" arg2="$${maven.script}" />
    </condition>
    <echo message="Generating ANT buildfile"/>
    <exec executable="${env.MAVEN_HOME}/bin/${maven.script}"
          failonerror="true">
      <arg line="-Dmaven.ant.generatebuild.file=buildcc.xml"/>
      <arg line="-Dmaven.repo.remote=file:${p4.client.lib}"/>
      <arg line="ant:generate-build"/>
    </exec>
    <mkdir dir="${maven.build.dir}/classes"/>
    <copy todir="${maven.build.dir}/classes">
        <fileset dir="src/java">
          <include name="**/*.xml"></include>
        </fileset>
    </copy>
    <mkdir dir="${maven.build.dir}/test-classes"/>
    <copy todir="${maven.build.dir}/test-classes">
        <fileset dir="src/test">
          <include name="**/*.xml"></include>
          <include name="**/*.properties"></include>
        </fileset>
    </copy>
  </target>

  <target name="masterbuild"
          depends="prepare">
    <ant antfile="buildcc.xml"
         target="compile"
         inheritAll="yes"/>
    <exec executable="${env.MAVEN_HOME}/bin/${maven.script}"
          failonerror="true">
      <arg line="masterbuild"/>
    </exec>
  </target>

  <target name="cleanbuild"
          depends="clean, masterbuild"
          />
  
  <target name="clean"
          depends="prepare">
    <ant antfile="buildcc.xml"
         target="clean"
         inheritAll="yes"/>
  </target>

  <target name="compile"
          depends="prepare">
    <ant antfile="buildcc.xml"
         target="compile"
         inheritAll="yes"/>
  </target>

  <target name="test"
          depends="prepare">
    <ant antfile="buildcc.xml"
         target="test"
         inheritAll="yes"/>
  </target>

</project>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to