Permalink
Browse files

Version 0.1 of SBT Solr Plugin. Functional (barely) version. Logging,…

… /solr endpoint and assembly on the roadmap.
  • Loading branch information...
1 parent 9ed44e1 commit dffd3d17c903356826598e41401c46318b9659ce @daithiocrualaoich daithiocrualaoich committed Dec 14, 2010
Showing with 128 additions and 0 deletions.
  1. +8 −0 .gitignore
  2. +1 −0 README.md
  3. +7 −0 project/build.properties
  4. +20 −0 project/build/Project.scala
  5. +25 −0 project/plugins/Plugins.scala
  6. +67 −0 src/main/scala/com.gu.solr/SolrProject.scala
View
@@ -0,0 +1,8 @@
+dev
+target
+lib_managed
+src_managed
+project/boot
+project/plugins/project/build.properties
+*.iml
+.idea
View
@@ -4,6 +4,7 @@ Usage
Project file:
import sbt._
+ import com.gu.solr.SolrProject
class MyProject(info: ProjectInfo) extends SlorProject(info) {
...
@@ -0,0 +1,7 @@
+project.organization=com.gu
+project.name=sbt-solr-plugin
+sbt.version=0.7.4
+project.version=0.1
+def.scala.version=2.7.7
+build.scala.versions=2.8.1
+project.initialize=false
@@ -0,0 +1,20 @@
+/*
+
+ Copyright 2010 Guardian News and Media
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+import sbt._
+
+class Project(info: ProjectInfo) extends PluginProject(info) with IdeaProject
@@ -0,0 +1,25 @@
+/*
+
+ Copyright 2010 Guardian News and Media
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+import sbt._
+
+class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
+ val mpeltonen = "mpeltonen repo" at "http://mpeltonen.github.com/maven/"
+
+ val idea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.1-SNAPSHOT"
+}
+
@@ -0,0 +1,67 @@
+/*
+
+ Copyright 2010 Guardian News and Media
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+*/
+package com.gu.solr
+
+import sbt._
+
+class SolrProject(info: ProjectInfo) extends DefaultWebProject(info) {
+
+
+ def solrDirectory = "src" / "main" / "solr"
+ def solrIndexDirectory = outputPath / "solr" / "data"
+
+ private def outputSolrDirectory = outputPath / "solr"
+ private def outputWebappDirectory = outputPath / "webapp"
+
+ override val jettyPort = 8983
+
+ def jettyVersion = "6.1.14"
+ def solrVersion = "1.4.1"
+
+ val guardian = "Guardian GitHub" at "http://guardian.github.com/maven"
+
+ override def libraryDependencies = super.libraryDependencies ++
+ Set("org.apache.solr" % "solr-webapp" % solrVersion % "test",
+ "org.mortbay.jetty" % "jetty" % jettyVersion % "test",
+ "org.mortbay.jetty" % "jsp-2.1" % jettyVersion % "test",
+ "org.mortbay.jetty" % "jsp-api-2.1" % jettyVersion % "test")
+
+ override def scanDirectories = super.scanDirectories ++ Set(solrDirectory)
+
+ override def packageAction = task { None }
+
+ override def prepareWebappAction = task {
+ FileUtilities.clean(outputPath, log)
+ FileUtilities.sync(solrDirectory, outputSolrDirectory, log)
+
+ val solr = ("lib_managed" ** ("solr-webapp-%s.war" format solrVersion)).get.toList.head
+ FileUtilities.unzip(solr, outputWebappDirectory, log)
+
+ None
+ }
+
+ override def jettyRunClasspath = outputPath / "webapp" / "WEB-INF" / "lib" * "*.jar"
+
+ override def jettyRunAction = super.jettyRunAction dependsOn task {
+ System.setProperty("solr.solr.home", outputSolrDirectory.absolutePath)
+ System.setProperty("solr.data.dir", solrIndexDirectory.absolutePath)
+// System.setProperty("java.util.logging.config.file", (outputSolrDirectory / "logging.properties").absolutePath)
+
+ None
+ }
+}

0 comments on commit dffd3d1

Please sign in to comment.