From 164a979141418f20c25d7ff4927de8144a694fa5 Mon Sep 17 00:00:00 2001 From: avianey Date: Wed, 24 Oct 2012 08:02:56 +0200 Subject: [PATCH] maven + windows --- bin/kafka-console-consumer.bat | 5 +++ bin/kafka-console-producer.bat | 2 + bin/kafka-run-class.bat | 77 ++++++++++++++++++++++++++++++++ bin/kafka-server-start.bat | 27 +++++++++++ bin/zookeeper-server-start.bat | 22 +++++++++ project/build/KafkaProject.scala | 5 +++ sbt.bat | 1 + 7 files changed, 139 insertions(+) create mode 100644 bin/kafka-console-consumer.bat create mode 100644 bin/kafka-console-producer.bat create mode 100644 bin/kafka-run-class.bat create mode 100644 bin/kafka-server-start.bat create mode 100644 bin/zookeeper-server-start.bat create mode 100644 sbt.bat diff --git a/bin/kafka-console-consumer.bat b/bin/kafka-console-consumer.bat new file mode 100644 index 0000000000000..81decea543b03 --- /dev/null +++ b/bin/kafka-console-consumer.bat @@ -0,0 +1,5 @@ +@echo off +SetLocal +set KAFKA_OPTS=-Xmx512M -server -Dcom.sun.management.jmxremote -Dlog4j.configuration=file:"%CD%\kafka-console-consumer-log4j.properties" +kafka-run-class.bat kafka.consumer.ConsoleConsumer %* +EndLocal diff --git a/bin/kafka-console-producer.bat b/bin/kafka-console-producer.bat new file mode 100644 index 0000000000000..734b31f8a516d --- /dev/null +++ b/bin/kafka-console-producer.bat @@ -0,0 +1,2 @@ +@echo off +kafka-run-class.bat kafka.producer.ConsoleProducer %* diff --git a/bin/kafka-run-class.bat b/bin/kafka-run-class.bat new file mode 100644 index 0000000000000..5e4aaa4b53891 --- /dev/null +++ b/bin/kafka-run-class.bat @@ -0,0 +1,77 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +setlocal enabledelayedexpansion + +IF [%1] EQU [] ( + echo "USAGE: $0 classname [opts]" + goto :eof +) + +set BASE_DIR=%CD%\.. +set CLASSPATH= +echo %BASE_DIR% + +for %%i in (%BASE_DIR%\project\boot\scala-2.8.0\lib\*.jar) do ( + call :concat %%i +) + +for %%i in (%BASE_DIR%\core\target\scala_2.8.0\*.jar) do ( + call :concat %%i +) + +for %%i in (%BASE_DIR%\core\lib\*.jar) do ( + call :concat %%i +) + +for %%i in (%BASE_DIR%\perf\target\scala_2.8.0/kafka*.jar) do ( + call :concat %%i +) + +for %%i in (%BASE_DIR%\core\lib_managed\scala_2.8.0\compile\*.jar) do ( + call :concat %%i +) + +IF ["%KAFKA_JMX_OPTS%"] EQU [""] ( + set KAFKA_JMX_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false +) + +IF ["%KAFKA_OPTS%"] EQU [""] ( + set KAFKA_OPTS=-Xmx512M -server -Dlog4j.configuration=file:"%BASE_DIR%\config\log4j.properties" +) + +IF ["%JMX_PORT%"] NEQ [""] ( + set KAFKA_JMX_OPTS=%KAFKA_JMX_OPTS% -Dcom.sun.management.jmxremote.port=%JMX_PORT% +) + +IF ["%JAVA_HOME%"] EQU [""] ( + set JAVA=java +) ELSE ( + set JAVA="%JAVA_HOME%/bin/java" +) + +set SEARCHTEXT=\bin\.. +set REPLACETEXT= +set CLASSPATH=!CLASSPATH:%SEARCHTEXT%=%REPLACETEXT%! +set COMMAND= %JAVA% %KAFKA_OPTS% %KAFKA_JMX_OPTS% -cp %CLASSPATH% %* +set SEARCHTEXT=-cp ; +set REPLACETEXT=-cp +set COMMAND=!COMMAND:%SEARCHTEXT%=%REPLACETEXT%! + +%COMMAND% + +:concat +set CLASSPATH=%CLASSPATH%;"%1" \ No newline at end of file diff --git a/bin/kafka-server-start.bat b/bin/kafka-server-start.bat new file mode 100644 index 0000000000000..7db76dd44bab5 --- /dev/null +++ b/bin/kafka-server-start.bat @@ -0,0 +1,27 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +IF [%1] EQU [] ( + echo "USAGE: $0 server.properties [consumer.properties producer.properties]" + goto :eof +) + +IF [%JMX_PORT%] EQU [] ( + echo Set JMX_PORT to default value : 9999 + set JMX_PORT=9999 +) + +kafka-run-class.bat kafka.Kafka %* \ No newline at end of file diff --git a/bin/zookeeper-server-start.bat b/bin/zookeeper-server-start.bat new file mode 100644 index 0000000000000..0dd40ba7bb08c --- /dev/null +++ b/bin/zookeeper-server-start.bat @@ -0,0 +1,22 @@ +@echo off +rem Licensed to the Apache Software Foundation (ASF) under one or more +rem contributor license agreements. See the NOTICE file distributed with +rem this work for additional information regarding copyright ownership. +rem The ASF licenses this file to You under the Apache License, Version 2.0 +rem (the "License"); you may not use this file except in compliance with +rem the License. You may obtain a copy of the License at +rem +rem http://www.apache.org/licenses/LICENSE-2.0 +rem +rem Unless required by applicable law or agreed to in writing, software +rem distributed under the License is distributed on an "AS IS" BASIS, +rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +rem See the License for the specific language governing permissions and +rem limitations under the License. + +IF [%1] EQU [] ( + echo "USAGE: $0 zookeeper.properties" + goto :eof +) + +kafka-run-class.bat org.apache.zookeeper.server.quorum.QuorumPeerMain %* diff --git a/project/build/KafkaProject.scala b/project/build/KafkaProject.scala index d0b52cf29be26..f4d38ed51d9b6 100644 --- a/project/build/KafkaProject.scala +++ b/project/build/KafkaProject.scala @@ -18,8 +18,13 @@ import sbt._ import scala.xml.{Node, Elem, NodeSeq} import scala.xml.transform.{RewriteRule, RuleTransformer} +import java.io.File class KafkaProject(info: ProjectInfo) extends ParentProject(info) with IdeaProject { + + override def managedStyle = ManagedStyle.Maven + lazy val publishTo = Resolver.file("file", new File( "D:\\Outils\\Maven\\repo" )) + lazy val core = project("core", "core-kafka", new CoreKafkaProject(_)) lazy val examples = project("examples", "java-examples", new KafkaExamplesProject(_), core) lazy val contrib = project("contrib", "contrib", new ContribProject(_)) diff --git a/sbt.bat b/sbt.bat new file mode 100644 index 0000000000000..989c6872a40bf --- /dev/null +++ b/sbt.bat @@ -0,0 +1 @@ +java -Xmx1024M -XX:MaxPermSize=512m -jar lib\sbt-launch.jar "%1" \ No newline at end of file