playframework框架模块模块化新手教程

本笔记用于记录。

 

写在前面的话:

    play框架安装就省略了,本文主要用于新手。

一.准备工作

   为了使用右键直接打开cmd窗口。将以下内容复制,到一个txt文件中,并且将后缀名改为.reg。然后运行它。

Windows Registry Editor Version 5.00

[-HKEY_CLASSES_ROOT\Directory\shell\runas]

[HKEY_CLASSES_ROOT\Directory\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""

[-HKEY_CLASSES_ROOT\Directory\Background\shell\runas]

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Directory\Background\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""



[-HKEY_CLASSES_ROOT\Drive\shell\runas]

[HKEY_CLASSES_ROOT\Drive\shell\runas]
@="Open command window here as Administrator"
"HasLUAShield"=""

[HKEY_CLASSES_ROOT\Drive\shell\runas\command]
@="cmd.exe /s /k pushd \"%V\""



[-HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas]

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas]
"HasLUAShield"=""
@="Open command window here as Administrator"

[HKEY_CLASSES_ROOT\LibraryFolder\background\shell\runas\command]

运行完成后,在空白处点击右键,如图

点击Open command window here as Admin 就可以了。

二.常用命令

创建一个项目:    play new 项目根路径
创建一个模块:    play new-module 项目根路径
构建eclipse项目: play eclipsify 项目根路径
构建项目依赖:    play dependencies 项目根路径
项目编译发布:    play war 项目根路径 --exclude .svn:target:logs:tmp -o 编译后的项目目录

三.正式开始

 

a.在自己的工作空间中创建一个新项目(项目名:Main)

1. 创建

play new Main

2. 转为eclipse可以打开的项目

play eclipsify Main

b.在前面的目录下,再创建一个模块 (项目名:Module)

1. 创建

play new-module Module

2.转为eclipse可以打开的项目

play eclipsify Module

c.将这两个项目导入eclipse

 

d.找到Main项目中的  /conf/dependencies.yml 这个文件

注意:千万不要使用Tab键,因为这里对\t很敏感

# Application dependencies

require:
    - play
    - Module -> Module

repositories:
    - confs:
        type: local
        artifact: ${application.path}/../[module]
        contains: 
             - Module  -> Module 

e.再次进入Main项目文件夹l里面。(我这里是:D:\test\Main)

打开cmd,使用play dependencies

 

这里就成功了

注意:

如果发生有什么错误,检查jdk的环境配置是否配置JAVA_HOME

f.这时候,我们进入eclipse,然后刷新项目

 

这里会多一个文件

打开后是这个,说明任务还没有结束

g.再次回到文件夹(我这里是:D:\test)

 

右键打开cmd:()

再次运行play eclipsify Main 

 

在返回eclipse,刷新项目。

如图:

在Main项目中有了Module文件夹

同时,在conf文件夹下

 

如果还要添加别的模块

例如,Play框架自带的secure框架

在Main 中  /conf/dependencies.yml 

直接添加:

require:
    - play

    - Module -> Moduleplay -> secure

    - play -> secure

然后再次执行play dependencies以及 play eclipsify 命令,刷新项目,即可完成。

结束!

都2021年了,还是Spring吧

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值