Skip to content

Commit

Permalink
Merge pull request #521 from AndreKurait/LocalMavenPublish
Browse files Browse the repository at this point in the history
Local maven publish
  • Loading branch information
AndreKurait authored Feb 23, 2024
2 parents 6a02317 + d99fc03 commit 1bac3f8
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 6 deletions.
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'

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'

0 comments on commit 1bac3f8

Please sign in to comment.