Created
December 17, 2012 19:30
-
-
Save schleichardt/4321215 to your computer and use it in GitHub Desktop.
answer to stackoverflow question http://stackoverflow.com/questions/13835581/where-place-compiled-javascript-class-files-for-sbt-and-play-framework-2-1-to-fi#comment19130392_13835581
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
logs | |
project/project | |
project/target | |
target | |
tmp | |
.history | |
dist | |
/.idea | |
/*.iml | |
/out | |
/.idea_modules | |
/.classpath | |
/.project | |
/RUNNING_PID | |
/.settings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is the main configuration file for the application. | |
# ~~~~~ | |
# Secret key | |
# ~~~~~ | |
# The secret key is used to secure cryptographics functions. | |
# If you deploy your application to several instances be sure to use the same key! | |
application.secret="[O62eawT;]t7lyQd9CsilTFQ2dJUo>iXlsbp``PAolHOIs6bopSPhGOvlqy:I@l?" | |
# The application languages | |
# ~~~~~ | |
application.langs="en" | |
# Global object class | |
# ~~~~~ | |
# Define the Global object class for this application. | |
# Default to Global in the root package. | |
# application.global=Global | |
# Router | |
# ~~~~~ | |
# Define the Router object to use for this application. | |
# This router will be looked up first when the application is starting up, | |
# so make sure this is the entry point. | |
# Furthermore, it's assumed your route file is named properly. | |
# So for an application router like `my.application.Router`, | |
# you may need to define a router file `conf/my.application.routes`. | |
# Default to Routes in the root package (and conf/routes) | |
# application.router=my.application.Routes | |
# Database configuration | |
# ~~~~~ | |
# You can declare as many datasources as you want. | |
# By convention, the default datasource is named `default` | |
# | |
# db.default.driver=org.h2.Driver | |
# db.default.url="jdbc:h2:mem:play" | |
# db.default.user=sa | |
# db.default.password="" | |
# Evolutions | |
# ~~~~~ | |
# You can disable evolutions if needed | |
# evolutionplugin=disabled | |
# Logger | |
# ~~~~~ | |
# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory . | |
# Root logger: | |
logger.root=ERROR | |
# Logger used by the framework: | |
logger.play=INFO | |
# Logger provided to your application: | |
logger.application=DEBUG | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import play.api._ | |
import play.api.mvc._ | |
object Application extends Controller { | |
def index = Action { | |
Ok(so.Example.hello) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sbt.version=0.12.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.ivy.util.FileUtil | |
import sbt._ | |
import sbt.Keys._ | |
import play.Project._ | |
import java.io.File | |
object ApplicationBuild extends Build { | |
val appName = "so13835581" | |
val appVersion = "1.0-SNAPSHOT" | |
val appDependencies = Seq( | |
// Add your project dependencies here, | |
jdbc, | |
anorm | |
) | |
val rhinoJarName = "rhino.jar" | |
val folderForRhinoJar = unmanagedBase | |
val rhinoClasspath = (baseDirectory) map { base => Attributed.blank(base / "rhino")} | |
val rhinoClassesToJar = TaskKey[Unit]("rhino-classes-to-jar") | |
val rhinoClassesToJarInitializer = (base: File, folderForJar: File) => { | |
val rhinoFolder = new File(base, "rhino") | |
val isClassFile = (file: File) => file.getName.endsWith("class") | |
val classFiles = rhinoFolder.***.filter(isClassFile).get | |
val sources = classFiles map { file => | |
file -> file.getCanonicalPath.drop(rhinoFolder.getCanonicalPath.length + 1) | |
} | |
IO.jar(sources, folderForJar / rhinoJarName, new java.util.jar.Manifest()) | |
} | |
val main = play.Project(appName, appVersion, appDependencies).settings( | |
unmanagedClasspath in Compile <+= rhinoClasspath, | |
unmanagedClasspath in Runtime <+= rhinoClasspath, | |
rhinoClassesToJar <<= (baseDirectory, folderForRhinoJar) map rhinoClassesToJarInitializer, | |
playStage <<= playStage.dependsOn(rhinoClassesToJar), | |
playStage <<= (playStage, folderForRhinoJar) map {(unused, folder) => | |
IO.delete(folder / rhinoJarName) | |
}, | |
cleanFiles <+= folderForRhinoJar { _ / rhinoJarName } //make sure jar will be deleted if play stage does not finish and cleanup jar | |
) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Comment to get more information during initialization | |
logLevel := Level.Warn | |
// The Typesafe repository | |
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" | |
// Use the Play sbt plugin for Play projects | |
addSbtPlugin("play" % "sbt-plugin" % "2.1-RC1") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Routes | |
# This file defines all application routes (Higher priority routes first) | |
# ~~~~ | |
# Home page | |
GET / controllers.Application.index | |
# Map static resources from the /public folder to the /assets URL path | |
GET /assets/*file controllers.Assets.at(path="/public", file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment