The sections below describe the steps required to create and release a Play 2 module along with a corresponding sample application:
- The steps are based on how Play 2 Chart was created
- Some steps may be redundant or missing
- The order of the steps is not strict i.e. some steps may be executed earlier/later than specified
- Some steps may vary according to user preferences (e.g. preferred text editor)
<>refers to a placeholder (e.g.<module>is a placeholder for a module name)- Linux, Eclipse and Play 2.3 are assumed to be part of the development environment
- These instructions may also work for Play versions above 2.4 (not tested)
- UNIX commands are assumed to take place on the path determined by the most recently executed
cdcommand
- Create module:
activator new
- Template: play-java
- Name:
<module>- In Play 1, the module name must match regex
[a-zA-Z]+
- In Play 1, the module name must match regex
- Move module to
project-codesubdirectory mkdir project-code: this is the module's directory/Git repositorymv * project-codecd project-code- Delete unnecessary content/files/directories:
vi conf/application.conf: delete all contentvi project/plugins.sbt: remove unnecessary plugins- Remove unnecessary files/directories. Examples:
-
publicor its subdirectories -test/resources vi .gitignore: include files specified in Appendix Arm conf/routes- Build module
activator1.run1. Accesslocalhost:9000on a browser and fix any compilation issues- Eclipsify module
activator1.eclipse- Import module project into Eclipse:
File -> Import -> General -> Existing Project into Workspace
- Set up module
- Delete README
- Create README.md
- Set name, version (start with
0.1.0), organisation and dependencies inbuild.sbt - Implement the module
- Delete the
viewspackage underappif the module won't provide views - Delete the
controllerspackage underappif the module won't provide controllers - Add code to package
<package>.<project>underapp - Write and execute tests:
activator test - Check that no code problems are reported by Eclipse
- Check that no unnecessary logging is generated by the module (search the code for
Logger) - Document the module
- Document all API methods using Javadoc
activator publishLocal: Javadoc is generated undertarget- Check that:
1. All public API methods are documented
1. No module related Javadoc errors are found in log files (under the
logsdirectory) - Add full documentation to
README.md - Publish module to local Ivy repository
activator1.clean1.publishLocal: the module gets published under~/.ivy2/local
- Create a directory for sample applications at the same level as
project-code:mkdir samples cd samplesactivator new
- Template:
play-java - Name:
<module>-sample
cd <module>-sample- Configure the sample application
- Delete README
- Add full documentation to README.md
- Set name, version (start with 0.1.0, it should be in sync with the module one) and dependency to the module in
build.sbt - Delete unnecessary files/directories. Examples:
publicor its subdirectoriestest/resources
vi .gitignoreand include files specified in Appendix A- Eclipsify module sample application
activator1.eclipse- Import module sample project into Eclipse:
File -> Import -> General -> Existing Project into Workspace
- Implement the module
- Add code to under
app - Write and execute tests:
activator test - Test manually at
localhost:9000 - Check that no code problems are reported by Eclipse
- Test module before publishing to GitHub
- Remove module from
.ivy2/localand.ivy2/cache cd project-codeactivator1. clean 1. reload 1. update 1. Publish locally: publishLocal- check that module is at
.ivy2/localand not at.ivy2/cache - Check that no unnecessary files/directories exist under `~/.ivy2/local//. If any, remove them and republish. Examples of unnecessary files/directories include:
- Files:
.classpath,.project,.gitignore - Directories:
.settings,eclipse,javadoc,logs,.git, empty directories (e.g. public) 1. test: all tests should pass
- check that module is at
- Test module sample application against locally published module
cd samples/<module>-sampleactivator1.clean1.reload1.update1.test: all tests should be ok 1.runand test manually- Create a release repository and push it to GitHub
- Create a directory for the release repository outside the project one:
mkdir ~/release - Add built module to it:
cp -rv ~/.ivy2/local/<package>/<project*> ~/release cd release- Add/commit release files to local Git repository: see Appendix B
- Create GitHub release repository: see Appendix C
- Push release files from local Git repository to GitHub release repository: see Appendix D
- Test module sample application against GitHub published module
- Remove module from .ivy2/local and .ivy2/cache
cd samples/<module>-samplevi build.sbtand include GitHub release repository inresolversactivator1.clean1.reload1.update1.test: all tests should be ok 1.runand test manually- Publish module in GitHub
- Add/commit module files to local Git repository: see Appendix B
- Create GitHub module repository: see Appendix C
- Push module files from local Git repository to GitHub module repository: see Appendix D
- Publish module sample in GitHub
- Add/commit module sample files to local Git repository: see Appendix B
- Create GitHub module sample repository: see Appendix C
- Push module sample files from local Git repository to GitHub module sample repository: see Appendix D
- Create module web page in GitHub: see Appendix E
- Announce the module on the play-framework Google Group using the e-mail template specified in Appendix F
.gitignore should include at least the following files:
.*
!.gitignore
logs
target
project/project
project/target
bin
activator
activator.bat
activator-launch*
Other files may be considered for inclusion. Examples include:
tmp
.history
dist
/out
/RUNNING_PID
cd <directory>git initvi .gitignore: Appendix A includes examples of files to be Git ignoredvi README(recommended for all GitHub repositories)vi LICENSE(recommended for all GitHub repositories)git status: all files should be unstaged- Add all files recursively:
git add . git status: all files should be staged- Commit:
git commit -m "<commit message including version>" - Tag project:
git tag <tagname>(e.g.git tag 0.1.0) git status: all files should be committed i.e. on the master HEAD of the local copy
- Create repository in GitHub:
- Log in GitHub
- New repository
- Name:
<repository> - Description (optional):
- Public
- Create repository
- Note the repository SSH URL:
git@github.com:<user>/<repository>.git
cd <local repository>- Associate GitHub (remote) repository with local one:
git remote add origin <repository SSH URL> - Push files from local repository to GitHub:
git push -u origin master - Push tag to remote:
git push origin <tagname>(e.g.git push origin 0.1.0)
- In Github, go to the repository, press Settings and then automatic page generator
- Copy/paste the contents of the module's
README.mdfile onto the body - Press "Continue to layouts"
- Select layout
- Preview page and check that everything's ok
- Publish page
Subject: [play-framework] [2.3.x] Play 2 <module> module
To: play-framework@googlegroups.com
The Play 2 <module> module <module description>. It has been published along with a sample application.
Website: https://<user>.github.io/play2-<module>/
Documentation: https://github.com/<user>/play2-<module>-sample/blob/master/README.md
Short description: The Play 2 <module> module <short description>.