• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

wangyizhuo/play-maven: Maven module for play framework

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

wangyizhuo/play-maven

开源软件地址(OpenSource Url):

https://github.com/wangyizhuo/play-maven

开源编程语言(OpenSource Language):

Python 82.7%

开源软件介绍(OpenSource Introduction):

Maven support

The Maven module enables maven support for your application. It adds a pom.xml in your project and deploys a play-parent pom in your local Maven repository.
Thus, libraries are copied to /lib folder.

Moreover, this module has the ability to create a war package of a Play! application using the ‘mvn package’ command’.
The Play! applciations can now be used in you Continuous Integration (CI) system.

What is supported?

  • A standard pom.xml can be installed in your Play! application.
  • Libraries dependencies are handled by your pom and are downloaded to your /lib folder in a single command.
  • Cleaning libraries in the /lib folder is supported in a single command.
  • Packaging your Play! application to a war using Maven is now possible (using only mvn package).

Getting started

First, you need to download and install Apache Maven.

Finally, you need to install the play-maven module:

# play install maven

Setting up the Maven module

Start by creating a new application in the classical way.

# play new test-maven

Then edit the conf/application.conf file to enable the Maven module:

# Additional modules
# ~~~~~
# A module is another play! application. Add a line for each module you want
# to add to your application. Module paths are either absolutes or relative to
# the application root.
#
module.maven=${play.path}/modules/maven

At this moment, if you are working with Eclipse, do not forget to update your .classpath :

# play ec

You now have to install play-parent in your repository and get a pom.xml in your Play! application :

# play mvn:init

This command installs play-parent pom in your local repository (ex : ~/.m2/repository) and copies the ‘skeleton’ pom from the play-module to your application.

Edit your pom.xml to change your groupId, artifactId, version, name and description.

Launch an update to retrieve Play! libraries and check there is no error :

# play mvn:up

That’s it ! Your application is Maven-compliant.
The following maven commands are now working :

# mvn clean // be careful, it deletes your /lib folder
# mvn compile
# mvn package // will create a war file

play-maven specific commands

# play mvn:init

Installs play-parent project (a Maven pom project) into local Maven repository. Then creates the appropriate pom.xml. After this step, you can add your dependencies to pom.xml.

# play mvn:update // or play mvn:up

Retrieves all defined dependencies and then it copies them into your /lib folder.

# play mvn:refresh // or play mvn:re

Clears your app/lib folder first, then it executes play mvn:up.

Known issues

As long as Play! framework Issue #359 is not resolved, ‘target’ directory is embedded inside the generated war.
You have to remove it manually after packaging your war (because target directory contains Play! runtime).

Use case

The expected use case of this module:

  • add dependencies to pom.xml
  • run play mvn:up or play mvn:re
  • run play ec to update Eclipse environment to setup classpath for Eclipse, etc.
  • develop and test

For packaging, I created a simple shell script, since all jars will be found in lib folder, and using shell script is faster and more flexible.

Limitations

And maven commands (especially mvn commands) are not supported, includes.:

  • mvn compile
  • mvn package
  • mvn install



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap