ant task startBuildActivity fails in Maven build after dependencies loaded. proxy server setting [SOLVED]
we have a maven build, that works fine. we need to use proxy in settings.xml to access outside the company firewall.
we also want to see the status of the build along the way, so have added startBuildActivity statements to the build script.
all works fine til maven resolves the dependencies, then leaves the proxy setting around in the environment, and the next startbuildActivity task fails, cause it can't reach rtc thru the proxy.
anyone have any good ideas how to solve this
common.rtc.startActivity:
[echo] Starting Activity: ${activityId}: Cleaning workarea...
[startBuildActivity] Not using a proxy to reach https://dbjazz.intranet.sd.com/ccm/
[startBuildActivity] Started build activity "Cleaning workarea..." for build result "R4.2.P20140304-0939".
clean:
[mkdir] Created dir: /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
[mkdir] Created dir: /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
[mkdir] Created dir: /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
[delete] Deleting directory /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
coverage.clean:
[mkdir] Created dir: /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
[mkdir] Created dir: /export/gcs1/data/opt/jazz/buildsystem/buildengine/sandbox/...
[echo] *** Running Ant with Java version: 1.6 ***
_cash.test.jre:
[echo] *** Running Ant with Java version: 1.6 ***
common.rtc.startActivity:
[echo] Starting Activity: ${activityId}: JRE tests
[startBuildActivity] Using proxy my-proxy.intranet.sd.com:8080 to reach https://server.intranet.sd.com/ccm/
[startBuildActivity] Ignoring the following exception because "failOnError" is set to false.
[startBuildActivity] com.ibm.team.repository.common.TeamRepositoryException: Error logging in to repository https://server.intranet.sd.com/ccm/. Verify that the repository address and credentials to log in are correct.
3 answers
well, turns out this was easier than expected.. they had already made a small target routine to invoke the startBuildActivity,, so all we had to do was add
<setproxy proxyhost=""/>
before the <startBuildActivity .../> task
Sam
can someone select this as the Accepted answer please
Hi Sam. Are you invoking our Ant tasks directly from within the Maven POM, i.e. using maven-ant plugin?
If so, how are you getting the build toolkit libs on the class path? We've had a lot of problems with this approach in the past. We've had more success invoking Ant separately, either via maven-exec or a simple maven-ant to launch an external Ant, passing -lib {buildtoolkit dir} and the necessary target and -Ds for repositoryAddress, userId, password/passwordFile, buildResultUUID, and any other needed args. The main problem with that approach is that it's hard to pass back info that may be needed for a later task invocation, e.g. activity id, or request UUID if launching a child build. But this approach might work for specifying the proxy, separately from what Maven's Java is doing.
See also https://jazz.net/wiki/bin/view/Main/BuildFAQ#How_do_I_run_JBE_or_the_Ant_task for info on system properties we look at for using a proxy. I'm not sure whether these would override any JVM-wide defaults though.
its really an ant build, with maven tasks to hook the dependencies.
<artifact:dependencies pathId="sd.dependency.classpath" pomrefid="xxxpom" settingsFile="${project.dir}/settings.xml">
<remoteRepository refid="sd-repository"/>
<remoteRepository refid="abc-repository"/>
</artifact:dependencies>
the settings.xml has the proxy configuration
when we add the rtc startbuildactivity to the targets that have dependencies, then the proxy gets set, and the rtc ant task fails. because the maven ant task didn't clean up after itself.
<target name="javac" depends="libs, init.versioning" description="Compile java source to bytecode">
<mkdir dir="${project.classes.dir}" />
<javac fork="true" memoryinitialsize="256m" memorymaximumsize="1024m" srcdir="${project.src.dir}" includes="**" encoding="utf-8" destdir="${project.classes.dir}" source="${javac.src.level}" target="${javac.src.level}" includeantruntime="false" debug="true" >
<classpath refid="project.classpath" />
<classpath refid="sd.dependency.classpath"/> <--- this one does it
<compilerarg line="${javac.args}"/>
</javac>
<copy todir="${project.classes.dir}">
<fileset dir="${project.src.dir}" excludes="**/*.java" />
</copy>
</target>
I'll have an exact sample tomorrow