Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Publish a shadow jar with thrift 0.9.2 #83

Merged
merged 1 commit into from Oct 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions README.md
Expand Up @@ -39,6 +39,26 @@ For e.g, to depend on the core jaeger library, you'd include the following
</dependency>
```

###Thrift version conflicts
Jaeger client uses `org.apache.thrift:libthrift:0.9.2`. If your project depends on a different
version of `libthrift`, it is recommended that you use the shaded `jaeger-thrift` jar we publish
which packages it's own `libthrift`.

To depend on the shaded jar, add the following to your maven build.
Note that this is only supported for a jaeger version >= 0.15.0
```xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.uber.jaeger</groupId>
<artifactId>jaeger-thrift</artifactId>
<classifier>thrift92</classifier>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the classifier add over artifactId?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The classifier adds in information on whether the shaded libthrift 0.9.2 is included or not.
Omitting the classifier will result in using the default artifact that does not contain the bundled libthrift. (It simply contains the generated thrift files).

In general, people never directly add jaeger-thrift because it is a transitive dependency of jaeger-core.

See http://maven.apache.org/pom.html for more information on the classifier mechanism

The classifier allows to distinguish artifacts that were built from the same POM but differ in their content. It is some optional and arbitrary string that - if present - is appended to the artifact name just after the version number.
As a motivation for this element, consider for example a project that offers an artifact targeting JRE 1.5 but at the same time also an artifact that still supports JRE 1.4. The first artifact could be equipped with the classifier jdk15 and the second one with jdk14 such that clients can choose which one to use.

<version>$jaegerVersion</version>
</dependency>
</dependencies>
</dependencyManagement>
```

## In-process Context Propagation
`jaeger-context` defines
[ThreadLocalTraceContext](./jaeger-context/src/main/java/com/uber/jaeger/context)
Expand Down
15 changes: 14 additions & 1 deletion jaeger-thrift/build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'org.jruyi.thrift'
apply plugin: 'com.github.johnrengelman.shadow'

//This is in a separate subproject so that we can use
//standard javac instead of the error prone compiler
Expand Down Expand Up @@ -38,6 +39,18 @@ sourceSets {
jar {
from sourceSets.main.output
manifest {
attributes('Implementation-Title': 'jaeger-generated', 'Implementation-Version': project.version)
attributes('Implementation-Title': 'jaeger-thrift', 'Implementation-Version': project.version)
}
}

shadowJar {
baseName = 'jaeger-thrift'
relocate 'org.apache.thrift', 'org.shadow.apache.thrift92'
classifier 'thrift92'
}

artifacts {
archives(shadowJar.archivePath) {
builtBy shadowJar
}
}