Docs

How can we help?

Viewing Your Original Source Code in Takipi

Contents

Introduction

SBT / Play Framework

Ant

Maven

Eclipse

IntelliJ

Adding Source Folders

References and Troubleshooting

 

Introduction

When you open an error in the dashboard, Takipi displays a Java decompilation of your application’s bytecode and overlays the run-time variable data onto it. If you’re using standard Java, the decompilation creates an accurate picture of your source code (minus any annotations). However, if you’re not using standard Java or want to see your annotations, you’ll need to take an extra step.

If you want to see your annotations in Takipi or you’re using Scala, JRuby, Groovy, Clojure, or any non-Java language running on the JVM and want to see your source code in its original form, you can do so by attaching your source code to the Takipi agent. This can also be done if you’re using a code weaver (such as AspectJ) which adds large amounts of synthetic code into your bytecode. Attaching your source code only requires a minor customization to your usual build steps. Below is a simple guide showing what to tweak if you’re using SBT/Play Framework, Ant, Maven, Eclipse, or IntelliJ. Additionally, we describe how to attach your source code folder directly. We’ve also created sample projects for each of these, available on GitHub: https://github.com/takipi/attach-source-samples.

 

SBT / Play Framework

You can add your source files to your .jar with SBT by adding this line to your build.sbt file:
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "app" )

If you are using a Maven-like project structure please add “src/main/scala” and “src/main/java” instead of plain “src”:
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "src/main/scala" )
sbt.build example:
name := "hello"
version := "1.0"
scalaVersion := "2.9.2"
resolvers += "twitter-repo" at "http://maven.twttr.com" libraryDependencies ++= Seq("com.twitter" % "finagle-core" ...
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "src/main/scala" )
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "app" )

Build.scala example:
lazy val defaultSettings =
buildSettings ++
Seq(
parallelExecution in Test := false,
fork in Test := true,
unmanagedResourceDirectories in Compile <+= baseDirectory( _ / "src/main/scala" )
)

Once finished, restart the Takipi daemon for changes to take effect.

Ant
  1. In the project’s build.xml file, make sure the javac tag contains the following attributes: debug=”true” debuglevel=”source,lines,vars” Furthermore, in your jar tag add <fileset dir=”src” /> to include the source files. Here’s a sample Ant build.xml file
  2. Restart the Takipi daemon for changes to take effect.
Maven
  1. In order to package your source files add the following resources to your build tag: <resources> <resource> <directory>${project.build.sourceDirectory}</directory> </resource> <resource> <directory>${basedir}/src/main/resources</directory> </resource> </resources> Here’s a sample Maven pom.xml file.
  2. Restart the Takipi daemon for changes to take effect.

 

Eclipse
  1. Right click your project and select Export -> JAR file.
  2. In the export window, select “Export Java source files and resources”.
    03
    Attaching your source code in Eclipse

  3. Restart the Takipi daemon for changes to take effect.

 

IntelliJ
  1. Open the File | Project Structure dialog.
  2. Pick your Scala project’s .jar file from the artifacts list.
  3. Click the green plus button and select your ‘src’ folder.
  4. Build the project. o2
    Adding your source code in IntelliJ
  5. Restart the Takipi daemon for changes to take effect.

 

If you want to create a new .jar in IntelliJ, follow these steps –

  1. Click the green plus and add a JAR artifact.
  2. Drag the compile output from the “Available elements” list to the JAR on the left.
  3. Add your source folder as described above. o1
    Creating a new .jar in IntelliJ
  4. Restart the Takipi daemon for changes to take effect.

 

Adding Source Folders

Another method for viewing Takipi on your source code is attaching your source code directly on the machine with Takipi. This is a great method for Scala, for example. To do this, simply place a directory with your source code on the machine on which Takipi runs, and add the following startup argument to your JVM: -Dtakipi.sources.path=/your/source/dir/here For example: java -Dtakipi.sources.path=/opt/my-app/src -jar myApp.jar You may specify multiple directories, by separating the paths using ‘;’ (Windows), or ‘:’ (Linux / OS X): java -Dtakipi.sources.path=/opt/my-app/src:/opt/another-app/src/main/scala -jar myApp.jar

Once finished, restart the Takipi daemon for changes to take effect.

References and Troubleshooting

Troubleshooting

Have questions? Email us at hello@takipi.com or use the live chat.

×
Open a Support Ticket
×
Schedule a Demo
×
We'll contact you soon to coordinate a demo
Taki and Kipi