-
Notifications
You must be signed in to change notification settings - Fork 39
Use the shadow plugin to shade Jetty #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.gradle-7.6.1.pkg | ||
.gradle-8.13.pkg |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import com.vanniktech.maven.publish.JavaLibrary | ||
import com.vanniktech.maven.publish.JavadocJar | ||
import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
|
||
plugins { | ||
`java-library` | ||
id("com.gradleup.shadow") | ||
id("com.vanniktech.maven.publish.base") | ||
} | ||
|
||
dependencies { | ||
// Ignore transtive dependencies and insyead manage explicitly. | ||
implementation(libs.awsDynamodbLocal) { | ||
isTransitive = false | ||
} | ||
|
||
// Implementation dependencies will be shaded in the JAR. | ||
implementation(libs.bundles.jackson) | ||
implementation(libs.bundles.jetty) | ||
implementation(libs.kotlinStdLib) | ||
|
||
// Shadow dependencies will not be shaded. | ||
shadow(libs.antlr4Runtime) | ||
shadow(libs.aws2Dynamodb) | ||
shadow(libs.aws2DynamodbEnhanced) | ||
shadow(libs.aws2Pinpoint) | ||
shadow(libs.awsDynamodb) | ||
shadow(libs.commonsCli) | ||
shadow(libs.commonsLang3) | ||
shadow(libs.guava) | ||
shadow(libs.slf4jApi) | ||
shadow(libs.bundles.sqlite4java) | ||
} | ||
|
||
tasks.shadowJar { | ||
// Dependencies to be shaded must be explicitly included as dependencies. | ||
dependencies { | ||
include(dependency("com.amazonaws:DynamoDBLocal")) | ||
include(dependency("com.fasterxml.jackson.core:.*")) | ||
include(dependency("com.fasterxml.jackson.dataformat:.*")) | ||
include(dependency("com.fasterxml.jackson.datatype:.*")) | ||
include(dependency("com.fasterxml.jackson.module:.*")) | ||
include(dependency("org.eclipse.jetty:.*")) | ||
} | ||
|
||
// Relocate packages to avoid conflicts. | ||
relocate("com.amazon.dynamodb.grammar", "shaded.com.amazon.dynamodb.grammar") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: it might be better to use a more unique prefix, like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good call, added a project-specific prefix to the package name. |
||
relocate("com.amazon.ion", "shaded.com.amazon.ion") | ||
relocate("com.amazonaws.services.dynamodbv2.dataMembers", "shaded.com.amazonaws.services.dynamodbv2.dataMembers") | ||
relocate("com.amazonaws.services.dynamodbv2.datamodel", "shaded.com.amazonaws.services.dynamodbv2.datamodel") | ||
relocate("com.amazonaws.services.dynamodbv2.dbenv", "shaded.com.amazonaws.services.dynamodbv2.dbenv") | ||
relocate("com.amazonaws.services.dynamodbv2.exceptions", "shaded.com.amazonaws.services.dynamodbv2.exceptions") | ||
relocate("com.amazonaws.services.dynamodbv2.local", "shaded.com.amazonaws.services.dynamodbv2.local") | ||
relocate("com.fasterxml.jackson", "shaded.com.fasterxml.jackson") | ||
relocate("ddb.partiql", "shaded.ddb.partiql") | ||
relocate("kotlin", "shaded.kotlin") | ||
relocate("org.eclipse.jetty", "shaded.org.eclipse.jetty") | ||
relocate("org.partiql", "shaded.org.partiql") | ||
|
||
mergeServiceFiles() | ||
|
||
// Publish shadow JAR as the main JAR. | ||
archiveClassifier = "" | ||
} | ||
|
||
configure<MavenPublishBaseExtension> { | ||
configure( | ||
JavaLibrary( | ||
javadocJar = JavadocJar.Empty(), | ||
sourcesJar = false, | ||
) | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo:
insyead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!