Skip to content
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

Local maven publish #521

Merged
merged 4 commits into from
Feb 23, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions TrafficCapture/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
- [Traffic Capture Proxy Server](#traffic-capture-proxy-server)
- [Traffic Replayer](#traffic-replayer)
- [Capture Kafka Offloader](#capture-kafka-offloader)
- [Publishing](#publishing)

## Overview

Expand Down Expand Up @@ -136,3 +137,42 @@ The Capture Kafka Offloader will act as a Kafka Producer for offloading captured

Learn more about its functionality and setup here: [Capture Kafka Offloader](captureKafkaOffloader/README.md)

## Publishing

This project can be published to a local maven repository with:
```sh
./gradlew publishToMavenLocal
```

And subsequently imported into a separate gradle project with (replacing name with any subProject name)
```groovy
repositories {
mavenCentral()
mavenLocal()
}

dependencies {
implementation group: "org.opensearch.migrations.trafficcapture", name: "captureKafkaOffloader", version: "0.1.0-SNAPSHOT"
//... other dependencies
}
```

The entire list of published subprojects is
```text
captureKafkaOffloader
captureOffloader
captureProtobufs
coreUtilities
jsonJMESPathMessageTransformer
jsonJMESPathMessageTransformerProvider
jsonJoltMessageTransformer
jsonJoltMessageTransformerProvider
jsonMessageTransformerInterface
jsonMessageTransformers
nettyWireLogging
openSearch23PlusTargetTransformerProvider
replayerPlugins
trafficCaptureProxyServer
trafficCaptureProxyServerTest
trafficReplayer
```
29 changes: 29 additions & 0 deletions TrafficCapture/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@ allprojects {
}
}

subprojects {
apply plugin: 'java'
apply plugin: 'maven-publish'
def excludedProjects = [
'buildSrc',
'dockerSolution',
// TODO: Get testFixtures exported to Maven
'testUtilities',
]
if (!(project.name in excludedProjects)) {
publishing {
publications {
mavenJava(MavenPublication) {
artifactId = project.name

from components.java

groupId = 'org.opensearch.migrations.trafficcapture'
version = '0.1.0-SNAPSHOT'

// Suppress POM metadata warnings for test fixtures
suppressPomMetadataWarningsFor('testFixturesApiElements')
suppressPomMetadataWarningsFor('testFixturesRuntimeElements')
}
}
}
}
}

allprojects {
apply plugin: 'java'
apply plugin: 'jacoco'
Expand Down
6 changes: 3 additions & 3 deletions TrafficCapture/nettyWireLogging/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ dependencies {

implementation project(':captureOffloader')
implementation project(':coreUtilities')
api group: 'io.netty', name: 'netty-buffer'
api group: 'io.netty', name: 'netty-codec-http'
api group: 'io.netty', name: 'netty-handler'
api group: 'io.netty', name: 'netty-buffer', version: '4.1.100.Final'
api group: 'io.netty', name: 'netty-codec-http', version: '4.1.100.Final'
api group: 'io.netty', name: 'netty-handler', version: '4.1.100.Final'
Comment on lines +15 to +17
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that this used to be picked up via a BOM. Do you know why you had to specify the version here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was needed otherwise the external gradle project has to define the version to use.

If this was picked up via a BOM, then I think it was sparsely used throughout the project as explicitly specifying the netty version seemed more common


implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.7'

Expand Down
3 changes: 0 additions & 3 deletions TrafficCapture/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,3 @@ include('captureKafkaOffloader',
)

addSubProjects('', new File(rootProject.projectDir,'replayerPlugins'))
include 'replayerPlugins:jsonMessageTransformers:jsonJoltMessageTransformerProvider:untitled'
findProject(':replayerPlugins:jsonMessageTransformers:jsonJoltMessageTransformerProvider:untitled')?.name = 'untitled'

Loading