Play是一个full-stack(全栈的)Java Web应用框架,包括一个简单的无状态MVC模型,具有Hibernate的对象持续,一个基于Groovy的模板引擎,以及建立一个现代Web应用所需的所有东西

Play Framework

官网:https://playframework.com/
官网下载页:https://playframework.com/download

官方play-2.2.6.zip下载
本地play-2.2.6.zip下载

环境:
   centos 7.2
   jdk version 1.7.0_79
   play version 2.2.6

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
[root@localhost ~]# unzip play-2.2.6.zip -d /usr/local/
[root@localhost ~]# tail -2 /etc/profile
export PLAY_HOME="/usr/local/play-2.2.6"
export PATH="$PLAY_HOME":$PATH
[root@localhost ~]# echo $PLAY_HOME
/usr/local/play-2.2.6
[root@localhost ~]#
#play安装完成
[root@localhost ~]# play -version
Getting com.typesafe.play console_2.10 2.2.6 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
6 artifacts copied, 0 already retrieved (2012kB/72ms)
Getting Scala 2.10.3 (for console)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
5 artifacts copied, 0 already retrieved (24447kB/302ms)
_
_ __ | | __ _ _ _
| '_ \| |/ _' | || |
| __/|_|\____|\__ /
|_| |__/
play 2.2.6 built with Scala 2.10.3 (running Java 1.7.0_79), http://www.playframework.com
This is not a play application!
Use `play new` to create a new Play application in the current directory,
or go to an existing application and launch the development console using `play`.
You can also browse the complete documentation at http://www.playframework.com.
[root@localhost ~]#

创建一个简单的play测试项目
play支持Scala和JAVA,两者均为一种语言

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
[root@localhost play]# play new test
_
_ __ | | __ _ _ _
| '_ \| |/ _' | || |
| __/|_|\____|\__ /
|_| |__/
play 2.2.6 built with Scala 2.10.3 (running Java 1.7.0_79), http://www.playframework.com
The new application will be created in /opt/play/test
What is the application name? [test]
> Play Jack Wang
Error: Application name may only contain letters, digits, '_' and '-', and it must start with a letter.
What is the application name? [test]
> PlayJackWang
Which template do you want to use for this new application?
1 - Create a simple Scala application
2 - Create a simple Java application
> 1
OK, application PlayJackWang is created.
Have fun!
[root@localhost play]#
[root@localhost play]# pwd
/opt/play
[root@localhost play]# ll
total 0
drwxr-xr-x 7 root root 111 Nov 14 2014 test
[root@localhost play]#
[root@localhost play]# tree test/
test/
├── app
│   ├── controllers
│   │   └── Application.scala
│   └── views
│   ├── index.scala.html
│   └── main.scala.html
├── build.sbt
├── conf
│   ├── application.conf
│   └── routes
├── project
│   ├── build.properties
│   └── plugins.sbt
├── public
│   ├── images
│   │   └── favicon.png
│   ├── javascripts
│   │   └── jquery-1.9.0.min.js
│   └── stylesheets
│   └── main.css
├── README
└── test
├── ApplicationSpec.scala
└── IntegrationSpec.scala
10 directories, 14 files
[root@localhost play]#
#然后进入项目所在的目录,使用play run test运行项目
[root@localhost ~]# cd /opt/play/test/
[root@localhost test]# play run test
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
43 artifacts copied, 0 already retrieved (12440kB/128ms)
[info] Loading project definition from /opt/play/test/project
[info] Set current project to PlayJackWang (in build file:/opt/play/test/)
[info] Updating {file:/opt/play/test/}test...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 5 Scala sources and 1 Java source to /opt/play/test/target/scala-2.10/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.10.3. Compiling...
[info] Compilation completed in 32.219 s
[info] play - Application started (Dev)

1
2
3
[root@localhost ~]# netstat -tunlp | grep 9000
tcp6 0 0 :::9000 :::* LISTEN 1833/java
[root@localhost ~]#

Play_test_page

play+jenkins

Jenkins默认是没有安装play插件的
play_jenkis_plugin

“Jenkis”— “系统管理”— “Global Tool Configuration”— “Play”
play_jenkis
play_jenkis
play_jenkis
play_jenkis

我没有play项目跑不了Jenkins,这里就不做了哈


本作品采用知识共享署名 2.5 中国大陆许可协议进行许可,欢迎转载,但转载请注明来自Jack Wang Blog,并保持转载后文章内容的完整。本人保留所有版权相关权利。
打赏
本文出自”Jack Wang Blog”:http://www.yfshare.vip/2017/06/19/Play-Framework/