Instrumenting war file using command line

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Instrumenting war file using command line

Code Code
Hi,
I am trying to instrumenting a war file. It doen't instrument all the classes in the war file. I see only class getting instrumented.
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat c:\temp\codecoverage\provision.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Instrumenting 1 file
 
Am I doing anything wrong. Could you suggest me how to instrument a war file using commandline.
 
Thanks,
Parthu

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel
Reply | Threaded
Open this post in threaded view
|

Re: Instrumenting war file using command line

FabienB
I am in the same case as you, what I do is first to extract the content of the war file in a temporary directory, then instrument all extracted classes, and last recreating the war (be sure to

I don't think there is any existing ant target for that in the Cobertura delivery.



2011/4/28 Code Code <[hidden email]>
Hi,
I am trying to instrumenting a war file. It doen't instrument all the classes in the war file. I see only class getting instrumented.
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat c:\temp\codecoverage\provision.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Instrumenting 1 file
 
Am I doing anything wrong. Could you suggest me how to instrument a war file using commandline.
 
Thanks,
Parthu

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel
Reply | Threaded
Open this post in threaded view
|

Re: Instrumenting war file using command line

Code Code
Thanks for the info. I was reading on the http://cobertura.sourceforge.net/anttaskreference.html website. I though we can also instrument a war file.
 
"For example, if you have a war file which contains a jar file at WEB-INF/lib, Cobertura will extract the war, instrument the classes within the jar, then build a new war containing the instrumented jar. "

From: Fabien Bataille <[hidden email]>
To: Code Code <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Thursday, April 28, 2011 12:31 AM
Subject: Re: [Cobertura-devel] Instrumenting war file using command line

I am in the same case as you, what I do is first to extract the content of the war file in a temporary directory, then instrument all extracted classes, and last recreating the war (be sure to

I don't think there is any existing ant target for that in the Cobertura delivery.



2011/4/28 Code Code <[hidden email]>
Hi,
I am trying to instrumenting a war file. It doen't instrument all the classes in the war file. I see only class getting instrumented.
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat c:\temp\codecoverage\provision.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Instrumenting 1 file
 
Am I doing anything wrong. Could you suggest me how to instrument a war file using commandline.
 
Thanks,
Parthu

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel





------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel
Reply | Threaded
Open this post in threaded view
|

Re: Instrumenting war file using command line

John W. Lewis

 

Are you both trying to do this at the command line?   If so, then here are the instructions.

 

Since you are trying to instrument one file, you will want to use the --basedir to specify the directory the war is in.   Then, you will only need to end the command with the name of the war.

 

Next, since Cobertura would instrument every jar in the war, and you probably would not want that since all your dependencies would end up in the report, the --includeClasses parameter is required.

 

So, you want something like:

 

c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat --basedir c:\temp\codecoverage --includeClasses ‘com.mypackage.*’ provision.war

 

The war will be instrumented in place.   Any class of any jar that is in com.mypackage will be instrumented.

 

John

 

 

 

 

From: Code Code [mailto:[hidden email]]
Sent: Thursday, April 28, 2011 1:12 PM
To: Fabien Bataille
Cc: [hidden email]
Subject: Re: [Cobertura-devel] Instrumenting war file using command line

 

Thanks for the info. I was reading on the http://cobertura.sourceforge.net/anttaskreference.html website. I though we can also instrument a war file.

 

"For example, if you have a war file which contains a jar file at WEB-INF/lib, Cobertura will extract the war, instrument the classes within the jar, then build a new war containing the instrumented jar. "

 

From: Fabien Bataille <[hidden email]>
To: Code Code <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Thursday, April 28, 2011 12:31 AM
Subject: Re: [Cobertura-devel] Instrumenting war file using command line


I am in the same case as you, what I do is first to extract the content of the war file in a temporary directory, then instrument all extracted classes, and last recreating the war (be sure to

I don't think there is any existing ant target for that in the Cobertura delivery.


2011/4/28 Code Code <[hidden email]>

Hi,

I am trying to instrumenting a war file. It doen't instrument all the classes in the war file. I see only class getting instrumented.

 

C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat c:\temp\codecoverage\provision.war

Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Instrumenting 1 file

 

Am I doing anything wrong. Could you suggest me how to instrument a war file using commandline.

 

Thanks,

Parthu


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel

 

 


------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel
Reply | Threaded
Open this post in threaded view
|

Re: Instrumenting war file using command line

Code Code
Hi John,
I tried steps you specified. But still I coundn't instrument a war file. Did it work for you.
 
C:\temp\cobertura-1.9.4.1>cobertura-instrument.bat --basedir C:\temp\codecoverag
e  messaging.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 0 classes.
Instrumenting 1 file
Cobertura: Saved information on 0 classes.
Instrument time: 5398ms
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat --basedi
r C:\temp\codecoverage --includeClasses 'com.*' messaging.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 0 classes.
Instrumenting 1 file
Cobertura: Saved information on 0 classes.
Instrument time: 17327ms
 
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat -basedir
 C:\temp\codecoverage messaging.war

From: John W. Lewis <[hidden email]>
To: Code Code <[hidden email]>; Fabien Bataille <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Thursday, April 28, 2011 1:30 PM
Subject: RE: [Cobertura-devel] Instrumenting war file using command line

 
Are you both trying to do this at the command line?   If so, then here are the instructions.
 
Since you are trying to instrument one file, you will want to use the --basedir to specify the directory the war is in.   Then, you will only need to end the command with the name of the war.
 
Next, since Cobertura would instrument every jar in the war, and you probably would not want that since all your dependencies would end up in the report, the --includeClasses parameter is required.
 
So, you want something like:
 
c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat --basedir c:\temp\codecoverage --includeClasses ‘com.mypackage.*’ provision.war
 
The war will be instrumented in place.   Any class of any jar that is in com.mypackage will be instrumented.
 
John
 
 
 
 
From: Code Code [mailto:[hidden email]]
Sent: Thursday, April 28, 2011 1:12 PM
To: Fabien Bataille
Cc: [hidden email]
Subject: Re: [Cobertura-devel] Instrumenting war file using command line
 
Thanks for the info. I was reading on the http://cobertura.sourceforge.net/anttaskreference.html website. I though we can also instrument a war file.
 
"For example, if you have a war file which contains a jar file at WEB-INF/lib, Cobertura will extract the war, instrument the classes within the jar, then build a new war containing the instrumented jar. "
 
From: Fabien Bataille <[hidden email]>
To: Code Code <[hidden email]>
Cc: "[hidden email]" <[hidden email]>
Sent: Thursday, April 28, 2011 12:31 AM
Subject: Re: [Cobertura-devel] Instrumenting war file using command line


I am in the same case as you, what I do is first to extract the content of the war file in a temporary directory, then instrument all extracted classes, and last recreating the war (be sure to

I don't think there is any existing ant target for that in the Cobertura delivery.


2011/4/28 Code Code <[hidden email]>
Hi,
I am trying to instrumenting a war file. It doen't instrument all the classes in the war file. I see only class getting instrumented.
 
C:\temp\codecoverage>c:\temp\cobertura-1.9.4.1\cobertura-instrument.bat c:\temp\codecoverage\provision.war
Picked up JAVA_TOOL_OPTIONS: -agentlib:jvmhook
Picked up _JAVA_OPTIONS: -Xrunjvmhook -Xbootclasspath/a:C:\PROGRA~1\HP\QUICKT~1\
bin\JAVA_S~1\classes;C:\PROGRA~1\HP\QUICKT~1\bin\JAVA_S~1\classes\jasmine.jar
Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
Instrumenting 1 file
 
Am I doing anything wrong. Could you suggest me how to instrument a war file using commandline.
 
Thanks,
Parthu

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel
 
 



------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today.  Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Cobertura-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/cobertura-devel