Bamboo plan with automatic Clover integration using OJDeployAntTask

Radha Ganti July 27, 2016

I'm trying to setup Bamboo build plan with automatic Clover integration on a Oracle ADF project which uses OJDeployAntTask for compiling the source.
https://confluence.atlassian.com/bamboo/enabling-the-clover-add-on-289277268.html#EnablingtheCloveradd-on-AutomaticCloverintegration

<target name="deploy-project">
<echo message="Deploying Project: ${project.name}"></echo>
<echo message="Deploy Directory: ${oracle.jdeveloper.deploy.dir}"></echo>
<echo message="Bamboo Working Directory: ${env.bamboo.build.working.directory}"></echo>
<ora:ojdeploy xmlns:ora="oraclelib:OJDeployAntTask"
failonerror="true"
executable="${oracle.jdeveloper.ojdeploy.path}"
ora:buildscript="${oracle.jdeveloper.deploy.dir}/ojdeploy-build-${project.name}.xml"
ora:statuslog="${oracle.jdeveloper.deploy.dir}/ojdeploy-statuslog-${project.name}.xml">
<ora:deploy>
<ora:parameter name="workspace"
value="${oracle.jdeveloper.workspace.path}"/>
<ora:parameter name="project" value="${project.name}"/>
<ora:parameter name="profile" value="*"/>
</ora:deploy>
</ora:ojdeploy>
</target>

 

but i see the following error in the build logs:


Buildfile: buildServer.xml
[clover-env] Loading clover.xml: jar:file:/tmp/clover-1433460266000.jar!/clover.xml
clover.clean:
[clover-clean] Clover Version 4.0.1, built on September 01 2014 (build-932)
[clover-clean] Loaded from: /tmp/clover-1433460266000.jar
..........
..........
..........
com.atlassian.clover.registry.NoSuchRegistryException: Clover registry file "/app/bamboo-agent-home/xml-data/build-dir/JOB1/.clover/clover4_0_1.db" does not exist, cannot be read or is a directory.
error Please ensure Clover has instrumented your source files.
error You may need to remove existing .class files for this to occur.
error at com.atlassian.clover.CloverDatabase.<init>(CloverDatabase.java:86)
error at com.atlassian.clover.CloverDatabase.<init>(CloverDatabase.java:64)
error at com.atlassian.clover.reporters.CloverReportConfig.getCoverageDatabase(CloverReportConfig.java:328)
error at com.atlassian.clover.reporters.Current.getCoverageDatabase(Current.java:149)
error at com.atlassian.clover.ant.tasks.HistoryPointTask.cloverExecute(HistoryPointTask.java:185)
error at com.atlassian.clover.ant.tasks.AbstractCloverTask.execute(AbstractCloverTask.java:55)
error at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
error at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
error at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
error at java.lang.reflect.Method.invoke(Method.java:606)
error at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
error at org.apache.tools.ant.Task.perform(Task.java:348)
error at org.apache.tools.ant.Target.execute(Target.java:357)
error at org.apache.tools.ant.Target.performTasks(Target.java:385)
error at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
error at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
error at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
error at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
error at org.apache.tools.ant.Main.runBuild(Main.java:758)
error at org.apache.tools.ant.Main.startAnt(Main.java:217)
error at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
error at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
error
build [clover] Clover reports not being generated. No Clover instrumentation was done.

I did remove existing class files. I've eliminated all other issues by verifying each step in the documentation and also the troubleshooting guide. I feel that the instrumentation is not happening because Clover has no reach into the OJDeployAntTask process.

1) Is Clover integration supported with OJDeployAntTask?
2) Are there any instructions on how to do it. I've looked all over the web but couldn't find any resources.

1 answer

0 votes
Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 27, 2016

Hi,

To be honest, I've never tested Clover with OJDeployAntTask, so I cannot guarantee that automatic Clover integration is compatible with it. 

Please check the following things in your build log (I recommend to run your build with debug logginng - "ant -d" to get more details):

  1. Do you see that <clover-setup> task was called? Did this task load the Clover license key properly?
     
  2. Do you see that <clover-setup> actually instrumented some source files? There shall be messages like "Instrumenting <file> to <temporary dir>/<file>".
     
  3. Did <javac> task pick up instrumented source files for compilation? You shall see that source files from a temporary folder are compiled instead of standard ones.
     
  4. Did your packaging task (I don't know it's name - the one which produces JAR/WAR/EAR) packaged instrumented classes? Unzip your archive and look for files named "<class name>$__CLR<some hash>.class".
     
  5. Did your application find the clover.db at runtime? If not, then you shall see messages like

    "CLOVER: Unable to load the coverage database at <path>"
    "CLOVER: No coverage data will be gathered."
     

  6. Did you shut down your application server? By default Clover writes coverage data to disk at JVM shutdown, so in case you did not stop the server, it won't write any files, despite the fact that coverage was collected (in memory). Check if you see coverage recording files in the same folder where clover.db is stored - they're named like "clover.db<some hash code>". Note: You can switch the flush-policy to "interval" or "threaded", but this requires manual integration. 

 

PS: the error message you pasted:

Clover registry file "/app/bamboo-agent-home/xml-data/build-dir/JOB1/.clover/clover4_0_1.db" does not exist, cannot be read or is a directory. error Please ensure Clover has instrumented your source files. 

suggests that automatic integration failed somewhere between points 1-3.

Radha Ganti July 28, 2016

Thanks for your reply Marek. Your analysis lends support to my thinking of where the root cause could be.

Step 1 is good with clover-setup being called and loading the license key successfully.

Buildfile: buildServer.xml
[clover-env] Loading clover.xml: jar:file:/tmp/clover-1433460266000.jar!/clover.xml

clover.clean:
[clover-clean] Clover Version 4.0.1, built on September 01 2014 (build-932)
[clover-clean] Loaded from: /tmp/clover-1433460266000.jar
[clover-clean] Clover: Commercial License registered to xxxxxxx.

clover.fullclean:

with.clover:
[clover-setup] Clover Version 4.0.1, built on September 01 2014 (build-932)
[clover-setup] Loaded from: /tmp/clover-1433460266000.jar
[clover-setup] Clover: Commercial License registered to xxxxxxx.

 

Step 2. I dont see any messages like "Instrumenting <file> to <temporary dir>/<file>".

 

Here is my theory of what might be happening:

The build.xml specifies the ant target as 'deploy-project' which in turn has the <ora:ojdeploy> which uses the  oraclelib:OJDeployAntTask to launch the javac command.

The way i understood the issue to be is that Clover works by looking into the ant process and tries to find the javac to be able to instrument the classes.

But in this scenario, ant doesnt not use javac directly but instead simply calls <ora:ojdeploy> which in turn calls javac.

Is there a way to tell Clover that we are using ojdeploy process so that it will not just look at ant process but look at its child process ojdeploy and then find the javac there?

deploy-project:
[echo] Deploying Project: MyProject
[echo] Deploy Directory: /app/bamboo-agent-home/xml-data/build-dir/JOB1/deploy
[echo] Bamboo Working Directory: /app/bamboo-agent-home/xml-data/build-dir/JOB1
[ora:ojdeploy]
[ora:ojdeploy] Oracle JDeveloper Deploy 11.1.1.7.0
[ora:ojdeploy] Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
[ora:ojdeploy]
[ora:ojdeploy] ----build file----
[ora:ojdeploy] <?xml version = '1.0' standalone = 'yes'?>
[ora:ojdeploy] <ojdeploy-build>
[ora:ojdeploy] <deploy>
[ora:ojdeploy] <parameter name="workspace" value="/app/bamboo-agent-home/xml-data/build-dir/JOB1/MyApp.jws"/>
[ora:ojdeploy] <parameter name="project" value="MyProject"/>
[ora:ojdeploy] <parameter name="profile" value="*"/>
[ora:ojdeploy] </deploy>
[ora:ojdeploy] <defaults>
[ora:ojdeploy] <parameter name="buildfile" value="/app/bamboo-agent-home/xml-data/build-dir/JOB1/deploy/ojdeploy-build-MyProject.xml"/>
[ora:ojdeploy] <parameter name="statuslogfile" value="/app/bamboo-agent-home/xml-data/build-dir/JOB1/deploy/ojdeploy-statuslog-MyProject.xml"/>
[ora:ojdeploy] </defaults>
[ora:ojdeploy] </ojdeploy-build>
[ora:ojdeploy] ------------------
[ora:ojdeploy] Jun 15, 2016 11:43:25 AM oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl$DeployConsoleLogger willPrepare
[ora:ojdeploy] INFO: ---- Deployment started. ----
[ora:ojdeploy]
[ora:ojdeploy] Jun 15, 2016 11:43:25 AM oracle.jdevimpl.deploy.fwk.DeploymentManagerImpl$DeployConsoleLogger printTargetPlatform
[ora:ojdeploy] INFO: Target platform is Standard Java EE.
[ora:ojdeploy]
[ora:ojdeploy] Jun 15, 2016 11:43:25 AM oracle.jdevimpl.deploy.common.ProfileDependencyAnalyzer deployImpl
[ora:ojdeploy] INFO: Running dependency analysis...
[ora:ojdeploy]
[ora:ojdeploy] Jun 15, 2016 11:43:25 AM oracle.jdeveloper.deploy.common.BuildDeployer build
[ora:ojdeploy] INFO: Building...
[ora:ojdeploy]
[ora:ojdeploy] Compiling...
[ora:ojdeploy] Context: selection=MyProject.jpr application=MyApp.jws project=MyProject.jpr node=MyProject.jpr
[ora:ojdeploy]
[ora:ojdeploy] /app/java/jdk1.7.0_51/bin/javac
[ora:ojdeploy] -g
[ora:ojdeploy] -Xlint:all
[ora:ojdeploy] -Xlint:-cast
[ora:ojdeploy] -Xlint:-empty
[ora:ojdeploy] -Xlint:-fallthrough
[ora:ojdeploy] -Xlint:-path
[ora:ojdeploy] -Xlint:-serial
[ora:ojdeploy] -Xlint:-unchecked
[ora:ojdeploy] -source 1.7
[ora:ojdeploy] -target 1.7
[ora:ojdeploy] -verbose
[ora:ojdeploy] -encoding Cp1252
[ora:ojdeploy] -classpath
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/resources.jar:
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/rt.jar:
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/jsse.jar:
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/jce.jar:
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/charsets.jar:
[ora:ojdeploy] /app/java/jdk1.7.0_51/jre/lib/jfr.jar:
[ora:ojdeploy] /app/bamboo-agent-home/xml-data/build-dir/JOB1/.adf:
[ora:ojdeploy] /app/bamboo-agent-home/xml-data/build-dir/JOB1/MyProject/classes:
[ora:ojdeploy] /app/Oracle/Middleware/oracle_common/modules/oracle.adf.share_11.1.1/adf-share-support.jar:

 

 

Marek Parfianowicz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 28, 2016

Is there a way to tell Clover that we are using ojdeploy process so that it will not just look at ant process but look at its child process ojdeploy and then find the javac there?

The most probably not.

In such case I would recommend to use the <clover-instr> Ant task. It is similar to <clover-setup>, but it instruments source files into a specified folder, so you could later compile them using ojdeploy.

Radha Ganti August 1, 2016

I was hoping to get it working with automatic integration but as you suggest maybe manual integration is required due to the nature in which ojdeploy works.

I will give it a try. thanks for your time smile

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events