Skip to content

Commit f8b91f9

Browse files
committed
Merge pull request #15 from Shiti/develop
DB-50
2 parents 6f8eb26 + 65b6405 commit f8b91f9

File tree

3 files changed

+38
-40
lines changed

3 files changed

+38
-40
lines changed

build.sbt

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name := "kafka-connect-cassandra"
22

3-
version := "0.0.5"
3+
version := "0.0.6"
44

55
crossScalaVersions := Seq("2.11.7", "2.10.6")
66

@@ -10,6 +10,8 @@ scalaVersion := sys.props.getOrElse("scala.version", crossScalaVersions.value.he
1010

1111
organization := "com.tuplejump"
1212

13+
organizationHomepage := Some(new java.net.URL("http://www.tuplejump.com"))
14+
1315
description := "A Kafka Connect Cassandra Source and Sink connector."
1416

1517
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0"))
@@ -37,35 +39,7 @@ libraryDependencies ++= Seq(
3739
}
3840
)
3941

40-
import com.github.hochgi.sbt.cassandra._
41-
42-
CassandraPlugin.cassandraSettings
43-
44-
cassandraVersion := cassandra
45-
cassandraStartDeadline := 40
46-
cassandraCqlInit := "src/it/resources/setup.cql"
47-
48-
49-
test in IntegrationTest <<= (test in IntegrationTest).dependsOn(startCassandra)
50-
testOnly in IntegrationTest <<= (testOnly in IntegrationTest).dependsOn(startCassandra)
51-
52-
//sbt-cassandra plugin adds these to Test configuration but not to IntegrationTest config
53-
// https://github.com/hochgi/sbt-cassandra-plugin/issues/5
54-
//if compilation of test classes fails, cassandra should not be invoked. (moreover, Test.Cleanup won't execute to stop it...)
55-
startCassandra <<= startCassandra.dependsOn(compile in IntegrationTest)
56-
//make sure to Stop cassandra when tests are done.
57-
testOptions in IntegrationTest <+= (cassandraPid, stopCassandraAfterTests, cleanCassandraAfterStop, target) map {
58-
case (pid, stop, clean, targetDir) => Tests.Cleanup(() => {
59-
if(stop) stopCassandraMethod(clean, targetDir / "data", pid)
60-
})
61-
}
62-
63-
/* TODO
64-
Found intransitive dependency (org.apache.cassandra:apache-cassandra:3.0.0) while publishMavenStyle is true,
65-
but Maven repositories do not support intransitive dependencies. Use exclusions instead so transitive dependencies
66-
will be correctly excluded in dependent projects.
67-
*/
68-
publishMavenStyle := false
42+
publishMavenStyle := true
6943

7044
/* Compiler settings and checks, code checks and compliance: */
7145
cancelable in Global := true
@@ -120,7 +94,7 @@ lazy val testOptionsSettings = Tests.Argument(TestFrameworks.ScalaTest, "-oDF")
12094
lazy val testConfigSettings = inConfig(Test)(Defaults.testTasks) ++
12195
inConfig(IntegrationTest)(Defaults.itSettings)
12296

123-
lazy val testSettings = testConfigSettings ++ cassandraSettings ++ Seq(
97+
lazy val testSettings = testConfigSettings ++ Seq(
12498
fork in IntegrationTest := false,
12599
fork in Test := true,
126100
parallelExecution in IntegrationTest := false,
@@ -156,12 +130,34 @@ pomExtra :=
156130
</developer>
157131
</developers>
158132

159-
lazy val root = (project in file(".")).settings(
133+
publishTo <<= version {
134+
(v: String) =>
135+
val nexus = "https://oss.sonatype.org/"
136+
if (v.trim.endsWith("SNAPSHOT"))
137+
Some("snapshots" at nexus + "content/repositories/snapshots")
138+
else
139+
Some("releases" at nexus + "service/local/staging/deploy/maven2")
140+
}
141+
142+
publishArtifact in Test := false
143+
144+
pomIncludeRepository := {
145+
_ => false
146+
}
147+
148+
pomIncludeRepository := { _ => false }
149+
150+
lazy val root = (project in file("."))
151+
.enablePlugins(BuildInfoPlugin)
152+
.enablePlugins(AutomateHeaderPlugin)
153+
.enablePlugins(CassandraITPlugin)
154+
.settings(
160155
buildInfoKeys := Seq[BuildInfoKey](version),
161156
buildInfoPackage := "com.tuplejump.kafka.connect.cassandra",
162-
buildInfoObject := "CassandraConnectorInfo")
157+
buildInfoObject := "CassandraConnectorInfo",
158+
cassandraVersion := cassandra,
159+
cassandraCqlInit := "src/it/resources/setup.cql",
160+
cassandraStartDeadline := 40
161+
)
163162
.settings(testSettings)
164-
.enablePlugins(BuildInfoPlugin)
165-
.enablePlugins(AutomateHeaderPlugin)
166163
.configs(IntegrationTest)
167-

project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"
22

3-
addSbtPlugin("com.github.hochgi" % "sbt-cassandra-plugin" % "0.6.2")
3+
addSbtPlugin("com.tuplejump.com.github.hochgi" % "sbt-cassandra" % "1.0.0")
44
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2")
55
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "1.5.0")
66
addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.8.0")

src/main/scala/com/tuplejump/kafka/connect/cassandra/ConnectorLike.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import scala.util.control.NonFatal
2424
import org.apache.kafka.connect.connector.Task
2525
import org.apache.kafka.common.config.ConfigException
2626
import com.datastax.driver.core.Session
27+
import org.apache.kafka.connect.errors.ConnectException
2728

2829
/** INTERNAL API. */
2930
private[kafka] trait ConnectorLike extends Logging {
@@ -72,8 +73,9 @@ private[kafka] trait TaskLifecycle extends Task with ConnectorLike {
7273

7374
protected var _session: Option[Session] = None
7475

75-
private[cassandra] def session: Session = _session.getOrElse(throw new IllegalStateException(
76-
"Sink has not been started yet or is not configured properly to connect to a cluster."))
76+
private[cassandra] def session: Session = _session.getOrElse(throw new ConnectException(
77+
s"""Failed to connect to a Cassandra cluster.
78+
|${this.getClass.getName} has not been started yet or is not configured properly.""".stripMargin))
7779

7880
def taskClass: Class[_ <: Task]
7981

@@ -86,7 +88,7 @@ private[kafka] trait TaskLifecycle extends Task with ConnectorLike {
8688
cluster = Some(_cluster)
8789
} catch {
8890
case NonFatal(e) =>
89-
logger.info("Unable to start CassandraSinkConnector, shutting down.", e)
91+
logger.info(s"Unable to start ${this.getClass.getName}, shutting down.", e)
9092
_cluster.shutdown()
9193
}
9294
}

0 commit comments

Comments
 (0)