play framework 2.5.3 学习和使用过程中的“坑”
来源:互联网 发布:佛道 知乎 编辑:程序博客网 时间:2024/05/21 00:55
play framework 2.5.3学习和使用过程中的“坑”
最近项目需要,接触到了play, 使用过程中,遇到了一些坑, 记下来。
1. 版本
play分1.x和2.x两个系列,差异很大。
2.x系列 中的2.3+也有所不同,(目前官方的说法是Lightbend Activator)
安装还是比较简单的,
基本就是解压缩, 配置PATH
依赖的有
SCALA (基本也是解压缩,配置PATH)
2. jdk
文档上明确说明需要 java 1.8
我这边因为防火墙和 Linux 版本的问题, yum一直有问题。
这次的解决办法是,直接下载了Oracle的jdk1.8,tar.gz版本的那个。
解压缩后,直接修改 /usr/bin/java 和/usr/bin/javac 的指向,(其他的没有动,可能会出现莫名错误)
修改了 /etc/profile中的JAVA_HOME(没有的话, 创建一个)
3. 最基本的三个命令
第一次运行的时候,会自动下载很多的依赖项。需要耐心等候。
输出类似如下:
[info] Resolving jline#jline;2.12.1...
[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-server_2.11/2.5.0/play-server_2.11-2.5.0.jar...
[info] [SUCCESSFUL ]com.typesafe.play#play-server_2.11;2.5.0!play-server_2.11.jar(9245ms)
[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-java_2.11/2.5.0/play-java_2.11-2.5.0.jar...
[info] [SUCCESSFUL ]com.typesafe.play#play-java_2.11;2.5.0!play-java_2.11.jar (18457ms)
[info] downloadinghttps://repo1.maven.org/maven2/com/typesafe/play/play-netty-server_2.11/2.5.0/play-netty-server_2.11-2.5.0.jar...
[info] [SUCCESSFUL ]com.typesafe.play#play-netty-server_2.11;2.5.0!play-netty-server_2.11.jar(6129ms)
首先,安装好了后, 先得创建一个最小示例, 检验下还有哪些问题。
activator new mytest play-java,
使用play-java模板 创建mytest工程
下面这个命令,省略了 模板 play-java, 可以交互的输入,如果也省略了项目名字,也可以交互输入
activator new test
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
Fetching the latest list oftemplates...
Could not fetch the updated list oftemplates. Using the local cache.
Check your proxy settings or increasethe timeout. For more details see:
http://lightbend.com/activator/docs
Browse the list of templates:http://lightbend.com/activator/templates
Choose from these featured templates orenter a template name:
1) minimal-akka-java-seed
2) minimal-akka-scala-seed
3) minimal-java
4) minimal-scala
5) play-java
6) play-scala
(hit tab to see a list of alltemplates)
> 5 <=(输入5)
OK, application "test" isbeing created using the "play-java" template.
(省略部分输出)
To run "test" from thecommand line, "cd test" then:
/home/spark/activator-dist-1.3.10/test/activatorrun
To run the test for "test"from the command line, "cd test" then:
/home/spark/activator-dist-1.3.10/test/activatortest
To run the Activator UI for "test"from the command line, "cd test" then:
/home/spark/activator-dist-1.3.10/test/activatorui
[root@xuyongshi activator-dist-1.3.10]#
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
进入交互输入界面,或者控制台,
可以输入
compile 编译项目
run 运行在一个web容器里运行项目
test 单元测试
项目的名字,就是所在的文件夹, 这个文件夹的名字,以后可以修改,不会影响项目。
部分输出
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
[mytest] $ compile
[info] Updating{file:/tmp/mytest/}root...
[info] Resolving jline#jline;2.12.1...
[info] Done updating.
[info] Compiling 6 Scala sources and 10Java sources to /tmp/mytest/target/scala-2.11/classes...
[info] 'compiler-interface' not yetcompiled for Scala 2.11.7. Compiling...
[info] Compilation completed in29.644 s
[success] Total time: 94 s, completedMay 12, 2016 6:23:53 PM
[mytest] $ run
--- (Running the application,auto-reloading is enabled) ---
[error] p.c.s.NettyServer - Failed tolisten for HTTP on /0.0.0.0:9000!
[error] (compile:run)play.runsupport.ServerStartException
[error] Total time: 7 s, completed May12, 2016 6:24:03 PM
[mytest] $
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- play framework 2.5.3 学习和使用过程中的“坑”
- Play Framework介绍3--使用Eclipse开发和调试
- Play Framework介绍3--使用Eclipse开发和调试
- play framework学习(使用CRU模块)
- Play framework 框架入门学习文档(play-1.2.3)
- play framework学习笔记
- Play!Framework学习笔记:初识Play
- play framework学习笔记之 ajax集成使用
- play framework学习笔记之 使用缓存cache
- play framework学习笔记之 ajax集成使用
- Play framework如何使用play控制台
- Play Framework介绍:使用Eclipse开发和调试
- play framework学习(一)
- Play framework 学习(tips)
- play framework学习(paginate)
- play framework学习(CRUD)
- play framework学习(secure)
- play framework学习(mysql)
- 多个数组求交集 js
- AndroidStudio导入项目一直Building解决方案
- 基数排序
- ListView的使用技巧
- Understanding C/C++ Strict Aliasing
- play framework 2.5.3 学习和使用过程中的“坑”
- 搜索技巧
- C程序在内存中的分区情况
- html5web通信-跨文档消息传输
- ListView 底部分割线如何显示
- JSP内置对象
- Codeforces #349 div1 C. Codeword 组合数学 递推
- 英语作文模板
- Hello, world!