Jboss Tattletale 1.1 User'S Guide: Betraying All Your Project'S Naughty Little Secrets
Jboss Tattletale 1.1 User'S Guide: Betraying All Your Project'S Naughty Little Secrets
1 User's Guide
Betraying all your project's naughty little secrets
Copyright 2009 Red Hat Middleware
Table of Contents
1. About JBoss Tattletale .........................................................................................................................1
1.1. The team .................................................................................................................................1
1.2. Thanks to .................................................................................................................................1
2. Introduction ........................................................................................................................................2
3. Getting started ....................................................................................................................................3
3.1. Installation ...............................................................................................................................3
3.1.1. Maven ..........................................................................................................................3
3.1.2. Source code ..................................................................................................................4
3.2. Configuration ...........................................................................................................................4
3.2.1. Filtering ........................................................................................................................8
3.3. Running ...................................................................................................................................9
4. Apache Ant ......................................................................................................................................10
4.1. report ....................................................................................................................................10
5. Apache Maven ..................................................................................................................................15
5.1. report ....................................................................................................................................15
6. Reports .............................................................................................................................................20
6.1. Dependency reports ................................................................................................................20
6.1.1. Class Dependants ........................................................................................................20
6.1.2. Class Depends On report ..............................................................................................20
6.1.3. Dependants .................................................................................................................20
6.1.4. Depends On report .......................................................................................................20
6.1.5. Graphical dependencies report ......................................................................................21
6.1.6. Transitive Dependants .................................................................................................21
6.1.7. Transitive Depends On report .......................................................................................22
6.1.8. Circular Dependency report .........................................................................................22
6.2. General reports ......................................................................................................................23
6.2.1. Class Location .............................................................................................................23
6.2.2. OSGi ..........................................................................................................................23
6.2.3. Sealed information ......................................................................................................24
6.2.4. Signing information .....................................................................................................24
6.2.5. Eliminate Jar files with different versions ......................................................................25
6.2.6. Invalid version ............................................................................................................25
6.2.7. Multiple Jar files .........................................................................................................26
6.2.8. Multiple Jar files (Package) ..........................................................................................26
6.2.9. Multiple Locations ......................................................................................................27
6.2.10. Unused Jar ................................................................................................................27
6.2.11. Black listed ...............................................................................................................28
6.2.12. No version ................................................................................................................28
6.3. Archive reports ......................................................................................................................29
6.3.1. Java ARchive (JAR) ....................................................................................................29
7. Troubleshooting ................................................................................................................................30
7.1. JBoss Tattletale generates empty reports ..................................................................................30
7.2. JBoss Tattletale throws an OutOfMemoryException .................................................................30
7.3. How do I ? .............................................................................................................................30
ii
1
About JBoss Tattletale
JBoss Tattletale is a tool that can help development teams getting an overview of the project they are working on or
a product they depend on.
The tool generates reports that will show dependencies and general information that can help identify areas that
needs attention such as minimizing the number of dependencies or eliminate duplicated class files from the class
path.
JBoss Tattletale will help to improve the quality of your software project.
1.2. Thanks to
Jay Balunas, Torben Jaeger, Steve Taranto and James Cobb.
2
Introduction
Have you ever found yourself frustrated with a ClassNotFoundException? Would you like to know what libraries
are in your project and what they depend on? Would you like to get a full report on this stuff every time you run
your ant build? If so you need to use the JBoss Tattletale project!
JBoss Tattletale is a tool that can help you get an overview of the project you are working on or a product that you
depend on.
The tool will provide you with reports that can help you
JBoss Tattletale will recursive scan the directory pass as the argument for JAR files and then build the reports as
HTML files.
JBoss Tattletale is licensed under GNU Lesser General Public License (LGPL) version 2.1 or later.
We hope that JBoss Tattletale will help you in your development tasks !
Please, visit the official JBoss Tattletale project page at http://www.jboss.org/tattletale/.
3
Getting started
3.1. Installation
JBoss Tattletale can be downloaded in its binary form for easy installation.
The download location is: http://www.jboss.org/tattletale/downloads
Once downloaded extract the files by executing:
unzip jboss-tattletale-1.1.1.GA.zip
or
3.1.1. Maven
The JBoss Tattletale project is published in the JBoss Maven2 repository:
repository.jboss.org
snapshots.jboss.org
Getting started
The project is compiled using Java Development Kit 1.5 or higher, Apache Ant 1.7 or higher and Apache Ivy 2.1 or
higher. Using
ant <target>
dist
Builds the distribution.
release
Builds the release archives.
doc
Builds the documentation for the project.
clean
Cleans the project of temporary files.
3.2. Configuration
The configuration of JBoss Tattletale is done through its
jboss-tattletale.properties
Getting started
file.
The current configuration parameters includes:
Table 3.1. JBoss Tattletale configuration
Key
Value
reports
A comma separated list of which reports that should be generated. The following reports
are supported:
classdependants
classdependson
dependants
dependson
graphviz
transitivedependants
transitivedependson
circulardependency
classlocation
osgi
sealed
Getting started
Key
Value
sign
eliminatejars
invalidversion
multiplejars
multiplejarspackage
multiplelocations
unusedjar
blacklisted
noversion
jar
Specifies which classloader structure that should be used when scanning the archives. Can
be one of the following:
org.jboss.tattletale.reporting.classloader.NoopClassLoaderStructure
Getting started
Key
Value
org.jboss.tattletale.reporting.classloader.JBossAS4ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS5ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS6ClassLoaderStructure
Specifies a comma separated list of profiles to resolve against. The following profiles are
supported:
java5
java6
ee5
ee6
seam22
cdi10
spring25
spring30
A comma separated list of directories or files that should be excluded from the scan. F.ex.
Getting started
Key
Value
**/server/**,myjar.jar
blacklisted
scan
enableDot
graphvizDot
The full path to the Graphviz DOT executable. This property is required if you want to
generate PNG files and the Graphviz bin directory is not on your path. F.ex.
graphvizDot=C:\\Graphviz2.26.3\\bin\\dot.exe
or
graphvizDot=/opt/graphiz/bin/dot
-Djboss-tattletale.properties
NOTE: The classloader structure feature is currently based on directory structures and may therefore fail to identify
archives that should be included in the reports. If you want to be sure that all archives are included use the NoopClassLoaderStructure plugin.
3.2.1. Filtering
JBoss Tattletale supports filtering of the warnings and errors that the reports generates.
This functionality allows the user to filter out any warnings or errors that should be ignored and thereby allow the
application to successful terminate.
The format of the filter properties file is
Table 3.2. JBoss Tattletale filter
Key
Value
report id
The filter
Getting started
An example:
myreport=myfilter
-Djboss-tattletale-filter.properties
3.3. Running
Running JBoss Tattletale is very easy
where the "sourcedir" is the directory that contains your Java archives and the optional "outputdir" parameter is the
directory where you would like your reports to be generated. The "-exclude" option let you exclude directories or
file on the command line - see the configuration file for syntax.
The main file will be generated under the output directory as index.html.
JBoss Tattletale will scan for Java Archives (.JAR) files.
JBoss Tattletale requires Java Runtime Environment 5 or higher.
4
Apache Ant
JBoss Tattletale integrates with Apache Ant such that you can generate the reports directly from your build environment.
First, you need to add tattletale.jar, tattletale-ant.jar and javassist.jar to the Apache Ant classpath.
Second, you need to add the following to your project definition tag:
xmlns:tattletale="antlib:org.jboss.tattletale.ant"
That is it.
Alternative, you can do a taskdef for each task
<taskdef name="report"
classname="org.jboss.tattletale.ant.ReportTask"
classpathref="tattletale.lib.path.id"/>
4.1. report
Usage:
Value
source
The directory that contains the Java archives. Multiple directories can be scanned by separating each with the File.pathSeparator character - f.ex. dir1:dir2 on Un*x.
Default: Current directory
destination
Apache Ant
Key
Value
configuration
filter
reports
A comma separated list of which reports that should be generated. All reports can be selected by specifying "*". The following reports are supported:
classdependants
classdependson
dependants
dependson
graphviz
transitivedependants
transitivedependson
circulardependency
classlocation
osgi
sealed
11
Apache Ant
Key
Value
sign
eliminatejars
invalidversion
multiplejars
multiplejarspackage
multiplelocations
unusedjar
blacklisted
noversion
jar
Specifies which classloader structure that should be used when scanning the archives. Can
be one of the following:
org.jboss.tattletale.reporting.classloader.NoopClassLoaderStructure
12
Apache Ant
Key
Value
org.jboss.tattletale.reporting.classloader.JBossAS4ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS5ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS6ClassLoaderStructure
Specifies a comma separated list of profiles to resolve against. All profiles can be selected
by specifying "*". The following profiles are supported:
java5
java6
ee5
ee6
seam22
cdi10
spring25
spring30
13
Apache Ant
Key
Value
Default: java5, java6
excludes
A comma separated list of directories or files that should be excluded from the scan. F.ex.
**/server/**,myjar.jar
failOnWarn
failOnError
scan
Note
Note that defining a property in the task overrides the setting in the configuration file.
14
5
Apache Maven
JBoss Tattletale integrates with Apache Maven such that you can generate the reports directly from your build environment.
To be able to use the Tattletale Maven plugin in your Maven project, you will have to add the following plugin declaration in the pom.xml of your project:
<build>
<plugins>
<plugin>
<groupId>org.jboss.tattletale</groupId>
<artifactId>tattletale-maven</artifactId>
<!-- The version of the plugin you want to use -->
<version>1.1.1.Final</version>
<executions>
<execution>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- This is the location which will be scanned for generating tattletale reports
-->
<source>/absolutepath/to/source/dir</source>
<!-- This is where the reports will be generated -->
<destination>/absolute/path/to/reports/dir</destination>
</configuration>
</plugin>
</plugins>
</build>
Note
By default, the tattletale-maven plugin is attached to the "package" phase of Maven.
5.1. report
Usage:
Once you have configured your project's pom.xml to include the tattletale-maven plugin, as explained earlier, you
can generate the report by running the package goal on your project
15
Apache Maven
Value
source
The directory that contains the Java archives. Multiple directories can be scanned by separating each with the File.pathSeparator character - f.ex. dir1:dir2 on Un*x.
Default: Current directory
destination
configuration
filter
reports
Contains nested report elements of which reports that should be generated. All reports can
be selected by specifying "*". The following reports are supported:
classdependants
classdependson
dependants
dependson
graphviz
transitivedependants
transitivedependson
circulardependency
16
Apache Maven
Key
Value
classlocation
osgi
sealed
sign
eliminatejars
invalidversion
multiplejars
multiplejarspackage
multiplelocations
unusedjar
blacklisted
noversion
jar
17
Apache Maven
Key
Value
Specifies which classloader structure that should be used when scanning the archives. Can
be one of the following:
org.jboss.tattletale.reporting.classloader.NoopClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS4ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS5ClassLoaderStructure
org.jboss.tattletale.reporting.classloader.JBossAS6ClassLoaderStructure
Contains nested profile elements of profiles to resolve against. All profiles can be selected by specifying "*". The following profiles are supported:
java5
java6
ee5
ee6
seam22
Apache Maven
Key
Value
cdi10
spring25
spring30
Contains nested exclude elements of directories or files that should be excluded from the
scan. F.ex.
<exclude>**/server/**</exclude><exclude>myjar.jar</exclude>
failOnWarn
failOnError
scan
Note
Note that defining a property in the task overrides the setting in the configuration file.
19
6
Reports
6.1. Dependency reports
6.1.1. Class Dependants
The class dependants report will lists which classes depends on a specific class.
Table 6.1. Class Dependants report
Class
Dependants
The class
Depends On
The class
6.1.3. Dependants
The dependants report will lists which archives depends on a specific archive.
Table 6.3. Dependants report
Archive
Dependants
The archive
Reports
The depends on report will lists which archives that an archive depends on.
Table 6.4. Depends On report
Archive
Depends On
The archive
A list of archives which the archive depends on. Classes which can't be found are listed
in italic
archive=[class|package](,[class|package])*;
An example:
dependson=myjar1.jar=org.eclipse.*;myjar2.jar=com.mycompany.MyClass,com.mycompany.OtherClass
See the GraphViz documentation for a full description on how to generate these images.
Table 6.5. Graphical dependencies report
Archive
Archives
Packages
The archive
21
Reports
Archive
Dependants
The archive
Depends On
The archive
A list of all archives which the archive depends on. Classes which can't be found are
listed in italic
archive=[class|package](,[class|package])*;
An example:
transitivedependson=myjar.jar=com.mycompany.MyClass,com.mycompany.OtherClass
Circular Dependencies
The archive
A list of all archives which the archive has a circular dependency on.
[archive](,[archive])*;
22
Reports
An example:
circulardependency=myjar1.jar,myjar2.jar
Jar file
The class
[class|package](,[class|package])*;
An example:
classlocation=org.eclipse.*,com.mycompany.MyClass
6.2.2. OSGi
The OSGi report will display the OSGi state of your project.
Table 6.10. OSGi report
Archive
OSGi
Report
Manifest
The archive
23
Reports
[archive](,[archive])*;
An example:
osgi=myjar1.jar,myjar2.jar
Status
The archive
[yes|on|true|no|off|false]
An example:
sealed=off
Status
The archive
24
Reports
[yes|on|true|no|off|false]
An example:
sign=off
Location
The archive
[archive](,[archive])*;
An example:
eliminatejars=myjar1.jar,myjar2.jar
Location
25
Reports
[archive](,[archive])*;
An example:
invalidversion=myjar1.jar,myjar2.jar
Jar files
The class
[package](,[package])*;
An example:
multiplejars=com.mycompany.mypackage1,com.mycompany.mypackage2
Jar files
[package](,[package])*;
26
Reports
An example:
multiplejarspackage=com.mycompany.mypackage1,com.mycompany.mypackage2
Location
[archive](,[archive])*;
An example:
multiplelocations=myjar1.jar,myjar2.jar
Used
The archive
[archive](,[archive])*;
27
Reports
An example:
unusedjar=myjar1.jar,myjar2.jar
Usage
[archive](,[archive])*;
An example:
blacklisted=myjar1.jar,myjar2.jar
6.2.12. No version
The no version report will list archives that doesn't have a version identifier.
Table 6.20. No version report
Name
Location
[archive](,[archive])*;
28
Reports
An example:
noversion=myjar1.jar,myjar2.jar
Value
Name
Class Version
Locations
Manifest
Provides
29
7
Troubleshooting
7.1. JBoss Tattletale generates empty reports
JBoss Tattletale generates its reports based on Java archives and not source code. Make sure that sourcedir you specify when running JBoss Tattletale contains the Java archives (f.ex. .JAR files) that you need scanned.
7.3. How do I ?
We can't cover every single issue in this guide, so feel free to drop by our forums to see if a solution has already
been provided. Otherwise feel free to ask your question there.
Our
forum
is
located
at
http://www.jboss.org/index.html?module=bb&op=viewforum&f=320
[http://www.jboss.org/index.html?module=bb&op=viewforum&f=306]
30