Development Production Line

Transcription

Development Production Line
Development Production Line
The Short Story
Jene Jasper
Copyright © 2007-2016 freedumbytes.dev.net (Free Dumb Bytes)
Published 14 May 2016
3.1-beta Edition
While every precaution has been taken in the preparation of this installation manual, the publisher and author assume no
responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
This work is licensed under a
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
To get an idea of the Development Production Line take a look at the following Application Integration overview and Maven
vs SonarQube Quality Assurance reports comparison.
1. Operating System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1. Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.2. Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1.3. Explorer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.4. Windows 7 Start Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.5. Task Manager replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.6. Symbolic links . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.7. User Account Control replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.8. Windows Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.9. Windows Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.10. Windows Disks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.11. Windows Mouse and Keyboard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.12. Antivirus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.13. Command Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.14. Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.1.15. Data Execution Prevention . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.1.16. Text editor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.17. Archive Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.18. GnuWin32 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.1.19. Merging tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1.20. Secure Shell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1.21. The Best Application Launcher for Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.22. File Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.23. Graph Visualization Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.24. Debugging Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.25. Viewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
1.1.26. Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2. Browser . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1. Firefox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.1.2. Firefox installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.1.3. Firefox preferences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
2.2. Safari . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.2.2. Safari installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3. Chrome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3.2. Chrome installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3. Programming Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1. Java 2 Platform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.2. JDK installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1.3. Thoughts on Java SE, Java Security and Usability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.2. Visual Studio C# and C++ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3. Python . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.2. Python installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.3.3. Python Enterprise Application Kit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3.4. Pygments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4. Perl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4.2. Perl installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.4.3. Perl Package Manager user guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.5. PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5.2. PHP installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6. Simplified Wrapper and Interface Generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.2. SWIG installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4. Build Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1. Ant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1.2. Ant installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2. Maven . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.2. Maven installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.2.3. Compiler profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.2.4. Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.2.5. Repository cleanup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.2.6. Password Encryption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5. Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.1. DocBook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
iii
5.1.2. XML Editor installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5.1.3. XML Editor customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6. Mail Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1. Thunderbird . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.1.2. Thunderbird installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2. Apache James . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.2. Apache James installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.3. Apache James configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2.4. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7. HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1. Apache HTTP Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.2. Apache HTTP Server installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.3. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.4. Apache HTTP Server access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.5. Home page . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.6. Manual activation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.7. Virtual hosting configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.8. Module mod_macro configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.9. Proxy configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.10. Module mod_wsgi configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.11. Module mod_perl configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.12. Module mod_php5 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.13. Module mod_dav configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7.1.14. Server info . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8. Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1. Tomcat . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1.2. Tomcat installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1.3. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1.4. Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8.1.5. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9. Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1. GlassFish . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.2. GlassFish installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.3. Changing JDK version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.4. Autodeploy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.5. Admin console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.6. Update options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.7. JVM switches for performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.8. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.1.9. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10. Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1. MySQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.2. MySQL installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.3. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.4. Backup options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.5. Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.6. SQL Manager installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.1.7. Navicat installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2. Oracle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11. Version Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1. Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.2. Git installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.3. Test drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.4. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.5. Defining a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.1.6. Working on a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2. Subversion (SVN) client only . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.2. Subversion installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.3. Global ignores . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.4. Delete directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.2.5. Credentials . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3. FishEye . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3.2. FishEye installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11.3.3. FishEye configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
iv
33
33
35
35
35
35
35
35
35
35
39
41
41
41
41
42
42
44
45
45
47
47
51
52
53
54
55
57
57
57
57
58
59
60
63
63
63
63
64
65
65
65
65
66
67
69
69
69
69
70
71
71
72
72
73
73
75
75
75
75
77
79
81
83
84
84
84
84
85
85
85
85
85
86
12.
13.
14.
15.
16.
17.
11.3.4. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
11.3.5. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
11.3.6. Database migration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
11.3.7. Repository Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
11.3.8. User profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Issue Tracker . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1. JIRA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.2. JIRA installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
12.1.3. JIRA configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
12.1.4. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
12.1.5. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.1.6. Global settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
12.1.7. Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.1.8. FishEye integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
12.1.9. User profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
Repository Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.1. Nexus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.1.2. Nexus installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
13.1.3. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
13.1.4. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
13.1.5. Nexus configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
13.1.6. Maven integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Continuous Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14.1. Jenkins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14.1.2. Jenkins installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14.1.3. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
14.1.4. Jenkins configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
14.1.5. JIRA integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
14.1.6. Slave configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Integrated Development Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.1. Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.1.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.1.2. Eclipse installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
15.1.3. Eclipse upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
15.1.4. Eclipse configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
15.1.5. Plugins installation & configuration guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
15.1.6. Team support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
16.1. Setup base components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
16.1.1. Team Synchronizing Git . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
16.1.2. Project information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
16.1.3. Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
16.1.4. Site . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
16.1.5. Plugin Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
16.1.6. Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
16.1.7. Java base POM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
16.1.8. Continuous integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
16.1.9. Release . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
16.1.10. Versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
16.1.11. Branch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
16.1.12. Grouping Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
16.1.13. M2Eclipse lifecycle configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
16.1.14. Application Integration overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
Quality Assurance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
17.1. Maven reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
17.2. SonarQube . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
17.2.1. Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
17.2.2. SonarQube installation guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
17.2.3. Upgrading . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
17.2.4. SonarQube configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 205
17.2.5. Apache configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
17.2.6. Windows service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
17.2.7. Maven integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
17.2.8. Jenkins integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
17.2.9. Maven vs SonarQube Quality Assurance reports comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
17.3. jDocBook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
17.3.1. Docbook configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
17.3.2. Documentation setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
17.3.3. Hyphenation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
17.3.4. Upgrade DocBook XSL stylesheets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
17.3.5. Upgrade FOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
v
17.3.6. Fonts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3.7. PressGang Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17.3.8. Publication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A. Tips & Tricks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.1. Archives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.1.1. How to extract content from MSI files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.1.2. How to determine absolute path of a loaded Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.2. Version Control System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
A.2.1. GitWeb enhancement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B. Custom skins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.1. Custom Paper Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.1.1. Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.2. Custom Fluido Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
B.3. Custom Reflow Skin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C. Quality Assurance Sandbox . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.1. Javadoc report . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.2. Cross-reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3. Maven Quality Assurance reports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.1. Checkstyle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.2. PMD/CPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.3. FindBugs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.4. JavaNCSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.5. JDepend . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
C.3.6. Code Coverage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D. Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
vi
235
241
242
243
243
243
243
243
243
247
248
249
252
255
263
264
265
265
266
267
268
268
269
270
273
Chapter 1.
Chapter 1. Operating System
1.1. Windows
Microsoft Windows 7 is an operating system for personal and business computers, including both desktops
and laptops.
1.1.1. Resources
• Leaving Microsoft to Change the World.
• Microsoft Security Advisories are a supplement to the Microsoft Security Bulletins. They address security
changes that may not require a security bulletin but that may still affect customers' overall security.
• Sysinternals utilities to help manage, troubleshoot and diagnose your Windows systems and applications.
• Everything You Need To Know About the Blue Screen of Death. How to configure Windows to create MiniDump
files on BSOD. BlueScreenView scans all your minidump files created during 'blue screen of death' crashes, and
displays the information about all crashes in one table.
• MemTest86 is the original, free, stand alone memory testing software for x86 computers. MemTest86 boots
from a USB flash drive or CD and tests the RAM in your computer for faults using a series of comprehensive
algorithms and test patterns.
• Drivers can be selected for verification by using the Verifier Command Line, or by using Driver Verifier Manager.
• LessMSI is a tool to view and extract the contents of a Windows Installer (.msi) file..
• SharpKeys is a Registry hack that is used to make certain keys on a keyboard act like other keys. For example
you could use this utility to map Caps Lock to a Left Shift.
• The Windows 7 forum covers news and updates and has an extensive Windows 7 tutorial section that covers
a wide range of tips and tricks.
• A List of Run Commands for Windows 7.
• Exploring Windows 7's New Search Features.
• Netstat displays protocol statistics and current TCP/IP network connections.
• PortQry is a command-line utility that you can use to help troubleshoot TCP/IP connectivity issues. The PortQueryUI tool provides a graphical user interface for the PortQry Command Line Port Scanner. New features
and functionality in PortQry version 2.0.
• NMAP (“Network Mapper”) is a free and open source utility for network exploration or security auditing. Many
systems and network administrators also find it useful for tasks such as network inventory, managing service
upgrade schedules, and monitoring host or service uptime.
• The Microsoft Visual C++ Redistributable Packages install runtime components that are required to run C++
applications built with Visual Studio.
• Quick fix for disappearing system tray icons.
• Kernel sockets leak on a multiprocessor computer that is running Windows Server 2008 R2 or Windows 7 resulting in “JVM_Bind java.net.SocketException: No buffer space available (maximum connections reached?)”
•
Snipping Tool to capture a screen shot, or snip, of any object on your screen, and then annotate, save, or
share the image.
Tip
To capture context menus first start a New snip but cancel with Esc. Now open the desired
menu and submenus followed by Ctrl+PrintScreen to restart capturing (see for example
Figure 15.7, “Eclipse Mylyn Task List view”).
•
•
•
•
•
•
IrfanView is a very fast, small, compact and innovative graphic viewer for Windows [version 4.40].
Paint.NET is just about perfect for the graphic design needs of a non-graphic-designer when you need to
crop, cut, or otherwise edit an image and Windows' built-in Paint isn't quite enough [version 4.0.6].
GIMP is the GNU Image Manipulation Program. It is a freely distributed piece of software for such tasks
as photo retouching, image composition and image authoring. It works on many operating systems, in many
languages [version 2.8.14].
Inkscape is professional quality vector graphics software for creating a wide variety of graphics such as illustrations, icons, logos, diagrams, maps and web graphics. Inkscape uses the W3C open standard SVG (Scalable
Vector Graphics) as its native format [version 0.91].
VLC (VideoLAN Client) is a free and open source cross-platform multimedia player and framework that plays
most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols [version 2.2.2].
security.nl.
1.1.2. Desktop
To configure the Desktop minimize all open windows with +M and right click on the desktop Personalize it.
This will open Control Panel → Appearance and Personalization → Personalization where you can set Desktop
Background, Window Color, Sounds and Screen Saver. After Save Changes also Save theme.
To add your own folders to the Picture location of the Windows Desktop Backgrounds create the following
registry file P:\dev\apps\windows\registry\wallpapers.reg:
1
Chapter 1.
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Wallpapers
\KnownFolders\0\Windows Wallpapers\MergeFolders]
"C:\\media\\gfx\\bball"=""
"C:\\media\\gfx\\cycling"=""
"C:\\media\\gfx\\minus\\eol\\removes\\entry"=-
Import these settings with regedit "P:\dev\apps\windows\registry\wallpapers.reg".
1.1.3. Explorer
Windows 7 introduces a brand new Windows Explorer which is superior in many ways to its predecessors. In Windows Explorer select Organize → Layout to activate the Menu bar, Display pane and Navigation pane. In the
Menu bar select View → Details
To configure the Windows Explorer first select the Local Disk (C:) and then Organize → Folder and search options or Tools → Folder options… where you can set:
• General:
• Open each folder in the same window.
• Double-click to open an item (single-click to select).
• Show all folders.
• Automatically expand to current folder.
• View:
• Always show menus.
• Display file icon on thumbnails.
• Display file size information in folder tips.
• Show hidden files, folders, or drives.
• Uncheck Hide extensions for known file types.
• Uncheck Hide protected operating system files (Recommended).
• Show drive letters.
• Show encrypted or compressed NTFS folders in color.
• Optionally uncheck Use Sharing Wizard (Recommended).
• Select the typed item in the view
and Apply to Folders.
• Search:
• In indexed locations, search file names and contents.
• Include subfolders in search results when searching in file folders.
• Find partial matches.
• Include system directories.
Tip
Advanced search is available by holding down
+F keys.
For every non system drive select it and then Organize → Properties → Customize (see also Customize Tab Add or Remove from Properties) or View → Customize this folder… to Optimize this folder for General items,
check Also apply this template to all subfolders and click OK.
1.1.4. Windows 7 Start Menu
First go to Start Menu → Control Panel → Ease of Access → Ease of Access Center → Make the keyboard
easier to use and select Underline keyboard shortcuts and access keys.
To customize the Start Menu right click on the Taskbar and select Properties.
• Taskbar
• Check Lock the taskbar which is also available with right click on the Taskbar and select Properties.
• Check Use small icons.
• Taskbar buttons: Combine when taskbar is full.
• Customize… which icons and notifications appear in the notification area.
• Check Use Aero Peek to preview the desktop.
• Start Menu
• In Privacy disable Store and display recently opened programs in the Start menu and Store and display
recently opened items in the Start menu and the taskbar.
2
Operating System
• Customize…
• Computer: Display as a link.
• Control Panel: Display as a link.
• Uncheck Default Programs.
• Check Devices and Printers.
• Documents: Don't display this item.
• Downloads: Don't display this item.
• Check Enable context menus and dragging and dropping.
• Uncheck Favorites menu.
• Games: Don't display this item.
• Uncheck Help.
• Uncheck Highlight newly installed programs.
• Uncheck Homegroup.
• Music: Don't display this item.
• Check Network.
• Personal folder: Don't display this item.
• Pictures: Don't display this item.
• Uncheck Recent Items.
• Recorded TV: Don't display this item.
• Check Run command.
• Search other files and libraries: Search without public folders.
• Check Search programs and Control Panel.
• Check Sort All Programs menu by name.
• System administrative tools: Display on the All Programs menu and the Start menu.
• Uncheck Use large icons.
• Videos: Don't display this item.
• Quick Launch Toolbar is restored with right click on the Taskbar and select Toolbars → New toolbar… and
point to Folder C:\Users\<username>\AppData\Roaming\Microsoft\Internet Explorer\Quick
Launch. Right click on the Quick Launch Toolbar to uncheck Show Text and Show title. Make sure the taskbar
is unlocked (Lock the taskbar is unchecked), otherwise these menu options won't be available.
1.1.5. Task Manager replacement
Process Explorer shows you information about which handles and DLLs processes have opened or loaded.
Download the archive: ProcessExplorer.zip [version 16.05].
Extract the .zip file to P:\dev\apps\windows\process-explorer. Start the Process Explorer with
procexp.exe and select Options → Replace Task Manager and Options → Hide When Minimized.
Create shortcut named Process Explorer for it and drag this shortcut to Start → Programs → Startup to be
able to access Properties → Run → Minimized to always start it in the system tray on startup.
Important
In case of the following errors:
• “[SC] DeleteService FAILED 1072: The specified service has been marked for deletion.”
• “CreateService failed - The specified service has been marked for deletion. (0x430).”
just Close Process Explorer and/or any services.msc console.
If a service still hangs with the following error “The service is starting or stopping. Please try
again later.” see Kill stuck Windows service using sc queryex and taskkill.
1.1.6. Symbolic links
Junction (also called a soft link) differs from a hard link in that the storage objects it references are separate directories, and a junction can link directories located on different local volumes on the same computer. Otherwise,
junctions operate identically to hard links. Junctions are implemented through reparse points.
Download the archive: Junction.zip [version 1.06].
Extract the .zip file to C:\Windows\System32.
Verify the installation with junction.
1.1.7. User Account Control replacement
As a robust Security Monitor, WinPatrol will alert you to hijackings, malware attacks and critical changes made
to your computer without your permission.
3
Chapter 1.
Download the binary: wpsetup.exe [version 33.6.2015.18].
Run this .exe file to install WinPatrol in P:\dev\apps\windows\win-patrol.
1.1.8. Windows Update
Go to Start Menu → Control Panel → System and Security → Windows Update → Change settings:
• Important updates: Check for updates but let me choose whether to download and install them.
• Recommended updates: Give me recommended updates the same way I receive important updates.
Important
Before upgrading to SP1 uninstall all language packs except the default with lpksetup to
avoid error “C000009A”.
The System Update Readiness Tool for Windows 7 for x64-based Systems (KB947821) is being offered because an
inconsistency was found in the Windows servicing store which may prevent the successful installation of future
updates, service packs, and software.
1.1.9. Windows Languages
Go to Start Menu → Control Panel → Region and Language:
• Formats: English (United States):
• Short date: yyyy-MM-dd.
• Long date: dddd, dd MMMM, yyyy.
• Short time: HH:mm.
• Long time: HH:mm:ss.
• First day of week: Monday.
• Additional settings… Currency symbol: €.
• Current location: United States.
• Keyboards and Languages:
• Change keyboards… Default input language: English (United States) - US.
• Install/uninstall languages… Choose a display language: English.
• Administrative:
• Copy settings… to Welcome sceen and system accounts and New user accounts.
• Change system locale… to English (United States).
1.1.10. Windows Disks
Go to Start Menu → Computer → Manage → Storage → Disk Management and right click on new disk to:
•
•
•
•
Initialize Disk (GPT).
New Simple Volume and click Next (twice).
Assign the following drive letter: K and click Next.
Format this volume with the following settings: Volume Label Knowledge and click Next and Finish.
1.1.11. Windows Mouse and Keyboard
Microsoft Garage Mouse Without Borders is an immensely useful tool. It might come as something of a surprise
that it is a tool associated with Microsoft, and even more of a surprise that it has been kept a secret. Mouse
Without Borders is a product that makes you the captain of your computer fleet by allowing you to control up to
four computers from a single mouse and keyboard. This means that with Mouse without Borders you can copy
text or drag and drop files across computers.
ShareMouse lets you share your mouse and keyboard with multiple networked computers.
1.1.12. Antivirus
All-inclusive and comprehensive protection Avast antivirus Home Edition includes ANTI-SPYWARE protection,
certified by the West Coast Labs Checkmark process, and ANTI-ROOTKIT detection based on the best-in class
GMER technology.
Download the binary (Forum for latest offline installer): avast_free_antivirus_setup.exe [version
2016.11.2.2262].
Run this .exe file for Customize installation of Avast in P:\dev\apps\antivirus\avast. Optionally uncheck
the following features: Antispam, Secure DNS, Firewall, Sandbox, SafeZone Browser, Browser protection (a
web reputation browser extension), Software Updater, Remote Assistance, SecureLine, Cleanup, Rescue Disk,
Browser Cleanup, Desktop gadget, Home Network Security, Secure Virtual Machines and Passwords.
Disable WebRep and Community settings with Open Avast user interface → Settings → General:
4
Operating System
•
•
•
•
•
disable Participate in the Avast community.
disable Enable reputation services.
disable Enable DeepScreen.
Sounds: disable Use voiceover sounds (when available).
Privacy: disable Participate in the Avast community and/or disable Participate in data sharing.
Sometimes it´s not possible to uninstall Avast the standard way in the control panel. In this case, you can use our
uninstallation utility avastclear.exe.
Note
See also Apache James “James.Mailet: RemoteDelivery” issue.
1.1.12.1. Resources
• How-To Geek article Avast Antivirus Was Spying On You with Adware (Until This Week) and Avast's response
to the article on their forum.
• Avast 2015: Managing participation in statistics to opt-out after installation from the data gathering.
1.1.13. Command Processor
To use the Tab for filename and directory name completion in the Command Processor create the following
registry file P:\dev\apps\windows\registry\command-processor.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
"CompletionChar"=dword:00000009
"PathCompletionChar"=dword:00000009
Import these settings with regedit "P:\dev\apps\windows\registry\command-processor.reg".
After starting the Command Processor from the Quick Launch Toolbar configure the following settings by clicking Alt+Space and selecting Properties and / or Defaults (for Start → Run… → cmd):
• Options: in Command History enable Discard Old Duplicates and in Edit Options enable Quick Edit Mode
and Insert Mode.
• Font: Font Lucida Console with Size 16.
• Layout: Screen Buffer Size Width 130 or 380 x Height 9999 and Window Size Width 130 or 380 x Height
83 or 125. Click Ok.
To quickly repeat any previously entered command use the ▲ and ▼ arrow keys and use the F7 key to view a
history of all the commands that have been entered in that Command Processor.
1.1.13.1. Elevated Command Prompt
An elevated command prompt is a command prompt that you run with administrator privileges.
Create for example a another shortcut for the Command Proccessor in the Quick Launch Toolbar. Right click on
this shortcut and select Properties:
• Select Advanced to Run as administrator.
• And
for
example
Change
Icon…
and
Browse…
\system32\UserAccountControlSettings.exe to the User Account Control (UAC) icon.
%windir%
1.1.13.2. User Account Control Consent Prompt
The consent prompt notification is presented when a user attempts to perform a task that requires a user's administrative access token. To disable those annoying prompts for administrators go to Start Menu → Control
Panel → System and Security → Administrative Tools → Local Security Policy or run secpol.msc. Select
Security Settings → Local Policies → Security Options → User Account Control: Behavior of the elevation
prompt for administrators in Admin Approval Mode and switch from Prompt for consent for non-Windows
binaries to Elevate without prompting. Now it is possible to run the elevated command prompt without having
to consent every time.
1.1.13.3. Edit the Hosts File
When editing the hosts file results in the following error “You don't have permission to save in this location” open
an elevated command prompt and run notepad %windir%\system32\drivers\etc\hosts.
5
Chapter 1.
1.1.13.4. Batch files
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %BATCH_HOME%;. Also add a New system variable BATCH_HOME pointing
to P:\dev\apps\windows\batch.
1.1.14. Services
The Service Control command (sc.exe) provided by Microsoft is a command line program used for communicating with the NT Service Controller and services. Some of the options are:
•
•
•
•
•
•
sc
sc
sc
sc
sc
sc
qc [service_name] queries the configuration information for a service.
start [service_name] starts a service.
query [service_name] queries the status for a service.
stop [service_name] sends a stop request to a service.
create service_name creates a service in the registry.
delete service_name deletes a service from the registry.
To edit the Service properties launch the Service Management Console with services.msc.
If a service fails to start check the Application Log in Start → Administrative Tools → Event Viewer or launch the
Event Viewer Console from the command line with eventvwr.msc and select Event Viewer (Local) → Windows
Logs → Application.
Note
If you see something like “The description for Event ID ( 0 ) in Source ( … ) cannot be found.
… You may be able to use the /AUXSOURCE= flag to retrieve this description; … The following
information is part of the event: …” it's Windows telling you that it can't find the template to
nicely format the event content, so it'll give you the raw event data.
1.1.14.1. Delayed service loading
To make sure that for example the Database Service is available when the Application Server Service starts create
a dependency between both services as follows:
1.
2.
3.
4.
5.
6.
7.
Start regedit.
Select HKEY_LOCAL_MACHINE → SYSTEM → CurrentControlSet → services → appserverService.
Right click on appserverService and select New → Multi-String Value.
Set the name to DependOnService.
Right click on DependOnService and select Modify.
Set the Value data to databaseService (in case of multiple services create a space separated list).
Run: sc qc appserverService to verify the dependencies.
Note
In case of the following error: “[SC] GetServiceConfig needs nnn bytes” try sc qc
appserverService <buffersize>, where the specified buffersize is equal or larger than
the number of bytes in the error message.
For an alternative take a look at the manual Startup and Shutdown batch files.
1.1.14.2. Service Wrapper
WinSW (or
GitHub) creates a wrapper executable that can be used to host any executable as a Windows
Service with a less restrictive license than the Java Service Wrapper.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %SERVICES_HOME%;. Also add a New system variable SERVICES_HOME
pointing to P:\dev\apps\windows\services.
To configure any executable as a Windows Service create a service configuration file exampleService.xml in
P:\dev\apps\windows\services:
<service>
<id>example</id>
<name>Example Service</name>
<description>Sample service configuration.</description>
6
Operating System
<depend>Spooler</depend>
<depend>Messenger</depend>
<logpath>P:\dev\logs\windows\services</logpath>
<logmode>roll</logmode>
<env name="TMPDIR" value="C:\tmp" />
<startargument>run</startargument>
<stopargument>stop</stopargument>
<argument>%TMPDIR%</argument>
<executable>exampleApplication.exe</executable>
<!--beeponshutdown/-->
<!--waithint>20000</waithint-->
<!--sleeptime>1000</sleeptime-->
</service>
Get a copy of the latest binary [version 1.18], rename it to exampleService.exe and place it next to the
exampleService.xml in P:\dev\apps\windows\services.
Install the dummy service with exampleService install. Start it with exampleService start or sc start
example. Other winsw options are status, stop and uninstall.
Verify the installation with services.msc and view the event logs with eventvwr.msc.
Warning
Windows XP kills all services that take longer than the WaitToKillServiceTimeout registry setting (default is 20000 milliseconds) on shutdown. When experimenting with WinSW usage for
MySQL this resulted in the following error message “InnoDB: Database was not shut down normally!”.
1.1.14.3. Startup and Shutdown batch files
To start and stop the services in a certain order make use of the net command instead of sc because this one
waits for the service stopped signal (see also warning about WaitToKillServiceTimeout). For the things to come
create the following two batch files P:\dev\apps\windows\batch\services-startup.bat:
net
net
net
net
net
net
net
net
start
start
start
start
start
start
start
start
james
mysqlmaster
fisheye
jira
nexus
sonarqube
tomcat
glassfish
REM pause 10 seconds
ping -n 10 127.0.0.1
> NUL
and P:\dev\apps\windows\batch\services-shutdown.bat:
net
net
net
net
net
net
net
net
stop
stop
stop
stop
stop
stop
stop
stop
glassfish
tomcat
sonarqube
nexus
jira
fisheye
mysqlmaster
james
REM pause 10 seconds
ping -n 10 127.0.0.1
> NUL
1.1.15. Data Execution Prevention
Data Execution Prevention (DEP) is a set of hardware and software technologies that perform additional checks
on memory to help prevent malicious code from running on a system.
When a program (for example java.exe version 1.3.1 update 20) won't start and displays the following error
message “To help protect your computer, Windows has closed this program.”, you can manually exclude the program from the DEP feature.
7
Chapter 1.
Press +Break keys to open the Windows System Properties. Select Advanced → Settings → Data Execution
Prevention → Turn on DEP for all programs and services except those I select and Add… the program.
1.1.16. Text editor
A text editor is a type of program used for editing plain text files.
1.1.16.1. Notepad++
Notepad++ is a free (as in “free speech” and also as in “free beer”) source code editor and Notepad replacement
that supports several languages.
Download the binary: npp.6.8.2.Installer.exe [version 6.8.2].
Run this .exe file to install Notepad++ in P:\dev\apps\editor\notepad++.
Notepad++ supports a few command line parameters to control its startup.
1.1.16.2. UltraEdit
UltraEdit is the ideal text, HTML and hex editor, and an advanced PHP, Perl, Java and JavaScript editor for
programmers.
Download the archive: ue_english.zip [version 16.30.0.1003]* and any required dictionaries and manuals.
Extract the .zip file to C:\tmp. Run the MSI Installer ue_english.msi to custom install UltraEdit in P:\dev
\apps\editor\ultraedit.
Install the dictionaries with the MSI Installer, for example Dutch.msi, in P:\dev\apps\editor\ultraedit\GNU\aspell.
1.1.17. Archive Tools
A file archiver is a computer program that combines a number of files together into one archive file, or a series
of archive file, for easier transportation or storage. Many file archivers employ archive formats that provide lossless data compression to reduce the size of the archive which is often useful for transferring a large number of
individual files over a high latency network like the Internet.
1.1.17.1. WinRAR
WinRAR is a powerful archive manager.
Download the binary: winrar-x64-521.exe [version 5.21].
Run this .exe file to install WinRAR in P:\dev\apps\archive\winrar.
Configure Options → Settings… → Viewer → External viewer name to point to for example P:\dev\apps
\editor\ultraedit\Uedit32.exe. Use Ctrl+H to switch to and from Flat folders view.
1.1.17.2. 7-Zip
7-Zip is a file archiver with a high compression ratio.
Download the binary (MSI Installer): 7z920-x64.msi [version 9.20].
Run this .msi file to install 7-Zip in P:\dev\apps\archive\7zip.
1.1.17.3. HJ-Split
HJ-Split multi-platform file splitter and joiner.
Download the archive: hjsplit.zip [version 3.0].
Extract the .zip file to P:\dev\apps\archive\hjsplit.
1.1.18. GnuWin32
GnuWin32 provides ports of tools with a GNU or similar open source license to MS-Windows.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment Variables and Edit the Path to append %GNUWIN32_HOME%\bin;. Also add a New system variable
GNUWIN32_HOME pointing to P:\dev\apps\gnuwin32.
8
Operating System
Note
Why big open-source projects are fleeing SourceForge's free software hub.
1.1.18.1. DiffUtils
DiffUtils shows differences between files.
Download the Win32 binary: diffutils-2.8.7-1.exe [version 2.8.7.1].
Run this .exe file to install DiffUtils in P:\dev\apps\gnuwin32.
Verify the installation with diff -version.
1.1.18.2. Patch
Patch applies a diff file to an original.
Download the Win32 binary: patch-2.5.9-7-setup.exe [version 2.5.9.7].
Run this .exe file to install Patch in P:\dev\apps\gnuwin32.
Verify the installation with patch -version.
Sample command patch -i viewvc-1.1.5.patch.diff -p 0 --verbose (add the option --dry-run if
you want to check the patch first). You can revert the patch by adding the option -R.
Important
If you run patch and get one of the following error messages: “can't find file to patch at input
line …” or “Assertion failed: hunk, file …, line …”, make sure the directory separator (for the
entries: Index:, --- and +++) is the backslash (\) and not the forwardslash (/) and the file
contains CR-LF as line endings instead of just LF.
1.1.18.3. LibIconv
LibIconv converts from one character encoding to another through Unicode conversion. It has also limited support
for transliteration, i.e. when a character cannot be represented in the target character set, it is approximated
through one or several similar looking characters.
Instead of the older binary libiconv-1.9.2-1.exe download the one maintained at ftp.zlatkovic.com (or mirror): iconv-1.9.2.win32.zip [version 1.9.2].
Extract this .zip file to C:\tmp and move the three subdirectories bin, include and lib to P:\dev\apps
\gnuwin32.
Verify the installation with iconv --version.
1.1.18.4. ZLib
ZLib is designed to be a free, general-purpose, legally unencumbered -- that is, not covered by any patents -lossless data-compression library for use on virtually any computer hardware and operating system. The zlib data
format is itself portable across platforms.
Instead of the older binary zlib-1.2.3.exe download the one maintained at ftp.zlatkovic.com (or mirror):
zlib-1.2.5.win32.zip [version 1.2.5].
Extract this .zip file to C:\tmp and move the three subdirectories bin, include and lib to P:\dev\apps
\gnuwin32.
1.1.18.5. LibXml2
LibXml2 is the XML C parser and toolkit developed for the Gnome project, but usable outside of the Gnome platform.
Instead of the older archive libxml2-2.4.12-bin.zip download the one maintained at ftp.zlatkovic.com (or
mirror): libxml2-2.7.8.win32.zip [version 2.7.8].
Extract this .zip file to C:\tmp and move the three subdirectories bin, include and lib to P:\dev\apps
\gnuwin32.
9
Chapter 1.
Important
To upgrade the libxml2.dll you might need to stop the Apache HTTP Server.
Verify the installation with xmllint -version.
1.1.19. Merging tool
Merging (also called integration) in revision control, is a fundamental operation that reconciles multiple changes
made to a revision-controlled collection of files. Most often, it is necessary when a file is modified by two people
on two different computers at the same time. When two branches are merged, the result is a single collection of
files that contains both sets of changes.
1.1.19.1. KDiff3
KDiff3 compares or merges two or three text input files or directories.
Download the binary: KDiff3-32bit-Setup_0.9.98-3.exe [version 0.9.98].
Run this .exe file to install KDiff3 in P:\dev\apps\editor\kdiff3.
1.1.19.2. WinMerge
WinMerge is an Open Source differencing and merging tool for Windows. It can compare both folders and files,
presenting differences in a visual text format that is easy to understand and handle. The WinMerge command line
accepts several parameters in addition to the paths to compare.
Download the binary: WinMerge-2.14.0-Setup.exe [version 2.14.0].
Run this .exe file to install WinMerge in P:\dev\apps\editor\winmerge.
To configure an different external editor select Edit → Options… → System and change External editor in P:
\dev\apps\editor\notepad++\notepad++.exe.
Tip
If the WinMerge Windows Explorer context menu conflicts with the New menu usage then
disable it by selecting Edit → Options… → Shell Integration and uncheck Add to context
menu.
1.1.20. Secure Shell
Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two
networked devices.
1.1.20.1. PuTTY
PuTTY is a free implementation of Telnet and SSH for Win32 and Unix platforms, along with an xterm terminal
emulator.
Download the binary: putty.exe [version 0.65].
Just copy this .exe file in P:\dev\apps\shell\putty.
1.1.20.1.1. Default Settings
To change PuTTY's default settings run PuTTY make the required changes and set Saved Sessions: Default
Settings and click Save.
Tip
If you find your sessions are closing unexpectedly (most often with “Connection reset by peer”)
after they have been idle for a while, you might want to try using the Connection option Seconds between keepalives (0 to turn off): 60.
In Window → Appearance Change… Font Lucida Console, Font Style Regular and Size 12.
10
Operating System
1.1.21. The Best Application Launcher for Windows
Do you still launch applications by pressing the Windows key and searching for your app? That's a serviceable way
to get your apps up and running, but it's pretty limited. If you've never used an app launcher, now's the time to
try one: they're faster and more powerful than any built-in search system, and they can do a lot more than just
launch apps. Here's why you should be using one (and everything you can do with it).
Launchy is a free cross-platform utility designed to help you forget about your start menu, the icons on your
desktop, and even your file manager.
Download the binary: Launchy2.5.exe [version 2.5].
Run this .exe file to install WinSCP in P:\dev\apps\windows\launchy.
Additionally install required plugins sucha as putty-launchy-plugin [version 2.4].
1.1.22. File Transfer
File transfer is a generic term for the act of transmitting files over a computer network or the Internet. There
are numerous ways and protocols to transfer files over a network. Computers which provide a file transfer service are often called file servers. Depending on the client's perspective the data transfer is called uploading or
downloading.
1.1.22.1. WinSCP
WinSCP is an open source free SFTP client and FTP client for Windows. Legacy SCP protocol is also supported.
Its main function is safe copying of files between a local and a remote computer.
Download the binary: winscp575setup.exe [version 5.7.5].
Run this .exe file to install WinSCP in P:\dev\apps\ftp\winscp.
1.1.22.2. All-in-one FTP/SFTP/HTTP/WebDAV Client
BitKinex integrates the functionality of an innovative FTP, SFTP and WebDAV client for Windows.
Download the binary: bitkinex323.exe [version 3.2.3].
Run this .exe file to install BitKinex in P:\dev\apps\ftp\bitkinex.
1.1.23. Graph Visualization Software
Graphviz is open source graph visualization software. Graph visualization is a way of representing structural
information as diagrams of abstract graphs and networks. Automatic graph drawing has many important applications in software engineering, database and web design, networking, and in visual interfaces for many other
domains.
Download the binary (MSI Installer): graphviz-2.38.msi [version 2.38].
Run this .msi file to install Graphviz in P:\dev\apps\editor\graphviz.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment Variables and Edit the Path to append %GRAPHVIZ_HOME%\bin;. Also add a New system variable
GRAPHVIZ_HOME pointing to P:\dev\apps\editor\graphviz.
Verify the installation with dot -v and click Ctrl+C.
1.1.24. Debugging Tools
The Microsoft debuggers are fully capable of running on computers with x86-based, Itanium, or x64-based processors. The debuggers can debug the Windows operating system, applications, services, and drivers that run on the
operating system.
How to Analyse Bugcheck and Process Crash Dumps.
1.1.25. Viewers
A file viewer is application software that presents the data stored in a computer file in a human-friendly form.
1.1.25.1. Excel
Excel Viewer lets you view and print Microsoft Excel documents on a computer that does not have Excel installed.
Download the binary: ExcelViewer.exe and the following list of patches [version SP3 up to KB2965209].
11
Chapter 1.
Run this .exe file and patches to install Excel Viewer in P:\dev\apps\editor\excel.
1.1.25.2. Word
Word Viewer lets you view and print Microsoft Word documents on a computer that does not have Microsoft
Word installed.
Download the binary: wordview_en-us.exe and the following list of patches [version SP3 up to KB3055054].
Run this .exe file to install Word Viewer in P:\dev\apps\editor\word.
1.1.25.3. PowerPoint
PowerPoint Viewer lets you view full-featured presentations created in PowerPoint 97 and later versions.
Download the binary: PowerPointViewer.exe and the following list of patches [version SP1 up to KB3054840].
Run this .exe file and patches to install Excel Viewer in P:\dev\apps\editor\powerpoint.
1.1.25.4. Foxit PDF Reader
Foxit Reader is a free PDF document viewer, with incredible small size, breezing-fast launch speed and rich
feature set.
Download the binary: FoxitReader720.0722_prom_enu_Setup.exe [version 7.2.0.0722].
Run this .exe file to custom install Foxit Reader (and optionally the Plug-ins: Word, PPT and Excel) in P:\dev
\apps\editor\foxit.
Enable/disable the Safe Reading Mode after installation in File → Preferences… → Trust Manager.
1.1.25.5. Irfanview
IrfanView is a very fast, small, compact and innovative graphic viewer for Windows.
Download the binary: iview438_setup.exe [version 4.40].
Run this .exe file and patches to install Excel Viewer in P:\dev\apps\gfx\irfanview.
Download the binary: irfanview_plugins_438_setup.exe [version 4.40].
Run this .exe file and patches to install Excel Viewer in P:\dev\apps\gfx\irfanview.
1.1.26. Utilities
There are some excellent free software utilities available that are every bit as good as their commercial counterparts, and sometimes even better. One software publisher, with an almost unknown name, but with very popular products is Piriform Software.
1.1.26.1. Recuva
Accidentally deleted an important file? Lost something important when your computer crashed? No problem!
Recuva recovers files deleted from your Windows computer, Recycle Bin, digital camera card, or MP3 player.
Download the binary: rcsetup152.exe [version 1.52.1086].
Run this .exe file to install Recuva in P:\dev\apps\windows\recuva.
1.1.26.2. CCleaner
CCleaner is a system optimization, privacy and cleaning tool. It removes unused files from your system - allowing
Windows to run faster and freeing up valuable hard disk space. It also cleans traces of your online activities such
as your Internet history. Additionally it contains a fully featured registry cleaner.
Download the binary: ccsetup509.exe [version 5.09.5343].
Run this .exe file to install CCleaner in P:\dev\apps\windows\ccleaner.
1.1.26.3. Defraggler
Use Defraggler to defrag your entire hard drive, or individual files - unique in the industry.
Download the binary: dfsetup219.exe [version 2.19.982].
Run this .exe file to install Defraggler in P:\dev\apps\windows\defraggler.
12
Operating System
1.1.26.4. Speccy
Speccy is an advanced System Information tool for your machine.
Download the binary: spsetup128.exe [version 1.28.709].
Run this .exe file to install Defraggler in P:\dev\apps\windows\speccy.
1.1.26.5. Resource Hacker
Resource Hacker is a utility to view, modify, rename, add, delete and extract resources in 32bit Windows executables and resource files.
Download the archive: reshacker_setup.exe [version 4.2.5].
Extract the .zip file to P:\dev\apps\windows\resource-hacker.
13
14
Chapter 2.
Chapter 2. Browser
2.1. Firefox
Firefox the Web browser from Mozilla.
2.1.1. Resources
• Download a Firefox version that speaks your language. Keeping your plugins up to date helps Firefox run safely
and smoothly. Skip Firefox's Add-On Compatibility Check with This Small Extension.
• Waterfox is a Faster, 64-Bit Optimized Version of Firefox for Windows PCs. Firefox 64-Bit Now Available for
Windows with Improved Performance. Users will notice that NPAPI Plugins in Firefox will not work in this 64bit version.
• How to stop Firefox from making automatic connections. OpenH264 Now in Firefox.
•
The Mozilla Developer Center (MDC) supports the growth and development of Firefox and the web by providing comprehensive, accurate, and up-to-date documentation and news about Firefox and web development
technologies.
•
LifeHacker tips & downloads for getting things done.
• The POODLE SSL vulnerability: disabling SSL v3 in your Azure Virtual Machines and Web Roles. POODLE Vulnerability Affects TLS 1.0, TLS 1.1.
• Mozilla Improves Firefox's Certificates Visibility and Mozilla To Remove Favicons From Firefox URL Bar.
•
Add-ons extend Firefox, letting you personalize your browsing experience:
•
FT DeepDark is a smooth dark theme for Firefox.
•
NoScript allows JavaScript and Java execution only for trusted domains of your choice (e.g. your homebanking web site). NoScript optionally blocks Flash and other potentially exploitable plugins too, and provides the most powerful Anti-XSS protection available in a browser.
•
QuickJava allows quick enable and disable of Java, Javascript, Cookies, Image Animations, Flash, Silverlight, Images, Stylesheets and Proxy from the Statusbar and/or Toolbar.
•
Adobe Flash Player is a cross-platform browser-based application runtime that delivers uncompromised
viewing of expressive applications, content, and videos across screens and browsers. If you are having problems uninstalling Flash Player on Windows, follow those steps.
Note
Uncheck Yes, install McAfee Security Scan Plus - optional before first download.
•
Download Manager Tweak allows the download manager to also open in a tab or sidebar, and adds some
optional display changes.
•
DownloadHelper is a tool for web content extraction. Its purpose is to capture video and image files
from many sites.
•
DownThemAll is all you can desire from a download manager: it features an advanced accelerator that
increases speed up to 400% and it allows you to pause and resume downloads at any time.
•
FlashGot is meant to handle single and massive downloads with several external Download Managers.
In Firefox select Tools → FlashGot → More Options… and in General → Download Manager → DTA to
use DownThemAll.
•
Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you
browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page. Useful extensions:
•
•
Remove Cookies for Site a very simple extension to remove all the cookies of currently opened site.
Session Manager saves and restores the state of all or some windows - either when you want it or automatically at startup and after crashes. It can also automatically save the state of open windows individually.
• The Tab Groups (Panorama) feature will be removed from Firefox in version 45. Tab Groups are an easy
way to organize a lot of tabs. You can visually group related tabs, switch between groups, and quickly search
through all of your tabs to switch to a specific one.
15
Chapter 2.
•
Redirector is a browser add-on for Firefox, Chrome and Opera. The add-on lets you create redirects
for specific webpages, e.g. always redirect http://bing.com to http://google.com. Don't you hate it when a
website automatically redirects you to a localized version?
• Disabling Flash on Chrome and Firefox.
• The about:about page is an index of Firefox's about pages.The about:support page provides information
you might need to troubleshoot problems with Firefox. About:config is the about: page most geeks have
heard of. It provides access to all sorts of internal Firefox options that aren't exposed in the user interface it's the go-to place for tweaking Firefox.
2.1.2. Firefox installation guide
Download the Win32 or Win64 binary: Firefox Setup 45.0.2.exe [version 45.0.2] (How to tell if Firefox is
32-bit or 64-bit).
Run this .exe file to custom install Firefox in P:\dev\apps\browser\firefox.
Optionally install useful extensions and pimp the browser theme for example with the the above mentioned addons. To reactivate the menu bar type Alt and check View → Toolbars → Menu Bar.
Tip
http://www.google.com/ncr stops google.com from redirecting to local country or language version of Google.
2.1.2.1. Custom profile folder
Mozilla Firefox stores all your personal settings, such as bookmarks, passwords and extensions, in a profile folder.
To move it to a new location, all you have to do is close Firefox and move the default profile folder
the absolute path
for the new location
in %APPDATA%\Mozilla\Firefox\profiles.ini:
and set
[General]
StartWithLastProfile=1
[Profile0]
Name=default
IsRelative=1 0
Path=Profiles/xxxxxxxx.default
P:\dev\data\browser\firefox\profiles\default
2.1.3. Firefox preferences
To display a list of used preferences, as well as a search bar, type about:config (see also About protocol) in
the Firefox address bar:
security.tls.version.(min / max / fallback-limit)
Set to 3 to make TLS 1.2 is the minimum required / maximum supported encryption protocol (verify with
POODLE Test).
browser.cache.disk.parent_directory
To specify in which folder the Cache is stored, add a New → String preference
browser.cache.disk.parent_directory, and set the value to C:\tmp\firefox. The Cache directory
location can be viewed with about:cache.
browser.tabs.closeButtons
The preference controls how the close button for tabs is displayed. The value 3 displays a single close button
at the end of the tab strip.
Tip
A handy keyboard shortcut for undoing accidentally closed tabs is Ctrl+Shift+T and accidentally closed windows is Ctrl+Shift+N.
browser.tabs.onTop
Disable this preference to put the tabs back on bottom like they used to be.
16
Browser
browser.urlbar.trimURLs
Disable url trimming in Firefox so that the http protocol is shown on all tabs again.
browser.urlbar.formatting.enabled
Disable url formatting so that the url is displayed in one color.
network.prefetch-next
To stop Firefox from silently prefetching hinted documents set the preference to false.
Note
The saving of tabs when quitting Firefox 4 has been disabled by default. To (re)activate all warning dialogs enable the following 4 settings and reset the last one:
browser.showQuitWarning
To restore the “Quit Dialog”: Save and Quit, Quit or Cancel set the preference to true.
Unless browser.startup.page is 3 (see also below).
browser.tabs.warnOnClose
To restore the “Confirm Close Dialog”: Close tabs or Cancel set the preference to true.
browser.warnOnQuit
To restore the “Exit Dialog”: Save and Quit, Quit or Cancel set the preference to true.
browser.startup.page
Each time the web browser starts, this preference is consulted to determine what to display. It has superseded browser.sessionstore.resume_session as the preference determining whether saved sessions are restored. The value 3 resumes the previous browser session.
2.2. Safari
Safari renders web pages at lightning speed. It works on your iPad, iPhone, iPod touch, Mac, and PC.
2.2.1. Resources
• Download a Safari version for Mac and PC.
• Learn about the innovative features available in Safari.
• Safari Extensions are a great way for you to add new features to Safari. Built by developers, Safari Extensions
use the latest HTML5, CSS3, and JavaScript web technologies. They're digitally signed and sandboxed for improved security. You can install extensions with one click — no need to restart Safari.
2.2.2. Safari installation guide
Download or download.cnet.com the Win32 binary: SafariSetup.exe [version 5.1.7].
Run this .exe file to custom install Safari in P:\dev\apps\browser\safari.
2.3. Chrome
Chrome runs websites and applications with lightning speed.
2.3.1. Resources
• Download a Chrome version.
• Chrome Cleanup Tool application will scan and remove software that may cause problems with Chrome, such
as crashes, unusual startup pages or toolbars, unexpected ads you can't get rid of, or otherwise changing your
browsing experience.
• Chrome has many useful features built in, including translation in the browser, apps, extensions, themes, and
more.
• Chrome Web Store is an online marketplace where you can discover thousands of apps, extensions and themes
for Google Chrome.
• POODLE Disabling SSLv3 Support in Browsers.
• Quickly Save Tab Sessions in Chrome Without Installing Extensions.
2.3.2. Chrome installation guide
Download the Win32 binary: ChromeSetup.exe for the Google Chrome Web Browser only [version
49.0.2623.112]. Or as an alternative download the standalone installer ChromeStandaloneSetup.exe (see also
Disabling SSLv3 Support in the above mentioned Resources).
Run one of those .exe file to install Chrome.
17
Chapter 2.
To simulate custom installation of Chrome in P:\dev\apps\browser\google create a symbolic link using Junction as follows:
mkdir P:\dev\data\browser\chrome
mkdir %LOCALAPPDATA%\Google
junction %LOCALAPPDATA%\Google\Chrome P:\dev\data\browser\chrome
junction -s %LOCALAPPDATA%\Google
Warning
The extra junction for the browser itself is now reverted because it caused “The application
has failed to start because its side-by-side configuration is incorrect.” for new_chrome.exe after the update to 49.0.2623.110. Reinstall resulted in the following recurring error “An error
occurred while checking for updates: Update check failed to start (error code 1: 0x80004005).”
when viewing, in the top right, the Chrome menu → Help → About Google Chrome version
information (Chrome will check for updates when you're on this page).
rem Note: on 32-bit use %PROGRAMFILES%
mkdir P:\dev\apps\browser\chrome
mkdir "%PROGRAMFILES(X86)%\Google"
junction "%PROGRAMFILES(X86)%\Google\Chrome" P:\dev\apps\browser
\chrome
junction -s "%PROGRAMFILES(X86)%\Google"
To reopen the prior pages/tabs edit, in the top right, Chrome menu
Continue where you left off.
18
→ Settings → On Startup and select
Chapter 3.
Chapter 3. Programming Languages
3.1. Java 2 Platform
Java Platform, Standard Edition (Java SE) lets you develop and deploy Java applications on desktops and
servers, as well as in today's demanding embedded environments. Java offers the rich user interface, performance, versatility, portability, and security that today's applications require.
3.1.1. Resources
• Download the latest complete environment and runtime environment. Also available are the Next Release
(Early Access) and Previous Releases. The Archive is providing the products available as a courtesy to developers for problem resolution. The products available here have completed the Sun EOL process.
• What is Java Auto Update? How do I change notify settings? Where is the Java Control Panel on Windows?
• Oracle Java on Windows: C:\ProgramData\Oracle\Java\javapath. How to set custom Java path after installing
JDK 8.
• java -version results in “Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object” seems to indicate that the JVM can't find its own rt.jar file. The problem comes from an
improper Java installation. Try uninstalling and then reinstalling Java.
• Java Platform, Standard Edition (Java SE) 8.
• Networking IPv6 User Guide and IPv6 Test.java (see also IPv6Test.java).
• A tutorial example on how to use JVM property, javax.net.debug, to turn on the SSL socket communication
debug option. The debug output message can help you to know what exactly happens at the SSL layer.
• Developer Tools.
• TinyMCE is a platform independent web-based JavaScript HTML WYSIWYG editor control released as open
source under LGPL. TinyMCE enables you to convert HTML textarea fields or other HTML elements to editor
instances. Integrations of TinyMCE into your favorite framework or CMS. TinyMCE Advanced plugin will let you
add, remove and arrange the buttons that are shown on the Visual Editor toolbar.
• Tired of Null Pointer Exceptions? Consider Using Java SE 8's Optional!
•
Inversion of Control Containers and the Dependency Injection pattern by Martin Fowler.
• Dependency Injection Containers are Code Polluters.
• My case against autowiring.
• I was wrong: constructor vs. setter injection.
•
Fluent Interface by Martin Fowler.
• Creation, dynamic loading and instrumentation with javaagents.
• Upgrade checklist:
• Related products: -.
• References: Maven - compiler profile jdk.1.8.home, Maven - toolchains jdkHome, Apache James - Windows Service wrapper.java.command, Tomcat - Windows Service tomcat8.exe or tomcat8w.exe,
GlassFish - asenv.bat AS_JAVA, FishEye - Windows Service wrapper.java.command, JIRA - Windows Service tomcat7.exe or tomcat7w.exe, Nexus - Windows Service wrapper.java.command, Jenkins - Slave
Configuration jeeves\jenkins-slave.xml, Eclipse - installation guide eclipse.ini -vm [117], Eclipse Maven integration Installed JREs and SonarQube - Windows Service wrapper.java.command.
• Integration configuration changes: Java - Security and Usability JCE.
•
Oracle Technology Network (OTN) Java is Oracle Corporation's official, interactive online/offline community for Oracle technical professionals.
•
java.net the Source for Java Technology Collaboration.
•
OpenJDK is the place to collaborate on the open-source JDK.
• Shameless plugs:
•
Article about the
JModalWindow Project.
• GeeCON Prague 2015: Bas Knopper - Making Darwin Proud. Coding Evolutionary Algorithms (PDF).
• MarI/O - Machine Learning for Video Games.
• Destination NASA - Evolutionary Antenna Synthesis.
• Crealysm (BooH) by Cris Kop.
3.1.2. JDK installation guide
Download the Win32 binary: jdk-8u74-windows-i586.exe [version 1.8.0_74] for the use with for example
Firefox and the Win64 binary: jdk-8u74-windows-x64.exe for development purposes.
Run the 32-bit .exe file to install the JDK Development Tools with Change… into P:\dev\apps\prg\java\jdk1.8.0_74. After the JDK is installed Change… the JRE Destination Folder into P:\dev\apps\prg\java\jre1.8.0_74.
Run the 64-bit .exe file to install the JDK Development Tools with Change… into P:\dev\apps\prg\java-x64\jdk1.8.0_74. After the JDK is installed Change… the JRE Destination Folder into P:\dev\apps\prg
\java-x64\jre1.8.0_74.
19
Chapter 3.
Note
It seems Java SE 8 Update 60 doesn't have Public JRE installation included.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %JAVA_HOME%\bin;. Also add a New system variable JAVA_HOME pointing to P:\dev\apps\prg\java-x64\jdk1.8.0_74.
Verify the installation with java -version.
Tip
If you want to be able to run different versions of java by changing the JAVA_HOME [20]
and the Path settings make sure there are no files installed at dir %SystemRoot%
\System32\java*.*. If there are, just delete the files java.exe, javaw.exe and
javaws.exe. Keep the file javacpl.cpl to start the Java Control Panel and on the Java tab
View… which JREs are enabled.
Warning
Old files at dir %SystemRoot%\SysWow64\java*.* can cause the following error “Registry
key 'Software\JavaSoft\Java Runtime Environment\CurrentVersion' has value '1.6', but '1.5' is
required.”.
Note
If you also install the older JDK versions 1.4 and 1.3 (see also Section 1.1.15, “Data Execution
Prevention”) and you don't want to use the default directories make sure that you right click
on Public JRE to select Don't install this feature for now. Because it isn't possible to change
the default directory for the included JRE. Install those JREs with their separate install file.
3.1.3. Thoughts on Java SE, Java Security and Usability
When building inter-connected applications, developers frequently interact with TLS-enabled protocols like
HTTPS:
•
•
•
•
•
Diagnosing TLS, SSL, and HTTPS.
JDK 8 will use TLS 1.2 as default.
Instructions to disable SSL v3.0 in Oracle JDK and JRE.
Release Notes for JDK 8.
Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files 8.
When working with https URLs that cause an error “SSLHandshakeException: Received fatal alert:
handshake_failure” in Java but work in the browser, you might want to install the files, from the above mentioned
JCE, local_policy.jar and US_export_policy.jar in:
• %JRE_HOME%\lib\security and/or
• %JAVA_HOME%\jre\lib\security.
3.1.3.1. Standard Edition Tools Reference
Java Platform, Standard Edition Tools Reference describes for example the general purpose options that are
specific to the Java HotSpot Virtual Machine such as -Xrs, which reduces the use of operating system signals by
the JVM.
Shutdown hooks enable orderly shutdown of a Java application by running user cleanup code (such as closing
database connections) at shutdown, even if the JVM terminates abruptly.
The JVM watches for console control events to implement shutdown hooks for unexpected termination. Specifically, the JVM registers a console control handler that begins shutdown-hook processing and returns TRUE for
CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, and CTRL_SHUTDOWN_EVENT.
20
Programming Languages
The JVM uses a similar mechanism to implement the feature of dumping thread stacks for debugging purposes.
The JVM uses CTRL_BREAK_EVENT to perform thread dumps.
If the JVM is run as a service (for example, as a servlet engine for a web server), then it can receive
CTRL_LOGOFF_EVENT but should not initiate shutdown because the operating system will not actually terminate the process. To avoid possible interference such as this, the -Xrs option can be used. When the -Xrs option is used, the JVM does not install a console control handler, implying that it does not watch for or process
CTRL_C_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT, or CTRL_SHUTDOWN_EVENT.
Note
Testing Log off for user .\Tomcat under which the windows services, without the option Xrs, are running, didn't result in the service stopping. Tested with services tomcat, jeeves and
nexus.
There are two consequences of specifying -Xrs:
• Ctrl+Break thread dumps are not available.
• User code is responsible for causing shutdown hooks to run, for example, by calling System.exit() when the
JVM is to be terminated.
3.2. Visual Studio C# and C++
Visual Studio Community is a free, fully-featured, and extensible IDE for creating modern applications for Windows, Android, and iOS, as well as web applications and cloud services. Multi-language support includes C#, Visual
Basic, F#, C++, JavaScript, TypeScript, Python, and more. Visual Studio guides you as you write, debug, and test
code — no matter what language you choose.
Download the Win32 binary: vcs_web.exe [version 10.0.30319.1].
Run this .exe file to install it for from the Internet. Install without the optional products into a new destination
folder P:\dev\apps\prg\visualstudio-2015.
3.3. Python
Python is a dynamic object-oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days. Many Python programmers report substantial productivity gains
and feel the language encourages the development of higher quality, more maintainable code. Fans of Python
use the phrase “batteries included” to describe the standard library, which covers everything from asynchronous
processing to zip files.
3.3.1. Resources
• Download Standard Python Software.
• Upgrade checklist:
• Related products: Python - installation guide Setuptools, Python - installation guide Pygments and
Apache HTTP Server - Module configuration mod_wsgi.
• References: -.
• Integration configuration changes: -.
• Python's standard documentation.
• Python for Windows Extensions.
• The Python Package Index is a repository of software for the Python programming language such as setuptools.
3.3.2. Python installation guide
Download the Win64 binary (MSI Installer): python-3.4.3.amd64.msi [version 3.4.3].
Run this .msi file to install it for all users. Install all the features into a new destination folder P:\dev\apps
\prg\python-3.4.3.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %PYTHON_HOME%;. Also add a New system variable PYTHON_HOME pointing to P:\dev\apps\prg\python-3.4.3 and reboot the server.
Verify the installation with python --version.
Download the Python for Windows Extensions Win64 binary: pywin32-219.win-amd64-py3.4.exe [version
219].
21
Chapter 3.
Run this .exe file to install the Windows extensions in P:\dev\apps\prg\python-3.4.3.
3.3.3. Python Enterprise Application Kit
PEAK is the Python Enterprise Application Kit. If you develop enterprise applications with Python, or indeed almost
any sort of application with Python, PEAK may help you do it faster, easier, on a larger scale, and with fewer defects
than ever before. The key is component-based development, on a reliable infrastructure.
Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build,
install, and manage Python packages.
3.3.3.1. Setuptools installation guide
Download the install script ez_setup.py that will download the appropriate setuptools-x.x.x-pyx.x.egg to
for example python P:\dev\tools\prg\python\ez_setup.py [version 18.3.1].
Run python P:\dev\tools\prg\python\ez_setup.py to install setuptools-18.3.1-py3.4.egg into
P:\dev\apps\prg\python-3.4.3.
Note
In case of an upgrade of the setuptools delete the setuptools.pth and setuptools-x.x.x-pyx.x.egg from P:\dev\apps\prg\python-3.4.3\Lib\site-packages to avoid the following error message: “zipimport.ZipImportError: bad local file header in
…\lib\site-packages\setuptools-0.9.6-py3.3.egg”.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %PYTHON_HOME%\Scripts;.
Verify the installation with easy_install --version.
3.3.4. Pygments
Pygments is a generic syntax highlighter for general use in all kinds of software such as forum systems, wikis
or other applications (such as ViewVC) that need to prettify source code.
3.3.4.1. Pygments installation guide
Just run easy_install -i http://pypi.python.org/simple/ Pygments [version 2.0.2].
3.4. Perl
Perl is a dynamic programming language created by Larry Wall and first released in 1987. Perl borrows features
from a variety of other languages including C, shell scripting (sh), AWK, sed and Lisp. Perl was widely adopted for
its strengths in text processing and lack of the arbitrary limitations of many scripting languages at the time.
3.4.1. Resources
•
ActivePerl is the industry-standard Perl distribution, available for Windows, Linux, Mac OS X, Solaris, AIX
and HP-UX.
• Download the complete, ready-to-install Perl distribution.
• Upgrade checklist:
• Related products: Perl - Module DBI, Perl - Module PerlMagick and Apache HTTP Server - Module configuration mod_perl.
• References: -.
• Integration configuration changes: -.
• Online documentation.
3.4.2. Perl installation guide
Download the Win64 Binary (MSI Installer): ActivePerl-5.22.0.2200-MSWin32-x64-299195.msi [version 5.22.0.2200].
Note
In case of Perl usage in combination with Bugzilla and MySQL check availabitly of DBD-mysql.
22
Programming Languages
Run this .msi file to install it for all users. Install all the features into a new destination folder P:\dev\apps\prg
\perl-5.22.0.2200 and do not Add Perl to the PATH environment variable.
Important
Installing Perl into a directory that contains a space (e.g. C:\Program Files) will break the
Template-Toolkit installer.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %PERL_HOME%\site\bin;%PERL_HOME%\bin;. Also add a New system
variable PERL_HOME pointing to P:\dev\apps\prg\perl-5.22.0.2200 and reboot the server.
Verify the installation with perl -V.
3.4.3. Perl Package Manager user guide
Start the Perl Package Manager with: ppm gui.
Switch to View → Installed Packages or Ctrl+2 and select File → Verify Packages to check for updates.
Switch to View → Upgradable Packages or Ctrl+3. If the column Repo is not shown select View → View Column
→ Repo to activate it. To upgrade the package from the original repository just right click on it and select Install …
or +. Should there be a higher version of the package available in a different repository right click on the installed
package and select Remove … or - and then right click on the latest version of that package and select Install
… or +.
After selecting the packages that must be upgraded switch to View → Packages to Install/Remove or Ctrl+4
and select File → Run Marked Actions or Ctrl+Enter to update.
Tip
Run ppm upgrade to check for available upgrades.
To add alternative repositories such as Scraps of Perl run the following command ppm repo add bribes-deperl http://www.bribes.org/perl/ppm64/.
Verify the repository installations with ppm repo list or start the ppm gui Perl Package Manager and look
at the available repositories with Edit → Preferences or Ctrl+P and Repositories.
3.4.3.1. Module DBI
The Perl DBI module provides a generic interface for database access. You can write a DBI script that works with
many different database engines without change. To use DBI, you must install the DBI module, as well as a DataBase Driver (DBD) module for each type of server you want to access. For MySQL, this driver is the DBD::mysql
module.
Install the DBI module inclusive the MySQL implementation with ppm install DBI [version 1.631] and ppm
install DBD::mysql [version 4.022].
3.4.3.2. Module PerlMagick
PerlMagick is an objected-oriented Perl interface to ImageMagick. Use the module to read, manipulate, or write
an image or image sequence from within a Perl script. This makes it very suitable for Web CGI scripts such as
Bugzilla.
ImageMagick is a software suite to create, edit, and compose bitmap images. It can read, convert and write images
in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG,
and TIFF. Use ImageMagick to translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors,
apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves.
Download the Win64 binary: ImageMagick-6.9.2-0-Q16-x64-dll.exe [version 6.9.2-0].
Run this .exe file to install ImageMagick into the following folder P:\dev\apps\gfx\imagemagick and deselect all additional tasks:
Press
+Break keys to open the Windows System Properties. Select Advanced system settings → Environment Variables and Edit the Path to append %IMAGEMAGICK_HOME%;. Also add a New system variable
IMAGEMAGICK_HOME pointing to P:\dev\apps\gfx\imagemagick and reboot the server.
23
Chapter 3.
Important
Because C:\Windows\System32 also contains a convert.exe file, which is used to convert
a FAT volume to NTFS, place %IMAGEMAGICK_HOME%; before it in the Path.
Verify the installation with convert -version or convert logo: c:\tmp\logo.gif followed by identify
c:\tmp\logo.gif.
An example of the convert command to reduce the image size before it is written to the PNG format: convert
c:\tmp\logo.gif -resize 50% c:\tmp\logo.png.
3.4.3.2.1. PDF issue
After resizing a PNG for usage with the Maven jDocBook Plugin to generate a PDF, one might run into the following
error situation:
java.lang.NullPointerException: Parameter alpha must not be null
at org.apache.fop.pdf.AlphaRasterImage.<init>(AlphaRasterImage.java:57)
at org.apache.fop.pdf.AlphaRasterImage.<init>(AlphaRasterImage.java:71)
at … .ImageRenderedAdapter.setup(ImageRenderedAdapter.java:125)
at org.apache.fop.pdf.PDFDocument.addImage(PDFDocument.java:809)
at … handleImage(PDFImageHandlerRenderedImage.java:79)
Just remove the transparency from the PNG with the option -flatten, for example: convert 235283-32.png
-flatten -resize 50% status4evar.png.
3.5. PHP
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and
can be embedded into HTML.
3.5.1. Resources
• Please visit our downloads page, Windows binaries can be found on windows.php.net/download/.
• Upgrade checklist:
• Related products: Apache HTTP Server - Module configuration mod_php5.
• References: -.
• Integration configuration changes: -.
• Online documentation.
3.5.2. PHP installation guide
Download the archive: php-5.6.13-Win32-VC11-x64.zip [version 5.6.13].
Extract this .zip file to P:\dev\apps\prg\php-5.6.13.
Note
Navigate into this directory and rename the file php.ini-development or php.ini-production to php.ini.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %PHP_HOME%;. Also add a New system variable PHP_HOME pointing to
P:\dev\apps\prg\php-5.6.13 and reboot the server.
The VC11 build requires to have the Microsoft Visual C++ 2012 Redistributable Package SP4 (x64) [1] installed.
Verify the installation with php -v.
3.6. Simplified Wrapper and Interface Generator
SWIG is an interface compiler that connects programs written in C and C++ with scripting languages such as
Perl, Python, Ruby, and Tcl. It works by taking the declarations found in C/C++ header files and using them to
generate the wrapper code that scripting languages need to access the underlying C/C++ code.
3.6.1. Resources
• Download the latest release.
24
Programming Languages
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: -.
• SWIG Documentation.
3.6.2. SWIG installation guide
Download the archive: swigwin-3.0.7.zip [version 3.0.7].
Extract this .zip file to P:\dev\apps\prg.
Verify the installation with P:\dev\apps\prg\swigwin-3.0.7\swig.exe -version.
25
26
Chapter 4.
Chapter 4. Build Tool
4.1. Ant
Apache Ant is a Java-based build tool. In theory, it is kind of like Make, but without Make's wrinkles.
4.1.1. Resources
• Download a binary distribution of Ant from one of the mirrors.
• Upgrade checklist:
• Related products: -.
• References: Jenkins - configuration Ant.
• Integration configuration changes: -.
• Apache Ant Manual and an overall view of what each task can do.
• External resources for Apache Ant: Tasks, Compiler Implementations, IDE integration tools, Source Control
Systems, loggers, you name it.
4.1.2. Ant installation guide
Download the archive: apache-ant-1.9.6-bin.zip [version 1.9.6].
Extract this .zip file to P:\dev\apps\build.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %ANT_HOME%\bin;. Also add a New system variable ANT_HOME pointing
to P:\dev\apps\build\apache-ant-1.9.6.
Verify the installation with ant -version.
4.2. Maven
Maven is a software project management and comprehension tool. Based on the concept of a project object
model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.
4.2.1. Resources
• Download a binary distribution of Maven from a mirror.
• Upgrade checklist:
• Related products: -.
• References: Jenkins - configuration Maven, Eclipse - configuration Maven, Project - M2Eclipse lifecycle
configuration [196] and Project - information prerequisites.
• Integration configuration changes: Maven - settings localRepository, Maven - profile compiler, Maven
- toolchains jdkHome, Maven - logging simplelogger.properties, Maven - Password Encryption server
nexus-releases, Nexus - Maven integration - mirrors / profiles / activeProfiles / servers and
Project - Site WebDAV server mvn-sites.
Note
Or just run p:\dev\apps\editor\winmerge\WinMergeU.exe
P:\dev
\apps\build\apache-maven-3.3.3\conf\
P:\dev\apps\build\apachemaven-3.3.9\conf\ to copy the changes in for example settings.xml,
toolchains.xml and logging\simplelogger.properties.
• Maven Reference such as core.
• Maven Documentation, Introduction to the Build Lifecycle, Guide to Configuring Plug-ins and Available Plugins.
•
Books such as Maven: The Complete Reference (Maven Command Line Options) and Maven by Example.
• For some examples of upgrading direct and transitive dependencies of a plugin see also Section 17.3.5, “Upgrade FOP” and Section 17.3.4, “Upgrade DocBook XSL stylesheets”.
4.2.2. Maven installation guide
Download the archive: apache-maven-3.3.9-bin.zip [version 3.3.9].
Extract this .zip file to P:\dev\apps\build.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %M2_HOME%\bin;. Also add a New system variable M2_HOME pointing to
P:\dev\apps\build\apache-maven-3.3.9.
27
Chapter 4.
The location of your local repository
can be changed in the Maven configuration file P:\dev\apps\build
\apache-maven-3.3.9\conf\settings.xml:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/settings/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
…>
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>C:/dev/data/repo/maven/local</localRepository>
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and supply extra options to Maven with a New system variable MAVEN_OPTS and for example the following value -Xmx512m -Xms128m.
Note
Since JDK 8 JEP 122: Remove the Permanent Generation from the Hotspot JVM and thus the
need to tune the size of the permanent generation with for example: -XX:MaxPermSize=192m.
Tip
Should the Surefire Plugin fail to run with one of the following errors:
• “Error occurred during initialization of VM Could not reserve enough space for object heap
Could not create the Java virtual machine.”
• “RuntimeException: The forked VM terminated without saying properly goodbye. VM crash
or System.exit called ?”
just temporarily overrule the maximum Java heap size setting with set _JAVA_OPTIONS=Xmx256m, which will be notified with this message “Picked up _JAVA_OPTIONS: -Xmx256m”
(see also JAVA_TOOL_OPTIONS).
Important
JDK 7 brings support for IPv6 on Windows. If you attempt to connect to an IPv4
address then under the covers it will use an IPv4-mapped IPv6 address. This might
cause an org.apache.maven.lifecycle.LifecycleExecutionException with “Connection timed out: connect”. Then add -Djava.net.preferIPv4Stack=true also to the
MAVEN_OPTS.
Verify the installation with mvn -version or mvn -v.
4.2.3. Compiler profile
Configure Maven with the locations of all available java compilers using a compiler profile in the Maven configuration file P:\dev\apps\build\apache-maven-3.3.9\conf\settings.xml:
<profiles>
<profile>
<id>compiler</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<jdk.1.3.home>P:\dev\apps\prg\java\jdk1.3.1_20</jdk.1.3.home>
<jdk.1.3.jvm>${jdk.1.3.home}\bin\java.exe</jdk.1.3.jvm>
<jdk.1.3.javac>${jdk.1.3.home}\bin\javac.exe</jdk.1.3.javac>
<jdk.1.3.javadoc>${jdk.1.3.home}\bin\javadoc.exe</jdk.1.3.javadoc>
28
Build Tool
<jdk.1.4.home>P:\dev\apps\prg\java\jdk1.4.2_19</jdk.1.4.home>
<jdk.1.4.jvm>${jdk.1.4.home}\bin\java.exe</jdk.1.4.jvm>
<jdk.1.4.javac>${jdk.1.4.home}\bin\javac.exe</jdk.1.4.javac>
<jdk.1.4.javadoc>${jdk.1.4.home}\bin\javadoc.exe</jdk.1.4.javadoc>
<jdk.1.5.home>P:\dev\apps\prg\java\jdk1.5.0_22</jdk.1.5.home>
<jdk.1.5.jvm>${jdk.1.5.home}\bin\java.exe</jdk.1.5.jvm>
<jdk.1.5.javac>${jdk.1.5.home}\bin\javac.exe</jdk.1.5.javac>
<jdk.1.5.javadoc>${jdk.1.5.home}\bin\javadoc.exe</jdk.1.5.javadoc>
<jdk.1.6.home>P:\dev\apps\prg\java\jdk1.6.0_45</jdk.1.6.home>
<jdk.1.6.jvm>${jdk.1.6.home}\bin\java.exe</jdk.1.6.jvm>
<jdk.1.6.javac>${jdk.1.6.home}\bin\javac.exe</jdk.1.6.javac>
<jdk.1.6.javadoc>${jdk.1.6.home}\bin\javadoc.exe</jdk.1.6.javadoc>
<jdk.1.7.home>P:\dev\apps\prg\java-x64\jdk1.7.0_80</jdk.1.7.home>
<!--jdk.1.7.home>P:\dev\apps\prg\java\jdk1.7.0_80</jdk.1.7.home-->
<jdk.1.7.jvm>${jdk.1.7.home}\bin\java.exe</jdk.1.7.jvm>
<jdk.1.7.javac>${jdk.1.7.home}\bin\javac.exe</jdk.1.7.javac>
<jdk.1.7.javadoc>${jdk.1.7.home}\bin\javadoc.exe</jdk.1.7.javadoc>
<jdk.1.8.home>P:\dev\apps\prg\java-x64\jdk1.8.0_74</jdk.1.8.home>
<!--jdk.1.8.home>P:\dev\apps\prg\java\jdk1.8.0_74</jdk.1.8.home-->
<jdk.1.8.jvm>${jdk.1.8.home}\bin\java.exe</jdk.1.8.jvm>
<jdk.1.8.javac>${jdk.1.8.home}\bin\javac.exe</jdk.1.8.javac>
<jdk.1.8.javadoc>${jdk.1.8.home}\bin\javadoc.exe</jdk.1.8.javadoc>
</properties>
</profile>
</profiles>
4.2.3.1. Toolchains
In our days it becomes more and more important to be able to use different JDK to be used by Maven itself and
which is used to compile/test your production code. This concept is know under the name Toolchains which is
unfortunately not very well-known.
Also configure Maven Toolchains with the locations of all available java compilers in the Maven configuration file
P:\dev\apps\build\apache-maven-3.3.9\conf\toolchains.xml:
<?xml version="1.0" encoding="UTF-8"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://
maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
<type>jdk</type>
<provides>
<version>1.3</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java\jdk1.3.1_20</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.4</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java\jdk1.4.2_19</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.5</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java\jdk1.5.0_22</jdkHome>
29
Chapter 4.
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.6</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java\jdk1.6.0_45</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java-x64\jdk1.7.0_80</jdkHome>
</configuration>
</toolchain>
<toolchain>
<type>jdk</type>
<provides>
<version>1.8</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>P:\dev\apps\prg\java-x64\jdk1.8.0_74</jdkHome>
</configuration>
</toolchain>
</toolchains>
Important
At least the folder of all specified jdkHome locations needs to exist otherwise projects that
are configured to use the toolchains plugin will have build failures: “[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project
base-pom: Misconfigured toolchains. Non-existing JDK home configuration at P:\dev\apps\prg
\java\jdk1.3.1_20-testing-non-existiing-folder -> [Help 1]”.
4.2.4. Logging
Configure Maven to include the current date and time in the output in the Maven logging configuration file P:
\dev\apps\build\apache-maven-3.3.9\conf\logging\simplelogger.properties:
org.slf4j.simpleLogger.defaultLogLevel=info
-org.slf4j.simpleLogger.showDateTime=false
+org.slf4j.simpleLogger.showDateTime=true
+org.slf4j.simpleLogger.dateTimeFormat=yyyyMMdd HH:mm:ss.SSS
org.slf4j.simpleLogger.showThreadName=false
org.slf4j.simpleLogger.showLogName=false
org.slf4j.simpleLogger.logFile=System.out
org.slf4j.simpleLogger.levelInBrackets=true
org.slf4j.simpleLogger.log.Sisu=info
org.slf4j.simpleLogger.warnLevelString=WARNING
4.2.5. Repository cleanup
Instead of deleting the local repository completely remove (current) project artifacts with:
qa-sandbox>mvn build-helper:remove-project-artifact -Dbuildhelper.removeAll=false
[INFO] C:\dev\data\repo\maven\local\net\dev\freedumbytes\manual\maven\qa-sandbox
\1.1-delta removed.
30
Build Tool
qa-sandbox>mvn build-helper:remove-project-artifact
[INFO] C:\dev\data\repo\maven\local\net\dev\freedumbytes\manual\maven\qa-sandbox
removed.
To delete or refresh project dependencies from the local repository run:
qa-sandbox>mvn dependency:purge-local-repository [-DreResolve=false]
4.2.6. Password Encryption
Maven 2.1.0+ now supports server password encryption.
Warning
maven-settings-decoder lets you decrypt these passwords as long as you have access to both
the settings.xml file and the settings-security.xml file. To use it download the compiled distributable or build it from source (using gradle, because of irony).
Create an encrypted master password with mvn --encrypt-master-password password and save it
the file %USERPROFILE%\.m2\settings-security.xml:
in
<?xml version="1.0" encoding="UTF-8"?>
<settingsSecurity>
<master>{encrypted master-password}
</settingsSecurity>
</master>
Now encrypt for example the nexus-releases server password
with mvn
--encrypt-password
password and place it in the Maven configuration file P:\dev\apps\build\apache-maven-3.3.9\conf
\settings.xml:
<servers>
<server>
<id>nexus-releases</id>
<username>deployment</username>
<password>{encrypted password} </password>
</server>
</servers>
31
32
Chapter 5.
Chapter 5. Documentation
5.1. DocBook
DocBook is a schema (available in several languages including RELAX NG, SGML and XML DTDs, and W3C XML
Schema) maintained by the DocBook Technical Committee of OASIS . It is particularly well suited to books and
papers about computer hardware and software (though it is by no means limited to these applications).
5.1.1. Resources
• DocBook V5.x release is a complete rewrite of DocBook in RELAX NG.
•
DocBook 5: The Definitive Guide. It is a “work in progress” and purports to document DocBook V5.0.
• Writing documentation with DocBook-XML 5.0.
• A DocBook 5.0 customization layer.
• DocBook to LaTeX Publishing.
• XMLmind XML Editor allows to edit large, complex, modular, XML documents. How to be productive with XXE
and get a copy of the quick reference card.
• Maven jDocBook.
5.1.2. XML Editor installation guide
XMLmind XML Editor allows to author large, complex, modular, XML documents. It makes it easy mastering XML
vocabularies such as DocBook or DITA.
Download the Win32 binary: xxe-perso-5_1_1-setup-nojvm.exe or xxe-eval-6_4_0-setup-nojvm.exe [version 6.4.0].
Run this .exe file to install XMLMind XML Editor in P:\dev\apps\editor\xmlmind.
5.1.3. XML Editor customization
Start the editor and select Options → Preferences… to edit the following options:
• Tools → Validate and check Automatically show Validity tool.
• Window and check Show both tree and styled views.
Reopen your document or restart the editor for these changes to take effect.
Tip
To move the
Search and
Validity tools to the top next to the
Edit tool, activate it
and move the mouse cursor towards the tear-off line until the cursor changes into , then just
right click. This way the Attributes tool is better accessible in combination with search and
validity actions.
To customize the editor GUI, for example by adding the Select → Link menu items - next to the navigation
buttons, edit P:\dev\apps\editor\xmlmind\doc\gui\gui\DesktopApp.xxe_gui:
<toolBar name="selectToolBar" helpId="selectToolBar">
<action name="findElementAction" />
<separator />
<action name="goBackAction" />
<action name="goForwardAction" />
<separator />
<action name="selectAnchorAction" />
<action name="selectLinkAction" />
<action name="selectPreviousLinkAction" />
<action name="selectNextLinkAction" />
</toolBar>
To activate this customization press +Break keys to open the Windows System Properties. Select Advanced
system settings → Environment Variables and add a New system variable XXE_GUI pointing to file:///P:/
dev/apps/editor/xmlmind/doc/gui/gui/DesktopApp.xxe_gui.
33
Chapter 5.
Note
The original DesktopApp.xxe_gui can be restored from P:\dev\apps\editor\xmlmind\bin\xxe.jar.
34
Chapter 6.
Chapter 6. Mail Server
6.1. Thunderbird
Reclaim your inbox with Mozilla's email application Thunderbird.
6.1.1. Resources
• Download a fully localized version.
• Thunderbird features many enhancements to help you better manage your unruly inbox, and stay informed.
• Add-ons extend Thunderbird, letting you personalize your email client:
•
Lightning Calendar to organize your life — it's about time! Integrated by default with your Thunderbird.
•
TT DeepDark is a smooth dark theme for Thunderbird.
6.1.2. Thunderbird installation guide
Download the Win32 binary: Thunderbird Setup 38.6.0.exe [version 38.6.0].
Run this .exe file to install Thunderbird in P:\dev\apps\mail\thunderbird.
Optionally install useful extensions and pimp the email client theme for example with the the above mentioned
addons.
6.1.2.1. Custom profile folder
Mozilla Thunderbird stores all your personal settings, such as your mail, passwords and extensions, in a profile
folder.
To move it to a new location, all you have to do is close Thunderbird and move the default profile folder
set the absolute path
for the new location
in %APPDATA%\Thunderbird\profiles.ini:
and
[General]
StartWithLastProfile=1
[Profile0]
Name=default
IsRelative=1 0
Path=Profiles/….default
P:\dev\data\mail\thunderbird\profiles\default
6.2. Apache James
The Apache Java Enterprise Mail Server (a.k.a. Apache James) is a 100% pure Java SMTP and POP3 Mail server
and NNTP News server.
6.2.1. Resources
• Download the Apache James Mail Server.
• Upgrade checklist:
• Related products: -.
• References: FishEye - Global Settings SMTP Host name, JIRA - Required settings Host Name, Nexus Server Administration Hostname, Jenkins - System SMTP server and SonarQube - Settings SMTP host.
• Integration configuration changes: Apache James - configuration Global server, Apache James - configuration DNS, Apache James - configuration Remote Manager, Apache James - configuration SMTP, Apache
James - configuration POP3, Apache James - configuration NNTP, Apache James - configuration Transport processor, Apache James - configuration Data storage and Apache James - Windows Service
wrapper.conf.
• Introduction to the concepts behind the James implementation, as well as a guide to installing, configuring,
(and for developers) building the James server.
6.2.2. Apache James installation guide
Download the archive: apache-james-2.3.2.zip [version 2.3.2].
Extract this .zip file to P:\dev\apps\mail.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and add a New system variable JAMES_HOME pointing to P:\dev\apps\mail\james-2.3.2.
6.2.3. Apache James configuration
To get the configuration files extracted to P:\dev\apps\mail\james-2.3.2\apps\james\conf and
P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF start the server with the following command
%JAMES_HOME [35]%\bin\run.bat. Terminate the server with Ctrl+C.
35
Chapter 6.
6.2.3.1. Host configuration
In C:\WINDOWS\system32\drivers\etc\hosts file on the Mail Server computer add the following host mapping
:
#
#
#
#
#
#
#
#
#
#
#
#
Copyright (c) 1993-2009 Microsoft Corp.
This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
This file contains the mappings of IP addresses to host names. Each
entry should be kept on an individual line. The IP address should
be placed in the first column followed by the corresponding host name.
The IP address and the host name should be separated by at least one
space.
Additionally, comments (such as these) may be inserted on individual
lines or following the machine name denoted by a '#' symbol.
# localhost name resolution is handled within DNS itself.
# 127.0.0.1
localhost
# ::1
localhost
127.0.0.1
mail.freedumbytes.dev.net
6.2.3.2. Global server configuration
Edit the following
\config.xml:
settings
-
in
P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF
<James>
<postmaster>[email protected] </postmaster>
<servernames autodetect="false"
autodetectIP="false" >
<servername>mail.freedumbytes.dev.net </servername>
</servernames>
<usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
<inboxRepository>
<repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
</inboxRepository>
</James>
6.2.3.3. DNS configuration
Edit the following
\config.xml:
settings
-
in
P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF
<dnsserver>
<servers>
<server>IP address of DNS Server </server>
</servers>
<autodiscover>false </autodiscover>
<authoritative>false</authoritative>
<!-- Maximum number of entries to maintain in the DNS cache -->
<maxcachesize>50000</maxcachesize>
</dnsserver>
Tip
To find the DNS server, type: ipconfig /all.
6.2.3.4. Remote Manager configuration
Edit the following settings
and uncomment the prompt setting
\james-2.3.2\apps\james\SAR-INF\config.xml:
<remotemanager enabled="true">
36
in P:\dev\apps\mail
Mail Server
<port>4555</port>
<bind>127.0.0.1</bind>
<handler>
<helloName autodetect="false" >mail.freedumbytes.dev.net
<administrator_accounts>
<account login="admin"
password="password" />
</administrator_accounts>
<connectiontimeout> 60000 </connectiontimeout>
<prompt>james&gt;</prompt>
</handler>
</remotemanager>
</helloName>
Important
After the Mail Server is restarted access to the Remote Administration Tool should now only
possible with telnet 127.0.0.1 4555 and the new username and password. Type shutdown
to kill the current JVM (convenient when James is run as a daemon) or type quit to close the
connection.
6.2.3.4.1. PuTTY configuration
Run PuTTY and configure the following custom Session:
•
•
•
•
Host Name: mail.freedumbytes.dev.net.
Telnet.
Port: 4555.
Connection → Telnet → Telnet negotiation mode: Passive.
In Session set Saved Sessions: mail.freedumbytes.dev.net remote manager and click Save and Open.
Login with admin. Type quit to exit.
6.2.3.5. SMTP configuration
Edit the following
\config.xml:
settings
-
in
P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF
<smtpserver enabled="true">
<!-- port 25 is the well-known/IANA registered port for SMTP -->
<port>25</port>
<bind>127.0.0.1</bind>
<handler>
<helloName autodetect="false" >mail.freedumbytes.dev.net </helloName>
<connectiontimeout>360000</connectiontimeout>
<authorizedAddresses>127.0.0.0/8</authorizedAddresses>
<maxmessagesize>0</maxmessagesize>
</handler>
</smtpserver>
After the Mail Server is restarted verify the connection with telnet 127.0.0.1 25. When all goes well the response will be: 220 mail.freedumbytes.dev.net SMTP Server (JAMES SMTP Server 2.3.1) ready….
Type quit to close the connection.
Tip
When telnet is Connecting To 127.0.0.1… and reports the following error “Could not open
connection to the host, on port 25: Connect failed” use for example the PortQueryUI tool (see
also features and functionality) to get additional information with the command portqry.exe
-n 127.0.0.1 -e 25 -p TCP. In case of “Error opening socket: 10053 A Winsock error has
been encountered”. A firewall or a virus scanner is probably blocking the port.
Important
In case the INFO message “James.Mailet: RemoteDelivery: Could not connect to SMTP host: …,
port: 25, response: 421” and the virus scanner is Avast select Open Avast user interface →
REAL-TIME SHIELDS → Mail Shield to disable Scan outbound messages.
37
Chapter 6.
6.2.3.5.1. PuTTY configuration
Run PuTTY and configure the following custom Session:
•
•
•
•
Host Name: mail.freedumbytes.dev.net.
Telnet.
Port: 25.
Connection → Telnet → Telnet negotiation mode: Passive.
In Session set Saved Sessions: mail.freedumbytes.dev.net telnet and click Save and Open. Type quit
to exit.
6.2.3.6. POP3 configuration
Disable the following
\config.xml:
setting
in
P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF
<pop3server enabled="false" >
<!-- port 995 is the well-known/IANA registered port for POP3S -->
<!-- port 110 is the well-known/IANA registered port for Standard POP3 -->
<port>110</port>
<handler>
<helloName autodetect="false" >mail.freedumbytes.dev.net
<connectiontimeout>120000</connectiontimeout>
</handler>
</pop3server>
</helloName>
6.2.3.7. NNTP configuration
Disable the following settings
\config.xml:
and
in P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF
<!-- NNTP-specific: if you disable the NNTP Server,
you should also set the nntp-repository's threadCount to 0,
otherwise there will be threads active and polling -->
<nntpserver enabled="false" >
<!-- port 563 is the well-known/IANA registered port for NNTP SSL/TLS -->
<!-- port 119 is the well-known/IANA registered port for Standard NNTP -->
<port>119</port>
<handler>
<helloName autodetect="false" >mail.freedumbytes.dev.net
<connectiontimeout>120000</connectiontimeout>
<authRequired>false</authRequired>
</handler>
</nntpserver>
</helloName>
<nntp-repository>
…
<spool>
<configuration>
<spoolPath>file://var/nntp/spool</spoolPath>
<threadCount>1 0</threadCount>
<threadIdleTime>60000</threadIdleTime>
</configuration>
</spool>
</nntp-repository>
6.2.3.8. Transport processor configuration
In case of a Microsoft Exhange Server edit the following settings
\james-2.3.2\apps\james\SAR-INF\config.xml:
-
in P:\dev\apps\mail
<processor name="transport">
…
<mailet match="All" class="RemoteDelivery">
…
<gateway>IP address of Microsoft Exhange Server</gateway>
38
Mail Server
<gatewayPort>25</gatewayPort>
</mailet>
</processor>
6.2.3.9. Data storage
For the ease of future upgrades replace file://var/ with file:///P:/dev/data/mail/james/ for the following file locations in P:\dev\apps\mail\james-2.3.2\apps\james\SAR-INF\config.xml:
•
•
•
•
•
•
•
•
•
•
•
•
•
/mail/inboxes/
/mail/error/
/mail/outgoing/
/mail/spam/
/mail/address-error/
/mail/relay-denied/
/nntp/groups
/nntp/temp
/nntp/articleid
/nntp/spool
/mail/spool/
/dbmail (2x)
/users/
The old now unused location P:\dev\apps\mail\james-2.3.2\apps\james\var and its subdirectories can
be deleted.
Logging can be found in P:\dev\apps\mail\james-2.3.2\logs
\james-2.3.2\apps\james\logs.
and
P:\dev\apps\mail
6.2.4. Windows service
To restart automatically on Microsoft Windows, create a Windows service. Use the Tanuki Java Service Wrapper
shipped with James.
Optionally edit the following entries
\james-2.3.2\conf\wrapper.conf:
in the service wrapper configuration file P:\dev\apps\mail
…
# Java Application
wrapper.java.command=P:\dev\apps\prg\java\jdk1.8.0_74\bin\java
…
# Wrapper Windows Properties
wrapper.console.title=James Mail Server 2.3.2freedumbytes.dev.net Apache James
…
# Wrapper Windows NT/2000/XP Service Properties
wrapper.ntservice.name=James 2.3.2james
wrapper.ntservice.displayname=freedumbytes.dev.net Apache James
wrapper.ntservice.description=The Java Apache Mail Enterprise Server.
Register the Apache James service with the command in an elevated command processor: %JAMES_HOME%\bin
\Wrapper.exe -i %JAMES_HOME%\conf\wrapper.conf. Start Apache James with net start james.
Important
In case of a new jdk installation use an elevated command prompt just run net stop james
and net start james.
6.2.4.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net Apache James and select Properties → Log On to use
This account .\Tomcat. After password conformation click Apply and restart the service.
39
40
Chapter 7.
Chapter 7. HTTP Server
7.1. Apache HTTP Server
The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern
operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and
extensible server that provides HTTP services in sync with the current HTTP standards.
7.1.1. Resources
• Download the Apache HTTP Server.
• Apache Lounge is all about the Apache Web Server provided by the Apache Software Foundation (ASF) HTTPD
Server Project. Apache Lounge has provided up-to-date Windows binaries and popular third-party modules for
more than 10 years.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: Apache HTTP Server - installation guide ServerRoot / DocumentRoot / Directory / cgi-bin, Apache HTTP Server - access httpd-lan-access.conf, Apache HTTP
Server - Realm httpd-freedumbytes-realm.conf, Apache HTTP Server - Home page DocumentRoot / Directory, Apache HTTP Server - Manual activation httpd-manual.conf / AliasMatch / Directory / RequireAll, Apache HTTP Server - Virtual hosting Reusable config for upgrades,
Apache HTTP Server - Module configuration mod_jk, Apache HTTP Server - Html rewrite configuration
mod_proxy_html / mod_xml2enc / mod_headers in copy apache-conf\httpd-proxy-html.conf of
conf/extra/proxy-html.conf, Apache HTTP Server - Module configuration mod_wsgi, Apache HTTP
Server - Module configuration mod_perl, Apache HTTP Server - Module configuration mod_php5, Apache
HTTP Server - Module configuration mod_dav / mod_dav_fs / mod_dav_lock, Apache HTTP Server - Windows Service httpd -k (un)install and Apache HTTP Server - Firewall Rules.
Note
Or
just
run
p:\dev\apps\editor\winmerge\WinMergeU.exe
p:
\dev\apps\httpserver\apache-2.4.16\conf
p:\dev\apps\httpserver\apache-2.4.10\conf to copy the changes in for example httpd.conf and extras\httpd-manual.conf.
• Apache HTTP Server version 2.4 Documentation and Upgrading to 2.4 from 2.2.
• Using Apache with Microsoft Windows.
• Running a Reverse Proxy in Apache.
7.1.2. Apache HTTP Server installation guide
Download the archive: httpd-2.4.16-win64-VC14.zip [version 2.4.16].
Extract this .zip file to P:\dev\apps\httpserver and rename P:\dev\apps\httpserver\Apache24 to
P:\dev\apps\httpserver\apache-2.4.16.
The VC11 build requires to have the Microsoft Visual C++ 2015 Redistributable Package (x64) [1] installed.
To use the custom installation location in P:\dev\apps\httpserver\apache-2.4.16 edit the configuration
file P:\dev\apps\httpserver\apache-2.4.16\conf\httpd.conf:
ServerRoot "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16"
…
DocumentRoot "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16/htdocs"
<Directory "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16/htdocs">
…
ScriptAlias /cgi-bin/ "c:/Apache24
P:/dev/apps/httpserver/apache-2.4.16/cgi-bin/"
…
#
# "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16/cgi-bin" should be changed
# to whatever your ScriptAliased
# CGI directory exists, if you have that configured.
#
<Directory "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16/cgi-bin">
Configure
and
uncomment
the
following
er\apache-2.4.16\conf\httpd.conf:
general
information
P:\dev\apps\httpserv-
41
Chapter 7.
ServerAdmin [email protected]@company.org
…
ServerName www.example.comfreedumbytes.dev.net:80
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %APACHE_HOME%\bin;. Also add a New system variable APACHE_HOME
pointing to P:\dev\apps\httpserver\apache-2.4.16 .
Verify the installation with httpd -v.
Tip
From the command line run httpd -t to run a syntax check on the changed config files.
7.1.3. Windows service
To restart automatically on Microsoft Windows listening on port 80 install the service with the command in an
elevated command processor: httpd -k install -n "freedumbytes.dev.net Apache HTTP" (which
will result in a service named freedumbytes.dev.netApacheHTTP) and start it with httpd -k start -n
"freedumbytes.dev.net Apache HTTP".
Note
In case of an upgrade uninstall the existing service, which is referencing the prior version, with
httpd -k uninstall -n "freedumbytes.dev.net Apache HTTP" first (see also Section 1.1.5, “Task Manager replacement” in case of “The specified service has been marked for
deletion.”).
After the service is started verify the installation in your browser at http://localhost.
When the Apache HTTP Service is running, you can see the Apache Service Monitor icon
in the system tray.
Right click on this icon and select Open Apache Monitor to activate the console in which the Apache HTTP Server
can be (re)started and stopped.
7.1.3.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net Apache HTTP and select Properties → Log On to use This
account .\Tomcat. After password conformation click Apply and restart the service.
7.1.4. Apache HTTP Server access
Require tests whether an authenticated user is authorized according to a particular authorization provider and
the specified restrictions. Block Internet access
based on ips
in the two non default Directory elements
of P:\dev\apps\httpserver\apache-2.4.16\conf\httpd.conf:
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "P:/dev/apps/httpserver/apache-2.4.16/htdocs"
<Directory "P:/dev/apps/httpserver/apache-2.4.16/htdocs">
…
#
# Controls who can get stuff from this server.
#
Require all granted
Include ../apache-conf/httpd-lan-access.conf
</Directory>
…
#
# "P:/dev/apps/httpserver/apache-2.4.16/cgi-bin" should be changed to whatever
42
HTTP Server
# your ScriptAliased CGI directory exists, if you have that configured.
#
<Directory "P:/dev/apps/httpserver/apache-2.4.16/cgi-bin">
AllowOverride None
Options None
Require all granted
Include ../apache-conf/httpd-lan-access.conf
</Directory>
Create P:\dev\apps\httpserver\apache-conf\httpd-lan-access.conf to allow access from the local
area network
and localhost
:
<RequireAny>
# Local area network partial IP range
Require ip 192.168.0
Include ../apache-conf/httpd-localhost-access.conf
</RequireAny>
Create P:\dev\apps\httpserver\apache-conf\httpd-localhost-access.conf to allow access from
localhost:
<RequireAny>
# Localhost
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
7.1.4.1. Authentication, authorization and access control
Authentication is any process by which you verify that someone is who they claim they are. Authorization is any
process by which someone is allowed to be where they want to go, or to have information that they want to have.
Access Control refers to any means of controlling access to any resource. Access control can be done by several
different modules. The most important of these is mod_authz_host.
Create a batch file P:\dev\apps\windows\batch\http-add-user.bat:
if exist P:\dev\data\httpserver\security\http-users-freedumbytes.dev.net
goto addUser
md P:\dev\data\httpserver\security
htpasswd -c P:\dev\data\httpserver\security\http-users-freedumbytes.dev.net %1
goto end
:addUser
htpasswd P:\dev\data\httpserver\security\http-users-freedumbytes.dev.net %1
:end
Warning
Option -c creates a new file.
Create the first user and the password file P:\dev\data\httpserver\security\http-usersfreedumbytes.dev.net with the command: http-add-user jjasper. And all consecutive users with the
commands: http-add-user maven, http-add-user fisheye, http-add-user jira, http-add-user
jenkins and http-add-user sonar.
Setup the user's level of access to the repository path: either r (read-only) or rw (read-write) in the file P:\dev
\data\httpserver\security\http-access-freedumbytes.dev.net:
[/]
jjasper = rw
maven = r
fisheye = r
jira = r
jenkins = r
43
Chapter 7.
sonar = r
7.1.4.2. Realm
Create the realm
bytes-realm.conf:
configuration
file
P:\dev\apps\httpserver\apache-conf\httpd-freedum-
Require valid-user
AuthType Basic
AuthName "freedumbytes.dev.net Realm"
AuthUserFile
"P:/dev/data/httpserver/security/http-users-freedumbytes.dev.net"
Add as an extra requirement
the freedumbytes realm with basic authentication
\httpserver\apache-2.4.16\conf\httpd.conf:
to P:\dev\apps
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "P:/dev/apps/httpserver/apache-2.4.16/htdocs"
<Directory "P:/dev/apps/httpserver/apache-2.4.16/htdocs">
…
#
# Controls who can get stuff from this server.
#
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Directory>
…
#
# "P:/dev/apps/httpserver/apache-2.4.16/cgi-bin" should be changed to whatever
# your ScriptAliased CGI directory exists, if you have that configured.
#
<Directory "P:/dev/apps/httpserver/apache-2.4.16/cgi-bin">
AllowOverride None
Options None
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Directory>
7.1.5. Home page
Make the freedumbytes.dev.net Home page content upgrade safe by changing its location
\apps\httpserver\apache-2.4.16\conf\httpd.conf:
and
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "P:/dev/apps/httpserver/apache-2.4.16/htdocs
P:/dev/data/httpserver/home "
<Directory "P:/dev/apps/httpserver/apache-2.4.16/htdocs
P:/dev/data/httpserver/home ">
…
#
# Controls who can get stuff from this server.
#
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
44
in P:\dev
HTTP Server
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Directory>
Initially copy the content of P:\dev\apps\httpserver\apache-2.4.16\htdocs to P:\dev\data\httpserver\home as a starting point or create your own index.html which redirects to http://
freedumbytes.dev.net/mvn-sites/maven-setup (see also Section 16.1.2, “Project information”).
<html>
<head>
<title>freedumbytes.dev.net</title>
<meta http-equiv="refresh"
content="15;URL=http://freedumbytes.dev.net/mvn-sites/maven-setup/" />
</head>
<body>
<p>Redirecting to
<a href="http://freedumbytes.dev.net/mvn-sites/maven-setup/">
http://freedumbytes.dev.net/mvn-sites/maven-setup/
</a>.
</p>
</body>
</html>
After the Apache HTTP Server is restarted verify the installation in your browser at http://localhost.
7.1.6. Manual activation
To activate the local copy of the Apache HTTP Server Manual just uncomment the following line
\apps\httpserver\apache-2.4.16\conf\httpd.conf:
in P:\dev
# Local access to the Apache HTTP Server Manual
Include conf/extra/httpd-manual.conf
Also block Internet access
based on ips
with basic authentication
for the manual and take into
account the custom installation
in P:\dev\apps\httpserver\apache-2.4.16\conf\extra\httpdmanual.conf:
AliasMatch ^/manual(?:/(?:da|de|en|es|fr|ja|ko|pt-br|ru|tr|zh-cn))?(/.*)?$
"c:/Apache24/manualP:/dev/apps/httpserver/apache-2.4.16/manual$1"
<Directory "c:/Apache24P:/dev/apps/httpserver/apache-2.4.16/manual">
Options Indexes
AllowOverride None
Require all granted
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
…
</Directory>
After the Apache HTTP Server is restarted verify the installation in your browser at http://localhost/manual.
7.1.7. Virtual hosting configuration
The term Virtual Host refers to the practice of running more than one web site on a single machine.
To activate additional freedumbytes.dev.net configuration add the following line
\httpserver\apache-2.4.16\conf\httpd.conf:
in P:\dev\apps
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
# Reusable config for upgrades
Include ../apache-conf/httpd.conf
Create
P:\dev\apps\httpserver\apache-conf\httpd.conf
freedumbytes.dev.net configuration
:
with
the
following
initial
45
Chapter 7.
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
Create P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf
freedumbytes.dev.net virtual host
on port 80
:
with
the
following
default
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
vcombined
<VirtualHost *:80 >
ServerAdmin [email protected]
ServerName freedumbytes.dev.net
ErrorLog "P:/dev/logs/httpserver/freedumbytes.dev.net-error.log"
CustomLog "P:/dev/logs/httpserver/freedumbytes.dev.net-access.log"
vcombined
</VirtualHost>
Make sure the directory P:\dev\logs\httpserver exists. Also create P:\dev\apps\httpserver\apacheconf\modules for storing third-party modules.
Note
It is also possible to create subdomains with VirtualHost (see also Section 7.1.9.1.1.1, “Subdomain sample”).
In C:\WINDOWS\system32\drivers\etc\hosts file add the following mapping (on all developer machines
that want to access http://freedumbytes.dev.net and subdomains on the above configured host machine - ):
#
#
#
#
#
#
#
#
#
#
#
#
#
Copyright (c) 1993-2009 Microsoft Corp.
This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
This file contains the mappings of IP addresses to host names. Each
entry should be kept on an individual line. The IP address should
be placed in the first column followed by the corresponding host name.
The IP address and the host name should be separated by at least one
space.
Additionally, comments (such as these) may be inserted on individual
lines or following the machine name denoted by a '#' symbol.
# localhost name resolution is handled within DNS itself.
#127.0.0.1
localhost
#::1
localhost
192.168.0.xx freedumbytes.dev.net
192.168.0.xx sample.freedumbytes.dev.net
127.0.0.1
mail.freedumbytes.dev.net
Important
Check if your browser is using a proxy. In Firefox select Tools → Options… → Advanced →
Network → Settings…. If this is the case add the following entries to No proxy for: localhost, 127.0.0.1, freedumbytes.dev.net, 192.168.0.0/16.
After the Apache HTTP Server is restarted verify the installation of the virtual host in your browser at http://
freedumbytes.dev.net. You should be able to see the freedumbytes.dev.net Home page index.html.
7.1.7.1. Firewall configuration
To allow requests from other machines in the local area network select Start Menu → Control Panel → System
and Security → Windows Firewall → Advanced settings and under Windows Firewall with Advanced Security
on Local Computer → Inbound Rules create a New Rule…:
46
HTTP Server
•
•
•
•
•
Rule Type: Port and click Next.
Protocol and Ports: TCP for Specific local ports 80 and click Next.
Action: Allow the connection and click Next.
Profile: Private only and click Next.
Name: Apache HTTP Server freedumbytes.dev.net and click Finished.
Note
It is possible that there are already two TCP and UDP rules for Apache HTTP Server when the
Firewall notification has popped up. Optionally disable those.
Further restrict the Apache HTTP Server freedumbytes.dev.net rule by right clicking and set Properties → Programs and Services to This Program P:\dev\apps\httpserver\apache-2.4.16\bin\httpd.exe.
7.1.8. Module mod_macro configuration
Mod_macro allows the definition and use of macros within apache runtime configuration files. It is included in
Apache Lounge httpd-x.x.x.zip.
Include
the Macro module configuration at the top in P:\dev\apps\httpserver\apache-conf
\httpd.conf:
# Apache Macro
Include ../apache-conf/httpd-macro.conf
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-macro.conf:
LoadModule macro_module modules/mod_macro.so
For a sample use of mod_macro within a configuration file see Section 11.1.4, “Apache configuration” of the Git
repositories.
7.1.9. Proxy configuration
A proxy server sits between a client application, such as a Web browser, and a real server. It intercepts all requests
to the real server to see if it can fulfill the requests itself. If not, it forwards the request to the real server.
In the P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf file before the VirtualHost settings
from Section 7.1.7, “Virtual hosting configuration” insert the following two modules ,
and at the end of the
VirtualHost settings add the following proxy configuration
- :
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
vcombined
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName freedumbytes.dev.net
ErrorLog "P:/dev/logs/httpserver/freedumbytes.dev.net-error.log"
CustomLog "P:/dev/logs/httpserver/freedumbytes.dev.net-access.log" vcombined
<IfModule proxy_module>
<IfModule proxy_http_module>
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Proxy>
</IfModule>
</IfModule>
47
Chapter 7.
</VirtualHost>
The actual proxied servers includes will be supplied in the following chapters (for an example see Section 7.1.9.1.1,
“Module mod_proxy_ajp configuration”).
7.1.9.1. Apache JServ Protocol
Apache JServ Protocol version 1.3 (hereafter ajp13) is packet-oriented. A binary format was presumably chosen
over the more readable plain text for reasons of performance. The web server communicates with the servlet
container over TCP connections. To cut down on the expensive process of socket creation, the web server will
attempt to maintain persistent TCP connections to the servlet container, and to reuse a connection for multiple
request/response cycles.
Once a connection is assigned to a particular request, it will not be used for any others until the request-handling
cycle has terminated. In other words, requests are not multiplexed over connections. This makes for much simpler
code at either end of the connection, although it does cause more connections to be open at once.
If AJP is to be used, the then mod_proxy_ajp module is preferred over mod_jk.
7.1.9.1.1. Module mod_proxy_ajp configuration
Mod_proxy_ajp is the AJP support module for mod_proxy.
In the P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf file before the VirtualHost settings
from Section 7.1.7, “Virtual hosting configuration” append the following module
:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""
vcombined
<VirtualHost *:80>
7.1.9.1.1.1. Subdomain sample
And then for example instruct Apache to proxy all URLs whose path portions begin with /http-sample/
and /ajp-sample/ in subdomain sample.freedumbytes.dev.net using the following P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName freedumbytes.dev.net
…
# Sample
Redirect /sample http://sample.freedumbytes.dev.net
</VirtualHost>
# Sample subdomain
Include ../apache-conf/httpd-sample-subdomain.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-sample-subdomain.conf:
<IfModule proxy_module>
<IfModule proxy_http_module>
<IfModule proxy_ajp_module>
<VirtualHost *:80>
ServerName sample.freedumbytes.dev.net
ErrorLog "P:/dev/logs/httpserver/freedumbytes.dev.net-error.log"
CustomLog "P:/dev/logs/httpserver/freedumbytes.dev.net-access.log" vcombined
ProxyPass /http-sample
http://localhost:8068/http-sample
ProxyPassReverse /http-sample http://localhost:8068/http-sample
<Location /http-sample>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Location>
48
HTTP Server
ProxyPass /ajp-sample
ajp://localhost:8069/ajp-sample
ProxyPassReverse /ajp-sample ajp://localhost:8069/ajp-sample
<Location /ajp-sample>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Location>
</VirtualHost>
</IfModule>
</IfModule>
</IfModule>
Prepackaged sample applications http-sample.war and ajp-sample.war can be downloaded for deployment in the
installed Tomcat.
After the Apache HTTP Server is restarted verify the installation of the sample proxies in your browser at
http://sample.freedumbytes.dev.net/http-sample, http://freedumbytes.dev.net/sample/http-sample and http://
sample.freedumbytes.dev.net/ajp-sample.
Important
For this to work all URL references need to be relative (see also Section 7.1.9.2, “Html rewrite
configuration”).
7.1.9.1.2. Module mod_jk configuration
Mod_jk is the Apache Tomcat Connector based on the ajp1.3.
Download the Apache Tomcat Connector or
VC14.zip [version 1.2.41].
Apache Lounge modules archive: mod_jk-1.2.41-win64-
Extract the module to mod_jk.so from the downloaded archive and place it in P:\dev\apps\httpserver\apache-conf\modules.
Include
the Apache Tomcat Connector module configuration just before httpd-vhosts.conf in P:\dev
\apps\httpserver\apache-conf\httpd.conf:
# Apache Tomcat Connector
Include ../apache-conf/httpd-jk.conf
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-jk.conf:
LoadModule jk_module P:/dev/apps/httpserver/apache-conf/modules/mod_jk.so
<IfModule mod_jk.c>
JkWorkersFile ../apache-conf/jk-workers.properties
JkLogFile "P:/dev/logs/httpserver/freedumbytes.dev.net-mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
</IfModule>
Create the above referenced P:\dev\apps\httpserver\apache-conf\jk-workers.properties file:
worker.list=workerSample, fisheye
worker.workerSample.type=ajp13
worker.workerSample.host=localhost
worker.workerSample.port=8069
worker.fisheye.type=ajp13
worker.fisheye.host=localhost
worker.fisheye.port=8061
49
Chapter 7.
7.1.9.1.2.1. Sample
Extend the P:\dev\apps\httpserver\apache-conf\httpd-sample-subdomain.conf
tion 7.1.9.1.1.1, “Subdomain sample” to mount /jk-sample
:
from
Sec-
<IfModule proxy_module>
<IfModule proxy_http_module>
<IfModule proxy_ajp_module>
<VirtualHost *:80>
ServerName sample.freedumbytes.dev.net
…
<IfModule mod_jk.c>
JkMount /jk-sample
workerSample
JkMount /jk-sample/* workerSample
</IfModule>
<Location /jk-sample>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Location>
</VirtualHost>
</IfModule>
</IfModule>
</IfModule>
A prepackaged sample application jk-sample.war can be downloaded for deployment in the installed Tomcat.
After the Apache HTTP Server is restarted verify the installation of the sample proxy in your browser at http://
sample.freedumbytes.dev.net/jk-sample.
Important
For this to work all URL references need to be relative (see also Section 7.1.9.2, “Html rewrite
configuration”).
7.1.9.2. Html rewrite configuration
For some proxies it might be necessary to additionally configure the mod_proxy_html output filter to rewrite
HTML links to ensure that links work for users outside the proxy. It is included in Apache Lounge httpd-x.x.x.zip.
To make the upcoming changes upgrade safe copy and rename the initial P:\dev\apps
\httpserver\apache-2.4.16\conf\extra\proxy-html.conf to P:\dev\apps\httpserver\apacheconf\httpd-proxy-html.conf. Thus when upgrading just use WinMerge to look for changes
between the proxy-html.conf files in both unzipped httpd-x.x.x.zip versions with fc
p:
\dev\apps\httpserver\apache-2.4.10\conf\extra\proxy-html.conf p:\dev\apps\httpserver\apache-2.4.16\conf\extra\proxy-html.conf. Apply possible changes in P:\dev\apps\httpserver\apache-conf\httpd-proxy-html.conf.
In the initial copy P:\dev\apps\httpserver\apache-conf\httpd-proxy-html.conf load the modules
- :
# Configuration example.
…
# For Windows (I don't know if there's a standard path for the libraries)
# LoadFile C:/path/zlib.dll
# or LoadFile "P:/dev/apps/httpserver/apache-2.4.16/bin/zlib1.dll"
# LoadFile C:/path/iconv.dll
# or LoadFile "P:/dev/apps/httpserver/apache-2.4.16/bin/libapriconv-1.dll"
# LoadFile C:/path/libxml2.dll
# or LoadFile "P:/dev/apps/httpserver/apache-2.4.16/bin/libxml2.dll"
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so
…
# To support scripting events (with ProxyHTMLExtended On),
# you'll need to declare them too.
50
HTTP Server
ProxyHTMLEvents onclick ondblclick onmousedown onmouseup \
onmouseover onmousemove onmouseout onkeypress \
onkeydown onkeyup onfocus onblur onload \
onunload onsubmit onreset onselect onchange
Note
The other files zlib1.dll, libiconv2.dll and libxml2.dll are already available in P:\dev\apps
\httpserver\apache-2.4.16\bin.
Activate the extra required module
html.conf:
in P:\dev\apps\httpserver\apache-conf\httpd-proxy-
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule headers_module modules/mod_headers.so
And include
the html rewriting configuration just before httpd-vhosts.conf in P:\dev\apps\httpserver\apache-conf\httpd.conf:
# Html rewriting
Include ../apache-conf/httpd-proxy-html.conf
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
Finally remove the now superfluous include
\httpd.conf:
in P:\dev\apps\httpserver\apache-2.4.16\conf
# Configure mod_proxy_html to understand HTML4/XHTML1
#<IfModule proxy_html_module>
#Include conf/extra/proxy-html.conf
#</IfModule>
7.1.9.2.1. Sample
For sample usage take a look at Section 8.1.5, “Apache configuration”.
Important
Notice the difference between http://sample.freedumbytes.dev.net/http-sample and http://
freedumbytes.dev.net/tomcat/http-sample/ for the absolute URL reference due to ProxyHTMLURLMap http://localhost:8068 /tomcat.
7.1.10. Module mod_wsgi configuration
Mod_wsgi aims to implement a simple to use Apache module which can host any Python application which supports the Python WSGI interface. The module would be suitable for use in hosting high performance production
web sites, as well as your average self managed personal sites running on web hosting services.
Download the archive mod_wsgi-windows-4.4.12.tar.gz. After extracting this archive move
mod_wsgi-windows-4.4.12\Apache24-win64-VC10\modules\mod_wsgi-py34-VC10.so to P:\dev
\apps\httpserver\apache-conf\modules\mod_wsgi.so [version 4.4.12].
Or download the alternative archive mod_wsgi-4.4.13+ap24vc10-cp34-none-win_amd64.whl
(just rename to .zip). After extracting this archive move mod_wsgi-4.4.13+ap24vc10-cp34none-win_amd64\mod_wsgi-4.4.13+ap24vc10.data\data\mod_wsgi.so to P:\dev\apps\httpserver\apache-conf\modules\mod_wsgi.so [version 4.4.13].
Include
this Python module just before httpd-vhosts.conf in P:\dev\apps\httpserver\apacheconf\httpd.conf:
# Python
Include ../apache-conf/httpd-python.conf
# Virtual hosts
51
Chapter 7.
Include ../apache-conf/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-python.conf:
LoadModule wsgi_module P:/dev/apps/httpserver/apache-conf/modules/mod_wsgi.so
<IfModule mod_wsgi.c>
<Location /python-status>
#
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-localhost-access.conf
</Location>
</IfModule>
# Python Sample
Include ../apache-conf/httpd-python-sample.conf
Create the following file P:\dev\apps\httpserver\sample\python\status.wsgi:
import pprint
def application(environ, start_response):
""" Display the contents of the environ dictionary."""
# produce some content
output = b'Hello World\r\r\r' + pprint.pformat(environ).encode('utf8')
# send first header and status
status = '200 OK'
headers = [('Content-type', 'text/plain'),('Content-Length',
str(len(output)))]
start_response(status, headers)
return [output]
Map this WSGI script in P:\dev\apps\httpserver\apache-conf\httpd-python-sample.conf:
WSGIScriptAlias /python-status P:/dev/apps/httpserver/sample/python/status.wsgi
After the Apache HTTP Server is restarted test the mod_wsgi by taking a look at the Python Status.
7.1.11. Module mod_perl configuration
Mod_perl brings together the full power of the Perl programming language and the Apache HTTP server. You
can use Perl to manage Apache, respond to requests for web pages and much more. Mod_perl is more than CGI
scripting on steroids. It is a whole new way to create dynamic content by utilizing the full power of the Apache
web server to create stateful sessions, customized user authentication systems, smart proxies and much more.
Yet, magically, your old CGI scripts will continue to work and work very fast indeed. With mod_perl you give up
nothing and gain so much!
Important
Alas haven't found a x64 Apache HTTP Server 2.4.x Perl 5.18 binary yet. Thus mod_perl is no
longer available after current upgrades.
When ppm install mod_perl is run it will also fetch the Apache2 module mod_perl.so. When asked Where
should mod_perl.so be placed? just answer P:\dev\apps\httpserver\apache-conf\modules [version 2.000004].
Note
In case of an upgrade just ppm uninstall mod_perl first.
Include
this Perl module just before httpd-vhosts.conf in P:\dev\apps\httpserver\apache-conf
\httpd.conf:
# Perl
52
HTTP Server
Include ../apache-conf/httpd-perl.conf
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-perl.conf:
LoadModule perl_module P:/dev/apps/httpserver/apache-conf/modules/mod_perl.so
<IfModule mod_perl.c>
<Location /perl-status>
SetHandler perl-script
PerlHandler Apache2::Status
PerlSetVar StatusOptionsAll On
Include ../apache-conf/httpd-localhost-access.conf
</Location>
</IfModule>
# Perl Sample
Include ../apache-conf/httpd-perl-sample.conf
It is possible to verify the installation using the instructions of the mod_perl Manual. Or just create the following
file P:\dev\apps\httpserver\sample\perl\test.pm:
package sample::perl::test;
use strict;
use Apache2::RequestRec (); # for $r->content_type
use Apache2::RequestIO ();
# for $r->puts
use Apache2::Const -compile => ':common';
sub handler {
my $r = shift;
my $time = scalar localtime();
my $package = __PACKAGE__;
$r->content_type('text/html');
$r->puts(<<"END");
<HTML><BODY>
<h3>Test</H3>
Hello from <B>$package</B>! The time is $time.
</BODY></HTML>
END
return Apache2::Const::OK;
}
1;
Register this perl handler in P:\dev\apps\httpserver\apache-conf\httpd-perl-sample.conf:
<IfModule mod_perl.c>
PerlSwitches -IP:/dev/apps/httpserver/
PerlModule sample::perl::test
<Location /perl-sample>
SetHandler modperl
PerlResponseHandler sample::perl::test
Include ../apache-conf/httpd-localhost-access.conf
</Location>
</IfModule>
After the Apache HTTP Server is restarted test the mod_perl module at http://freedumbytes.dev.net/perl-sample
and take a look at the Perl Status. In case of memory problems read up on Apache2::SizeLimit - Because size does
matter.
7.1.12. Module mod_php5 configuration
php5apache2_4.dll is needed to allow Apache to use PHP.
53
Chapter 7.
Include
this PHP module just before httpd-vhosts.conf in P:\dev\apps\httpserver\apache-conf
\httpd.conf:
# Python
Include ../apache-conf/httpd-php.conf
# Virtual hosts
Include ../apache-conf/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-php.conf:
LoadModule php5_module "P:/dev/apps/prg/php-5.6.13/php5apache2_4.dll"
<IfModule mod_php5.c>
AddHandler application/x-httpd-php .php .php5
PHPIniDir "P:/dev/apps/prg/php-5.6.13/"
<Location /status.php>
Include ../apache-conf/httpd-localhost-access.conf
</Location>
<Location /status.php5>
Include ../apache-conf/httpd-localhost-access.conf
</Location>
</IfModule>
Create the following file P:\dev\data\httpserver\home\status.php and/or P:\dev\data\httpserver\home\status.php5:
<?php echo "Hello World"; ?>
<?php phpinfo(); ?>
Edit
t-
;
;
;
;
;
;
in the file P:\dev\apps\prg\php-5.6.13\php.ini:
The root of the PHP pages, used only if nonempty.
if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
if you are running php as a CGI under any web server (other than IIS)
see documentation for security issues. The alternate is to use the
cgi.force_redirect configuration below
http://php.net/doc-root
doc_root = P:\dev\data\httpserver\home
…
;
;
;
;
;
Directory in which the loadable extensions (modules) reside.
http://php.net/extension-dir
extension_dir = "./"
On windows:
extension_dir = "ext"
extension_dir = P:\dev\apps\prg\php-5.6.13\ext
After the Apache HTTP Server is restarted test the mod_php5 by taking a look at the PHP Status.
7.1.13. Module mod_dav configuration
Mod_dav provides class 1 and class 2 WebDAV (“Web-based Distributed Authoring and Versioning”) functionality for Apache. This extension to the HTTP protocol allows creating, moving, copying, and deleting resources
and collections on a remote web server.
Enable the following modules
-
in P:\dev\apps\httpserver\apache-2.4.16\conf\httpd.conf:
LoadModule cgi_module modules/mod_cgi.so
#LoadModule charset_lite_module modules/mod_charset_lite.so
LoadModule dav_module modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so
LoadModule dav_lock_module modules/mod_dav_lock.so
For example include
the Maven Sites WebDAV configuration just before httpd-vhosts.conf in P:\dev
\apps\httpserver\apache-conf\httpd.conf:
54
HTTP Server
# Maven Sites
Include ../apache-conf/httpd-mvn.conf
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-mvn.conf:
<IfModule dav_module>
<IfModule dav_fs_module>
<IfModule dav_lock_module>
DavLockDB "P:/dev/data/httpserver/webdav/DavLock"
Alias /mvn-sites "P:/dev/data/httpserver/mvn/sites"
<Directory "P:/dev/data/httpserver/mvn/sites">
Dav On
DavMinTimeout 120
Options Indexes
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
Include ../apache-conf/httpd-freedumbytes-realm.conf
</RequireAll>
</Directory>
</IfModule>
</IfModule>
</IfModule>
Don't forget to create the specified directories: P:\dev\data\httpserver\webdav and P:\dev\data\httpserver\mvn\sites. After the Apache HTTP Server is restarted take a look at http://
freedumbytes.dev.net/mvn-sites/.
7.1.14. Server info
The mod_info module provides a comprehensive overview of the server configuration including all installed modules and directives in the configuration files. And the mod_status module allows a server administrator to find
out how well their server is performing.
To make the upcoming changes upgrade safe initially copy the P:\dev\apps\httpserver\apache-2.4.16\conf\extra\httpd-info.conf
to
P:\dev\apps\httpserver\apache-conf
\httpd-info.conf. Thus when upgrading this functionality doesn't have to be reconfigured again.
Include
the real-time info configuration at the top in P:\dev\apps\httpserver\apache-conf
\httpd.conf:
# Real-time info on requests and configuration
Include ../apache-conf/httpd-info.conf
# Apache Macro
Include ../apache-conf/httpd-macro.conf
In the copy P:\dev\apps\httpserver\apache-conf\httpd-info.conf load the modules
strict access
to localhost:
-
and re-
LoadModule info_module modules/mod_info.so
LoadModule status_module modules/mod_status.so
…
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/server-status
# Change the ".example.com" to match your domain to enable.
<Location /server-status>
SetHandler server-status
Include ../apache-conf/httpd-localhost-access.conf
</Location>
55
Chapter 7.
#
# ExtendedStatus controls whether Apache will generate "full" status
# information (ExtendedStatus On) or just basic information (ExtendedStatus
# Off) when the "server-status" handler is called. The default is Off.
#
#ExtendedStatus On
#
# Allow remote server configuration reports, with the URL of
# http://servername/server-info (requires that mod_info.c be loaded).
# Change the ".example.com" to match your domain to enable.
#
<Location /server-info>
SetHandler server-info
Include ../apache-conf/httpd-localhost-access.conf
</Location>
Note
Keep the full status settings
disabled, performance wise. After the Apache HTTP Server is
restarted take a look at the Apache Server Status and the Apache Server Information.
56
Chapter 8.
Chapter 8. Web Server
8.1. Tomcat
Apache Tomcat is an implementation of the Java Servlet and JavaServer Pages technologies.
8.1.1. Resources
• Download Tomcat.
• Upgrade checklist:
• Related products: -.
• References: Tomcat - Manager tomcat8w.exe and Jenkins - installation guide webapps.
• Integration configuration changes: Tomcat - HTTP Binding address, Tomcat - access tomcat-users.xml,
Tomcat - Window Service tomcat8.exe //US//tomcat, Tomcat - Account Log On, Tomcat - Logging
juli / log4j / slf4j and Tomcat - Remote authentication tomcatAuthentication.
Note
Or just run p:\dev\apps\editor\winmerge\WinMergeU.exe
p:\dev
\apps\webserver\apache-tomcat-8.0.26\conf
p:\dev\apps\webserver\apache-tomcat-8.0.17\conf to copy the changes in for example server.xml
and tomcat-users.xml.
• Tomcat Documentation such as Migration 8.0.x, HTTP and AJP Connectors.
8.1.2. Tomcat installation guide
Download the archive: apache-tomcat-8.0.26-windows-x64.zip [version 8.0.26].
Extract this .zip file to P:\dev\apps\webserver.
8.1.2.1. HTTP Binding
Configure Tomcat settings
\server.xml:
-
in the file P:\dev\apps\webserver\apache-tomcat-8.0.26\conf
<Server port="80058070 " address="127.0.0.1"
shutdown="SHUTDOWN">
…
<Connector port="80808068 " address="127.0.0.1"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
URIEncoding="UTF-8" />
…
<Connector port="80098069 " address="127.0.0.1"
protocol="AJP/1.3"
redirectPort="8443"
URIEncoding="UTF-8" />
8.1.2.2. Tomcat access
Configure Tomcat access in the file P:\dev\apps\webserver\apache-tomcat-8.0.26\conf\tomcat-users.xml as follows:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<!-- Tomcat Web Application Manager -->
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<!-- Tomcat Virtual Host Manager -->
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="admin" password="password-gui" roles="manager-gui,admin-gui"/>
<user username="script-tool" password="password-tool"
roles="manager-script,admin-script"/>
<user username="jmx-tool" password="password-tool" roles="manager-jmx"/>
<user username="status" password="password-status-only"
roles="manager-status"/>
57
Chapter 8.
</tomcat-users>
These roles are used by the following two applications respectively:
1. Tomcat Web Application Manager:
• HTML Manager interface (for humans) at http://localhost:8068/manager/html.
• Text Manager interface (for scripts) at http://localhost:8068/manager/text.
• JMX Proxy interface at http://localhost:8068/manager/jmxproxy.
Status interface for all four users at http://localhost:8068/manager/status
2. Tomcat Virtual Host Manager:
• HTMLHostManager commands at http://localhost:8068/host-manager/html.
• HostManager commands at http://localhost:8068/host-manager/text.
8.1.3. Windows service
To restart automatically on Microsoft Windows create a service using an elevated command prompt as follows:
cd /d P:\dev\apps\webserver\apache-tomcat-8.0.26
set JAVA_HOME=P:\dev\apps\prg\java-x64\jdk1.8.0_74
set CATALINA_HOME=P:\dev\apps\webserver\apache-tomcat-8.0.26
bin\service.bat install tomcat
bin\tomcat8.exe //US//tomcat --DisplayName="freedumbytes.dev.net Tomcat" ^
--Description="Tomcat is an open source web server." ^
--Startup=auto
bin\tomcat8.exe //US//tomcat --JvmMx=512 --JvmMs=128
Start it with net start tomcat.
Note
In case of an upgrade sc delete tomcat first (see also Section 1.1.5, “Task Manager replacement” in case of “The specified service has been marked for deletion.”).
Important
In case of a new jdk installation just run bin\tomcat8.exe //US//tomcat --Jvm auto
(when JAVA_HOME is still pointing to the 64-bit version; see also Section 8.1.3.2, “Tomcat Manager”).
Verify the installation and the JVM memory usage at http://localhost:8068/manager/status.
8.1.3.1. Log On Windows user
For easier management of user specific files such as for example the Maven C:\Users\tomcat\.m2\settings-security.xml select Start Menu → Control Panel → User Accounts and Family Safety
→ User Accounts → Add or remove user accounts → Create a new account Tomcat as Standard user and click
Create Account. Select this new user and Create a password. Also Change the picture with Browse for more pictures… P:\dev\apps\webserver\apache-tomcat-8.0.26\webapps\ROOT\tomcat.png and click Open.
Launch the Service Management Console with services.msc. Right click on freedumbytes.dev.net Tomcat
and select Properties → Log On to use This account .\Tomcat. After password conformation click Apply and
restart the service.
8.1.3.1.1. netrc
The _netrc file contains login and initialization information used by the auto-login process.
When logged in as tomcat user type the following commands:
setx HOME %USERPROFILE%
echo machine freedumbytes.dev.net login jenkins password <password> >>
%USERPROFILE%\_netrc
This way the Jenkins build jobs will be able to auto-login to the git-repo on freedumbytes.dev.net.
58
Web Server
Important
The usage of Section 14.1.4.4, “Git authentication” is a better alternative.
Restart tomcat service to pick up the HOME setting.
8.1.3.2. Tomcat Manager
Tomcat8w is a GUI application for monitoring and configuring Tomcat services.
To monitor the tomcat service run: P:\dev\apps\webserver\apache-tomcat-8.0.26\bin
\tomcat8w.exe
//MS//tomcat or create a shortcut Tomcat Manager for it and edit Properties
→ Target to include the correct service name P:\dev\apps\webserver\apache-tomcat-8.0.26\bin
\tomcat8w.exe //MS//tomcat.
When the Tomcat Manager is running, you can see the freedumbytes.dev.net Tomcat icon
in the system tray.
Right click on this icon and select Configure to activate the console in which the Apache Tomcat Server can be
(re)started and stopped.
Note
When the monitor application was already running when the Log On account was changed (as
described in the prior Section 8.1.3.1, “Log On Windows user”) right click on its icon and select
Exit and then restart it. Because this change wont show up otherwise.
Tip
As an alternative to change the additional settings of the Tomcat service run: P:\dev\apps
\webserver\apache-tomcat-8.0.26\bin\tomcat8w.exe //MS//tomcat such as Java
→ Java Virtual Machine P:\dev\apps\prg\java-x64\jdk1.8.0_74\jre\bin\server\jvm.dll.
8.1.4. Logging
Tomcat 7.0 uses Commons Logging throughout its internal code allowing the developer to choose a logging configuration that suits their needs such as Log4J.
To switch to Log4J apply the following steps after shutting down tomcat with net stop tomcat:
1. Tomcat replacements:
• Download: tomcat-juli-adapters.jar and tomcat-juli.jar [version 8.0.26].
• Replace the tomcat-juli.jar in P:\dev\apps\webserver\apache-tomcat-8.0.26\bin.
• Install
the
tomcat-juli-adapters.jar
in
the
P:\dev\apps\webserver\apachetomcat-8.0.26\lib directory.
2.
Log4J integration:
• Download: apache-log4j-1.2.17.zip [version 1.2.17].
• Install the log4j-1.2.17.jar in the P:\dev\apps\webserver\apache-tomcat-8.0.26\lib directory.
3.
SLF4J integration:
• Download: slf4j-1.7.12.zip used by frameworks such as Hibernate [version 1.7.12].
• Install the slf4j-api-1.7.12.jar in the P:\dev\apps\webserver\apache-tomcat-8.0.26\lib
directory.
• And bind SLF4J to Log4J by installing the slf4j-log4j12-1.7.12.jar in the P:\dev\apps\webserver\apache-tomcat-8.0.26\lib directory.
4. Logging configuration:
• Create a file called log4j.xml in P:\dev\logs\webserver\tomcat with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration
SYSTEM "http://logging.apache.org/log4j/1.2/apidocs/org/apache/
log4j/xml/doc-files/log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
59
Chapter 8.
<appender name="FILE" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="P:/dev/logs/webserver/tomcat/tomcat.log4j"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="100MB"/>
<param name="MaxBackupIndex" value="5"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] %c{2} %x - %m%n"/>
</layout>
</appender>
<logger name="org.apache.catalina">
<level value="INFO"/>
</logger>
<root>
<level value="INFO"/>
<appender-ref ref="FILE"/>
</root>
</log4j:configuration>
• Delete
the
obsolete
P:\dev\apps\webserver\apache-tomcat-8.0.26\conf
\logging.properties or rename to logging.properties.obsolete.
• Configure the tomcat service to use the log4j.xml instead as follows:
cd /d P:\dev\apps\webserver\apache-tomcat-8.0.26
bin\tomcat8.exe //US//tomcat ^
++JvmOptions=-Dlog4j.configuration=^
file:///P:/dev/logs/webserver/tomcat/log4j.xml
bin\tomcat8.exe //US//tomcat ^
--LogPath=P:/dev/logs/webserver/tomcat
Open the Tomcat Manager in the system tray by right clicking on this icon and selecting Configure. In the
Java tab remove the now obsolete Java Options parameter -Djava.util.logging.config.file=P:
\dev\apps\webserver\apache-tomcat-8.0.26\conf\logging.properties.
8.1.5. Apache configuration
Instruct Apache to proxy all URLs whose path portions begin with /tomcat/ using the following P:\dev\apps
\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# Tomcat
Include ../apache-conf/httpd-tomcat.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-tomcat.conf (see also Section 7.1.9.2, “Html rewrite configuration”):
<IfModule headers_module>
<IfModule proxy_html_module>
<IfModule proxy_module>
<IfModule proxy_http_module>
Redirect /tomcat
/tomcat/
ProxyPass /tomcat/ http://localhost:8068/
<Location /tomcat/>
ProxyPassReverse /
ProxyHTMLEnable On
60
Web Server
RequestHeader unset Accept-Encoding
ProxyHTMLURLMap http://localhost:8068 /tomcat
ProxyHTMLURLMap /
/tomcat/
ProxyHTMLURLMap /tomcat/
/tomcat/
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
Important
Notice that only local access
is activated and not the freedumbytes.dev.net realm
because this clashes with the basic authentication of Tomcat itself resulting in the following error “AH01618: user admin not found: /tomcat/manager/status, referer: http://
freedumbytes.dev.net/tomcat/” and hanging HTTP requests.
8.1.5.1. Remote authentication
For the AJP protocol connector tell Tomcat not to use its internal (primitive) authentication mechanism, but instead to use remote authentication provided by the front-end web server with the following setting
in the file
P:\dev\apps\webserver\apache-tomcat-8.0.26\conf\server.xml:
<Connector address="127.0.0.1" port="8069" protocol="AJP/1.3"
tomcatAuthentication="false"
URIEncoding="UTF-8"/>
This can be useful for passing on authenticated users to for example applications such as Jenkins.
When the Tomcat web server and the Apache HTTP Server are restarted you should be able to browse Tomcat
at http://freedumbytes.dev.net/tomcat/.
61
62
Chapter 9.
Chapter 9. Application Server
9.1. GlassFish
GlassFish World's first Java EE Application Server.
9.1.1. Resources
• Download GlassFish.
• Upgrade checklist:
• Related products: Upgrade Guide and Section 9.1.6, “Update options”.
• References: -.
• Integration configuration changes:
Note
Just run p:\dev\apps\editor\winmerge\WinMergeU.exe
p:\dev\apps
\appserver\glassfish-4.1\glassfish\domains\domain1\config
p:\dev
\apps\appserver\glassfish-4.0\glassfish\domains\domain1\config to
copy the changes in for example domain.xml,
Note
And run p:\dev\apps\editor\winmerge\WinMergeU.exe
p:\dev\apps
\appserver\glassfish-4.1\glassfish\config
p:\dev\apps\appserver\glassfish-4.0\glassfish\config for asenv.bat.
•
•
•
•
•
GlassFish Server Documentation.
Get Started Quickly.
GlassFish and IDE support.
Related Open Source Projects.
The Aquarium news from the GlassFish Community.
9.1.2. GlassFish installation guide
Download the archive: glassfish-4.1.zip [version 4.1].
Extract the .zip file to P:\dev\apps\appserver and rename P:\dev\apps\appserver\glassfish4 to P:
\dev\apps\appserver\glassfish-4.1.
Change the listener addresses to localhost
(to restrict access), host IP
(to allow local area network access;
see also 192.168.0.xx host [46]) and optionally disable the ssl
connections by editing the configuration file P:
\dev\apps\appserver\glassfish-4.1\glassfish\domains\domain1\config\domain.xml:
<domain
…
<configs>
<config name="server-config">
…
<iiop-service>
…
<iiop-listener address="0.0.0.0127.0.0.1 " port="3700" …
<iiop-listener … address="0.0.0.0127.0.0.1 " port="3820"
enabled="false"
id="SSL">
…
</iiop-listener>
<iiop-listener … address="0.0.0.0127.0.0.1 " port="3920"
enabled="false"
id="SSL_MUTUALAUTH">
…
</iiop-listener>
</iiop-service>
<admin-service … system-jmx-connector-name="system">
<jmx-connector … address="0.0.0.0192.168.0.xx " port="8686"
name="system" />
…
</admin-service>
…
<network-config>
63
Chapter 9.
…
<network-listeners>
<network-listener port="80808071 " address="127.0.0.1"
<network-listener port="8181" address="127.0.0.1"
enabled="false"
…
<network-listener port="4848" address="192.168.0.xx"
…
</network-listeners>
…
…
</network-config>
…
</config>
<config name="default-config" dynamic-reconfiguration-enabled="true" >
…
<iiop-service>
…
<iiop-listener port="${IIOP_LISTENER_PORT}" …
address="0.0.0.0127.0.0.1 " />
<iiop-listener port="${IIOP_SSL_LISTENER_PORT}" …
address="0.0.0.0127.0.0.1 " …>
…
</iiop-listener>
<iiop-listener port="${IIOP_SSL_MUTUALAUTH_PORT}" …
address="0.0.0.0127.0.0.1 " …>
…
</iiop-listener>
</iiop-service>
<admin-service system-jmx-connector-name="system" type="server">
<jmx-connector address="0.0.0.0192.168.0.xx " …
port="${JMX_SYSTEM_CONNECTOR_PORT}" …/>
…
</admin-service>
…
<network-config>
…
<network-listeners>
<network-listener address="127.0.0.1"
port="${HTTP_LISTENER_PORT}" … />
<network-listener address="127.0.0.1"
port="${HTTP_SSL_LISTENER_PORT}" … />
<network-listener address="192.168.0.xx"
port="${ASADMIN_LISTENER_PORT}" … />
</network-listeners>
…
</network-config>
…
</config>
</configs>
<property name="administrative.domain.name" value="domain1"/>
</domain>
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment Variables and Edit the Path to append %GLASSFISH_HOME%\bin;. Also add a New system variable
GLASSFISH_HOME pointing to P:\dev\apps\appserver\glassfish-4.1.
For administration tasks, the GlassFish server software provides the following tools, which enable administrators
to manage server instances:
• The Admin Console, a browser-based graphical user interface (GUI).
• The asadmin utility, a command-line tool.
Start the server by entering the command asadmin start-domain.
Show domains running on the server by entering the command asadmin list-domains.
Stop the server by entering the command asadmin stop-domain domain1.
Verify that the server is running in your browser at http://localhost:8071.
9.1.3. Changing JDK version
Updating GlassFish to run with a JDK version that is different to the one used during installation will affect all local
domains. To do this, update the following in the file P:\dev\apps\appserver\glassfish-4.1\glassfish
\config\asenv.bat:
64
Application Server
REM Yet, this file is also where users of earlier versions have sometimes added
REM a definition of AS_JAVA to control which version of Java GlassFish
REM should use. As a result, in order to run a user-specified version of Java,
REM the asadmin and appclient scripts do indeed invoke this file as a
REM script - but ONLY to define AS_JAVA. Any calling script should not
REM rely on the other settings because the relative paths will be resolved
REM against the current directory when the calling script is run, not the
REM installation directory of GlassFish, and such resolution will not work
REM correctly unless the script happens to be run from the GlassFish
REM installation directory.
…
set AS_JAVA=P:\dev\apps\prg\java-x64\jdk1.8.0_74
9.1.4. Autodeploy
Just copy the application, which is packaged as Java ARchive (JAR), Web ARchive (WAR), or Enterprise ARchive
(EAR) file, into P:\dev\apps\appserver\glassfish-4.1\glassfish\domains\domain1\autodeploy
\.
A prepackaged application that says “Hello” can be downloaded from http://glassfish.dev.java.net/downloads/quickstart/hello.war.
9.1.5. Admin console
Access http://freedumbytes.dev.net:4848. Enter the admin user name and password.
In the left pane, click the Applications node. If you already have the hello.war application deployed, undeploy
it by selecting the checkbox next to it and clicking Undeploy. To deploy a newly assembled application click Deploy….
To verify that it was deployed properly, click Launch.
9.1.6. Update options
GlassFish Server provides the following tools for updating software on a deployed server:
1. The Administration Console enables you to perform the following tasks that are related to extending and
updating GlassFish Server (in Admin Console see Common Tasks → Update Center or
Update Tool lists
the Installed Components, Available Updates and Available Add-Ons).
2. Update Tool is a standalone graphical tool bundled with GlassFish Server that can be used to find and install
updates and add-ons on a deployed GlassFish Server instance (run with updatetool; to stop the Update Tool
notifier process, use the updatetool --notifier --shutdown command).
3. The pkg command is the command-line equivalent to Update Tool. Most of the tasks that can be performed
with the graphical Update Tool can be performed from a command line using the pkg tool.
9.1.7. JVM switches for performance
JVMs offer a variety of standard and non-standard switches that tune memory allocation and garbage collection
behavior. Some of these settings can benefit glassfish-domain performance:
• -Xms256m - this setting tells the Java virtual machine to set its initial heap size to 256 megabytes. By telling
the JVM how much memory it should initially allocate for the heap, we save it growing the heap as applications
consume more memory. This switch improves startup time.
• -Xmx512m (default GlassFish setting) - this settings tells the Java virtual machine the maximum amount of
memory it should use for the heap. Placing a hard upper limit on this number means that the Java process
cannot consume more memory than physical RAM available. This limit can be raised on systems with more
memory. Current default value is 512MB.
Warning
Do not set this value to near or greater than the amount of physical RAM in your system or
it will cause severe swapping during runtime.
• -Xverify:none - this switch turns off Java bytecode verification, making classloading faster, and eliminating
the need for classes to be loaded during startup solely for the purposes of verification. This switch improves
startup time, and there is no reason not to use it.
• -XX:+UseAdaptiveSizePolicy - this switch may help improve garbage collector throughput and memory
footprint. It is part of garbage collector ergonomics implemented in JDK5.0.
65
Chapter 9.
• -XX:+UseParallelGC - some tests have shown that, at least on systems fairly well equipped with memory,
the durations of minor garbage collections is halved when using this collection algorithm, on uniprocessor
systems. Note that this is paradoxical - this collector is designed to work best on multiprocessor systems with
gigabyte heaps. No data is available on its effect on major garbage collections. This collector is mutually exclusive with -XX:+UseConcMarkSweepGC.
• Optional -XX:CompileThreshold=100 - this switch will make startup time slower, by HotSpot to compile
many more methods down to native code sooner than it otherwise would. The reported result is snappier
performance once the server is running, since more of the code will be compiled rather than interpreted. This
value represents the number of times a method must be called before it will be compiled.
• Optional -XX:MaxPermSize=192m (jdk1.7.0 and earlier; since GlassFish version 2 beta 2 the option is activated with default setting of 192m) - In some cases, such as when applications that request quite a lot of memory, the server can run out of a different type of memory (Permanent Generation), and if this is the case the
above settings may not help solve the memory issue. A problem like this may occur when running multiple
applications on the same server.
You could connect to the GlassFish Admin GUI and select: Configurations → server-config → JVM Settings →
JVM Options and click Add JVM Option repeatedly. After entering the last option don't forget to click Save and
restarting the service (see the message in the banner Restart Required).
Or stop the domain and just edit P:\dev\apps\appserver\glassfish-4.1\glassfish\domains\domain1\config\domain.xml to try out the jvm options
(some might already configured):
<configs>
<config name="server-config">
…
<java-config …>
<jvm-options>-XX:MaxPermSize=192m</jvm-options>
<!--jvm-options>-Xrs</jvm-options-->
<!-- see also Section 3.1.3.1,
“Standard Edition Tools Reference” -->
<jvm-options>-server</jvm-options>
…
<jvm-options>-Xms256m</jvm-options>
<jvm-options>-Xmx512m</jvm-options>
<jvm-options>-Xverify:none</jvm-options>
…
<jvm-options>-XX:NewRatio=2</jvm-options>
<jvm-options>-XX:+UseParallelGC</jvm-options>
<jvm-options>-XX:+UseAdaptiveSizePolicy</jvm-options>
<jvm-options>-XX:CompileThreshold=100</jvm-options>
</java-config>
Restart the domain.
9.1.8. Apache configuration
Instruct Apache to proxy all URLs whose path portions begin with /glassfish/ using the following P:\dev
\apps\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# GlassFish
Include ../apache-conf/httpd-glassfish.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-glassfish.conf:
<IfModule
<IfModule
<IfModule
<IfModule
66
headers_module>
proxy_html_module>
proxy_module>
proxy_http_module>
Application Server
Redirect /glassfish
/glassfish/
ProxyPass /glassfish/ http://localhost:8071/
<Location /glassfish/>
ProxyPassReverse /
ProxyHTMLEnable On
RequestHeader unset Accept-Encoding
ProxyHTMLURLMap http://localhost:8071 /glassfish
ProxyHTMLURLMap /
/glassfish/
ProxyHTMLURLMap /glassfish/
/glassfish/
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
When the domain and the Apache HTTP Server are restarted you should be able to browse GlassFish at http://
freedumbytes.dev.net/glassfish. Change/Set the admin password at Domain → Administrator Password
9.1.9. Windows service
To restart automatically on Microsoft Windows create a service using an elevated command prompt as follows:
cd /d P:\dev\apps\appserver\glassfish-4.1
set JAVA_HOME=P:\dev\apps\prg\java-x64\jdk1.8.0_74
set GLASSFISH_HOME=P:\dev\apps\appserver\glassfish-4.1
asadmin create-service domain1
dir domain1Service.xml /s
Note
In case of an upgrade sc delete glassfish first (see also Section 1.1.5, “Task Manager
replacement” in case of “The specified service has been marked for deletion.”).
Edit the following entries
in the newly generated service configuration file P:\dev\apps\appserver\glassfish-4.1\glassfish\domains\domain1\bin\domain1Service.xml:
<service>
<id>domain1glassfish </id>
<name>domain1 GlassFish Serverfreedumbytes.dev.net GlassFish </name>
<description>GlassFish ServerGlassFish Application Server </description>
<executable>
P:/dev/apps/appserver/glassfish-4.1/glassfish/lib/nadmin.bat
</executable>
<logpath>
P:\\dev\\apps\\appserver\\glassfish-4.1\\glassfish\\domains/domain1/bin
</logpath>
<logmode>reset</logmode>
<depend>tcpip</depend>
<startargument>start-domain</startargument>
<startargument>--watchdog</startargument>
<startargument>--domaindir</startargument>
<startargument>
P:\\dev\\apps\\appserver\\glassfish-4.1\\glassfish\\domains
</startargument>
<startargument>domain1</startargument>
<stopargument>stop-domain</stopargument>
<stopargument>--domaindir</stopargument>
<stopargument>
P:\\dev\\apps\\appserver\\glassfish-4.1\\glassfish\\domains
</stopargument>
<stopargument>domain1</stopargument>
</service>
Activate those changes with:
67
Chapter 9.
cd glassfish\domains\domain1\bin\
sc delete domain1
domain1Service.exe install
Important
The domain1Service
install must be run in its directory glassfish\domains\domain1\bin\ otherwise the following error “System error 2 has occurred. The system cannot find the file specified.” will occur during net start glassfish.
Start it with net start glassfish.
Verify the installation at http://freedumbytes.dev.net/glassfish.
9.1.9.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net GlassFish and select Properties → Log On to use This
account .\Tomcat. After password conformation click Apply and restart the service.
68
Chapter 10.
Chapter 10. Database
10.1. MySQL
MySQL is the world's most popular open source database.
10.1.1. Resources
• Download and Upgrading MySQL (from previous series).
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: MySQL - Upgrading backup xcopy / sc delete mysqlmaster /
unzip lastest / MYSQL_HOME / basedir / mysql-create-service master / mysql_upgrade /
mysql_upgrade_info.
• MySQL Reference Manual and Documentation.
• Download MySQL Workbench provides DBAs and developers an integrated tools environment for: Database
Design & Modeling, SQL Development (replacing MySQL Query Browser) and Database Administration (replacing MySQL Administrator).
• Download the official JDBC driver Connector/J for MySQL.
• Download MySQL Utilities a collection of command-line utilities that are used for maintaining and administering MySQL servers.
• Download MySQL Proxy is a simple program that sits between your client and MySQL server(s) that can monitor, analyze or transform their communication. Its flexibility allows for a wide variety of uses, including load
balancing; failover; query analysis; query filtering and modification; and many more.
•
MySQL Performance Blog: Recovery beyond data restore.
•
Xaprb Blog: How to make replication reliable, How replication got out of sync, How to check replication
integrity continually and Oracle is not screwing MySQL.
• How to support full Unicode in MySQL databases.
10.1.2. MySQL installation guide
Download the archive: mysql-5.6.26-winx64.zip [version 5.6.26].
Extract this .zip file to P:\dev\apps\db.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %MYSQL_HOME%\bin;. Also add a New system variable MYSQL_HOME
pointing to P:\dev\apps\db\mysql-5.6.26-winx64.
Verify the installation with mysql --version.
10.1.2.1. Custom data directory
Initialize a custom MySQL data directory with a copy of the installation data folder P:\dev\apps
\db\mysql-5.6.26-winx64\data from the command line with xcopy
/E
/I
P:\dev\apps\db
\mysql-5.6.26-winx64\data K:\dev\data\db\mysql\data.
Create a MySQL Server configuration file K:\dev\data\db\mysql\conf\mysql-master.ini:
[mysqld]
basedir="P:/dev/apps/db/mysql-5.6.26-winx64"
datadir="K:/dev/data/db/mysql/data"
tmpdir="K:/dev/data/db/mysql/tmp"
log-error="K:/dev/data/db/mysql/mysql-master-error.log"
port=3306
server_id=3306
default-storage-engine=INNODB
explicit_defaults_for_timestamp=true
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
Important
To avoid the error “InnoDB: Error: unable to create temporary file; errno: 2” create the tmpdir
with mkdir K:\dev\data\db\mysql\tmp.
From the command line start MySQL Server with mysqld --defaults-file=K:\dev\data\db\mysql\conf
\mysql-master.ini.
69
Chapter 10.
Verify the installation with mysqlshow mysql -u root and/or mysqladmin version status proc -u
root. To see a list of options provided by mysql, invoke it with the --help option.
To shutdown the SQL Server use mysqladmin -u root --port=3306 shutdown.
10.1.2.2. MySQL character set configuration
Change the default character set and collation in K:\dev\data\db\mysql\conf\mysql-master.ini:
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
[mysqld]
…
character-set-client-handshake=false
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
Verify those settings before and after restarting service mysql-1 with:
mysql -u root
mysql> show variables where variable_name
-> like 'character\_set\_%' or variable_name LIKE 'collation%';
mysql> quit
10.1.2.3. MySQL root password
If you have never set a root password for MySQL server, the server does not require a password at all for connecting as root. To setup root password for first time, use mysqladmin command at shell prompt as follows and enter
and confirm the new password:
mysqladmin -u root password
However, if you want to change a root password, then you need to use the following command and enter the old
password followed by the new password:
mysqladmin -u root -p
password
10.1.3. Windows service
With the following batch file P:\dev\apps\windows\batch\mysql-create-service.bat:
@echo off
if not "%1"=="" goto createService
echo Usage: mysql-create-service ^<master^|slave^>
goto end
:createService
setlocal
set
set
set
set
set
SERVICE_ID=mysql%1
SERVICE_DISPLAY_NAME="freedumbytes.dev.net MySQL %1"
SERVICE_EXE=%MYSQL_HOME%\bin\mysqld.exe
SERVICE_START_CMD=--defaults-file=\"K:\dev\data\db\mysql\conf\mysql-%1.ini\"
SERVICE_STOP_CMD=
sc create %SERVICE_ID% ^
binPath= "%SERVICE_EXE% %SERVICE_START_CMD% %SERVICE_ID% %SERVICE_STOP_CMD%" ^
start= auto ^
DisplayName= %SERVICE_DISPLAY_NAME%
sc description %SERVICE_ID% "MySQL is a SQL database management system."
endlocal
70
Database
:end
Define the service for the master from an elevated command prompt with: mysql-create-service master.
Start the server with sc start mysqlmaster or net start mysqlmaster.
10.1.3.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net MySQL master and select Properties → Log On to use
This account .\Tomcat. After password conformation click Apply and restart the service.
10.1.4. Backup options
1. The mysqldump client is a backup program. It can be used to dump a database or a collection of databases for
backup or transfer to another SQL server (not necessarily a MySQL server).
Create a batch file P:\dev\apps\windows\batch\mysql-backup-all.bat:
@echo off
if not "%1"=="" goto backupDatabases
echo Usage: mysql-backup-all ^<isodate^>
goto end
:backupDatabases
if not exist S:\dev\backup\db\mysqldump mkdir S:\dev\backup\db\mysqldump
cd /d S:\dev\backup\db\mysqldump
mysqldump --single-transaction --routines --triggers -q --all-databases ^
-u root -p > S:\dev\backup\db\mysqldump\all.%1.sql
:end
To dump all databases use the following statement: mysql-backup-all 20091205.
Create a batch file P:\dev\apps\windows\batch\mysql-backup-db.bat:
@echo off
if not "%2"=="" goto backupDatabase
echo Usage: mysql-backup-db ^<databasename^> ^<isodate^>
goto end
:backupDatabase
if not exist S:\dev\backup\db\mysqldump mkdir S:\dev\backup\db\mysqldump
cd /d S:\dev\backup\db\mysqldump
mysqldump --single-transaction --routines --triggers -q %1 ^
-u root -p > S:\dev\backup\db\mysqldump\%1.%2.sql
:end
To dump a specific database (for example mysql) use the following statement: mysql-backup-db mysql
20091205. And import will look like mysql -u root -p mysql < S:\dev\backup\db\mysqldump\mysql.20091205.sql.
2. You can also create a binary backup by simply archiving the complete K:\dev\data\db\mysql directory,
when the MySQL service is shut down.
10.1.5. Upgrading
Backup the mysql database separately, for example:
mysql-backup-db
mysql-backup-db
mysql-backup-db
mysql-backup-db
mysql-backup-db
mysql 20150917
fisheye 20150917
jira 20150917
sonarqube 20150917
test 20150917
Or stop the master service (after stopping services that might rely on a database such as glassfish, tomcat, fisheye,
jira and sonarqube):
71
Chapter 10.
net stop mysqlmaster
And create a binary backup of the MySQL configuration and the data directory:
xcopy /E /I K:\dev\data\db\mysql S:\dev\backup\db\mysql-20150917
After extracting the latest zip as described in installation guide and updating MYSQL_HOME also update the basedir
in K:\dev\data\db\mysql\conf\mysql-master.ini:
[mysqld]
basedir="P:/dev/apps/db/mysql-5.6.26-winx64"
Note
In case of an upgrade sc delete mysqlmaster first (see also Section 1.1.5, “Task Manager
replacement” in case of “The specified service has been marked for deletion.”).
Redefine the Windows service for the master: mysql-create-service master.
Restart the master with net start mysqlmaster.
Mysql_upgrade examines all tables in all databases for incompatibilities with the current version of MySQL Server.
Mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities
that might have been added.
Finally upgrade the master tables with mysql_upgrade -P 3306 -u root -p. After successfully running this
command, type K:\dev\data\db\mysql\data\mysql_upgrade_info should display: 5.6.26.
10.1.6. SQL Manager installation guide
EMS SQL Manager for MySQL Freeware is an excellent freeware graphical tool for MySQL Server administration.
It has minimal required set of instruments for those users who are new to MySQL server and need only its basic
functionality.
Download the SQLManager for MySQL archive: mymanager_lite.zip [version 5.5.3.46192].
Extract this .zip file to C:\tmp and run the C:\tmp\MyManagerLite.msi to install SQL Manager in P:\dev
\apps\db\sqlmanager.
Run the SQLManager and select Database → Register Database… and enter the following settings:
•
•
•
•
Host name: localhost on Port: 3306.
User name: root.
Password: password and select Next.
Database name: mysql and click Finish.
10.1.7. Navicat installation guide
Navicat is a fast, reliable and affordable Database Administration tool purpose-built for simplifying database
management and reducing administrative costs. Designed to meet the needs of database administrators, developers, and small and medium businesses, Navicat is built with an intuitive GUI which lets you create, organize,
access and share information in a secure and easy way.
Download the Win32 binary: navicat111_mysql_en_x64.exe [version 11.1.13].
Note
At the time of writing there isn't a lite version available anymore.
Run this .exe file to install Navicat Lite in P:\dev\apps\db\navicat.
Run the Navicat and select File → New Connection… → MySQL… and enter the following settings:
• Connection name: MySQL.
• Host name/IP address: localhost.
• Port: 3306.
72
Database
• User name: root.
• Password: password and click Ok.
10.2. Oracle
Oracle Database.
10.2.1. Resources
• Oracle Database Software Downloads.
• Get Oracle JDBC drivers from the Oracle Maven Repository.
• Oracle SQL Developer is a free integrated development environment that simplifies the development and
management of Oracle Database in both traditional and Cloud deployments. SQL Developer offers complete
end-to-end development of your PL/SQL applications, a worksheet for running queries and scripts, a DBA console for managing the database, a reports interface, a complete data modeling solution, and a migration platform for moving your 3rd party databases to Oracle.
73
74
Chapter 11.
Chapter 11. Version Control System
11.1. Git
Git is a free & open source, distributed version control system designed to handle everything from small to very
large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full
revision tracking capabilities, not dependent on network access or a central server. Branching and merging are
fast and easy to do.
GitHub is a web-based hosting service for software development projects that use the Git revision control
system.
11.1.1. Resources
• Download prepackaged binaries from Git for Windows.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: GitWeb - Perl implementation / gitweb.cgi and GitWeb - Repository
styling git pull gitweb-theme.
• A few git tips you didn't know about.
• The Pro Git Book (see for example: Git Tools - Rewriting History).
• github:help - Set Up Git for Windows and gitcheatsheet.
11.1.2. Git installation guide
Download the binary: Git-2.5.2.2-64-bit.exe [version 2.5.2].
Run this .exe file to install Git in P:\dev\apps\vcs\git with the default settings.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %GIT_HOME%\bin;. Also add a New system variable GIT_HOME pointing
to P:\dev\apps\vcs\git.
Verify the installation with git --version.
Now mkdir P:\dev\data\repo\git where the new project repositories will be residing. Also mkdir P:\dev
\apps\vcs\git\tmp to prevent the following message “bash.exe: warning: could not find /tmp, please create”.
11.1.2.1. Git bash home directory
Right-click on the shortcut for
Git Bash and change Properties → Start in from %HOMEDRIVE%%HOMEPATH%
to C:\dev\projects and remove -cd option from the Target.
Tip
Auto-completion should be preconfigured during installation. When typing a git command
press TAB for auto-completion when it should be obvious what the statement will be. Type
TAB twice to get the suggestions when it isn't. For example git clo versus git cl (with
suggestions: clean clone).
11.1.2.2. Global settings
Start Git Bash and setup user specific global settings with (see also C:\Users\<username>\.gitconfig):
git config --global user.name "Jene Jasper"
git config --global user.email [email protected]
git config --global core.editor \
"'P:/dev/apps/editor/notepad++/notepad++.exe' \
-multiInst -noPlugins -nosession -notabbar"
git config --global branch.autosetuprebase always
git config --global push.default simple
75
Chapter 11.
git config --list
11.1.2.3. External diff tool
To be able to use WinMerge as the diff tool add the following:
git config --global diff.tool winmerge
git config --global difftool.winmerge.cmd \
"winmerge.sh \"\$LOCAL\" \"\$BASE\" \"\$REMOTE\""
git config --global difftool.prompt false
Create the following wrapper P:\dev\apps\windows\batch\winmerge.sh:
#!/bin/sh
# Passing the following parameters to difftool:
# LOCAL BASE REMOTE
diffPreImage=$1
diffFileName=$2
diffPostImage=$3
NULL="/dev/null"
if [ "$diffPostImage" = "$NULL" ] ; then
echo "removed: $diffFileName"
elif [ "$diffPreImage" = "$NULL" ] ; then
echo "added: $diffFileName"
else
echo "changed: $diffFileName"
"P:/dev/apps/editor/winmerge/WinMergeU.exe" -e -u \
-dl "Working copy $diffFileName" \
-dr "Original $diffFileName" "$diffPostImage" "$diffPreImage"
fi
11.1.2.4. External merge tool
To be able to use KDiff3 as the merge tool add the following:
git config --global merge.tool kdiff
git config --global mergetool.kdiff.cmd \
'3waymerge.sh "$PWD/$LOCAL" "$PWD/$BASE" "$PWD/$REMOTE" "$PWD/$MERGED"'
git config --global mergetool.kdiff.trustExitCode false
git config --global mergetool.kdiff.keepBackup false
git config --global mergetool.prompt false
Create the following wrapper P:\dev\apps\windows\batch\3waymerge.sh:
#!/bin/sh
# Passing the following parameters to mergetool:
# LOCAL BASE REMOTE MERGED
currentBranch=$1
commonBaseMerge=$2
toBeMerged=$3
resultOfMerge=$4
if [ -f $commonBaseMerge ]
then
# KDiff3 will display eol choices (if Windows: CRLF, if Unix LF)
"P:/dev/apps/editor/kdiff3/kdiff3.exe" \
-m "$commonBaseMerge" "$currentBranch" "$toBeMerged" \
-o "$resultOfMerge"
else
# KDiff3 however does know how to merge based on 2 files (not just 3)
"P:/dev/apps/editor/kdiff3/kdiff3.exe" \
-m "$commonBaseMerge" "$toBeMerged" \
-o "$resultOfMerge"
fi
76
Version Control System
11.1.2.5. Ignores template
Create the following ignores template P:\dev\data\repo\.gitignore:
#general
*.bak
*~
*.log
#compiled
*.com
*.class
*.dll
*.exe
*.o
*.so
#eclipse
.classpath
.project
.settings/
#maven
target/
#cvs
CVS/
.cvsignore
#subversion
.svn/
11.1.3. Test drive
With above settings in place in C:\Users\<username>\.gitconfig:
[user]
name = Jene Jasper
email = [email protected]
[core]
editor = 'P:/dev/apps/editor/notepad++/notepad++.exe' …
[branch]
autosetuprebase = always
[diff]
tool = winmerge
[difftool "winmerge"]
cmd = winmerge.sh \"$LOCAL\" \"$BASE\" \"$REMOTE\"
[difftool]
prompt = false
[merge]
tool = kdiff
[mergetool "kdiff"]
cmd = 3waymerge.sh \"$PWD/$LOCAL\" \"$PWD/$BASE\" \"$PWD/$REMOTE\" …
trustExitCode = false
keepBackup = false
[mergetool]
prompt = false
A slightly changed example based on “Setting up diff and merge tools for Git on Windows” to see everything in
action.
Start Git Bash and create a sample project test-drive with ignores in C:\dev\projects\test-drive as
follows:
mkdir test-drive
cd test-drive
git init
cp /p/dev/data/repo/.gitignore .
git add .gitignore
Create the following file C:\dev\projects\test-drive\hello.txt:
77
Chapter 11.
Hello world!
Second line.
Third Line.
Stage hello.txt also and commit both files with:
git
git
git
git
git
git
status
add hello.txt
status
commit -m 'initial commit.'
status
log --pretty=oneline
Create a new branch and check it out in one go:
git checkout -b hello-git
git status
Change the branched C:\dev\projects\test-drive\hello.txt as follows:
Hello Git!
Second line.
3rd Line.
Skip the staging command by committing the change immediately and switch back to the master branch:
git
git
git
git
git
git
status
commit -a -m 'branch commit.'
log --pretty=oneline
status
checkout master
status
Append text to the head revision first line and change third line uppercase 'L' in C:\dev\projects\test-drive\hello.txt as follows:
Hello world! Hello indeed.
Second line.
Third line.
Commit this change to the master branch and try to merge both branches:
git
git
git
git
git
git
status
commit -a -m 'head commit.'
status
merge hello-git
status
diff
Use KDiff3 to fix the merge conflicts:
git mergetool
For the first conflict select the content of both the file C and the file B with Ctrl+3 followed by Ctrl+2. Move to
the next conflict with Ctrl+Down and select the content of the file B with Ctrl+2. Finally combine the first line
copies of B and C in the output file to look like:
Hello Git! Hello indeed.
Second line.
Third line.
Quit KDiff3 with Ctrl+Q and verify the resulting patch or diff using WinMerge:
git status
78
Version Control System
git diff --cached
git difftool --cached
git log --pretty=oneline
git commit -m 'merged file.'
gitk
git branch -D hello-git
gitk
11.1.4. Apache configuration
Git-http-backend is a simple CGI program to serve the contents of a Git repository to Git clients accessing the
repository over http and https protocols. The program supports clients fetching using both the smart HTTP protocol and the backwards-compatible dumb HTTP protocol, as well as clients pushing using the smart HTTP protocol.
Define a macro to delegate the handling of all URLs whose path portions begin with /git-repo/ to use this Smart
HTTP Transport with the following include
just after httpd-macro.conf in P:\dev\apps\httpserver\apache-conf\httpd.conf:
# Apache Macro
Include ../apache-conf/httpd-macro.conf
Include ../apache-conf/httpd-git-macro.conf
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-git-macro.conf:
<IfModule mod_macro.c>
<IfModule alias_module>
<IfModule env_module>
<Macro GitRepos $git_uri $project_root>
SetEnv GIT_PROJECT_ROOT $project_root
SetEnv GIT_HTTP_EXPORT_ALL
AliasMatch \
^$git_uri/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$ \
$project_root/$1
AliasMatch \
^$git_uri/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ \
$project_root/$1
ScriptAliasMatch \
(?x)^$git_uri/(.*/(HEAD|info/refs|objects/info/[^/]+ \
|git-(upload|receive)-pack))$ \
P:/dev/apps/vcs/git/mingw64/libexec/git-core/git-http-backend.exe/$1
<Location $git_uri>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
</Macro>
</IfModule>
</IfModule>
</IfModule>
Use
this macro in P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# Git
Use GitRepos /git-repo P:/dev/data/repo/git
</IfModule>
</IfModule>
</VirtualHost>
Restart the Apache HTTP Server.
79
Chapter 11.
You may need to reboot the server for the Path setting for GIT_HOME [75] to take effect.
11.1.4.1. Git repository
Also define in this macro to delegate the handling of all URLs whose path portions begin with /git-repo/ to
the CGI (Common Gateway Interface) of GitWeb
which allows browsing a Git repository (or a set of Git repositories) using a web browser in the above created file P:\dev\apps\httpserver\apache-conf\httpd-gitmacro.conf:
<IfModule mod_macro.c>
<IfModule mod_cgi.c>
<IfModule alias_module>
<IfModule env_module>
<Macro GitRepos $git_uri $project_root $gitweb_conf >
…
<Location $git_uri>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
SetEnv GITWEB_CONFIG P:/dev/data/httpserver/home/git/$gitweb_conf
Alias $git_uri/static P:/dev/apps/vcs/git/mingw64/share/gitweb/static
ScriptAlias $git_uri \
P:/dev/apps/vcs/git/mingw64/share/gitweb/gitweb.cgi
</Macro>
</IfModule>
</IfModule>
</IfModule>
</IfModule>
with the following content in P:\dev\data\httpserver\home\git\gitweb.conf (see also gitweb/
README):
$projectroot = "/p/dev/data/repo/git";
$stylesheet = "git-repo/static/gitweb.css";
$logo = "git-repo/static/git-logo.png";
$favicon = "git-repo/static/git-favicon.png";
$javascript = "git-repo/static/gitweb.js";
$projects_list_description_width = 75
Supply the extra parameter for $gitweb_conf filename in P:\dev\apps\httpserver\apache-conf\httpdvhosts.conf:
# Git
Use GitRepos /git-repo P:/dev/data/repo/git gitweb.conf
11.1.4.2. GitWeb Perl implementation
Because GitWeb isn't working with ActivePerl configure it to use the supplied Perl implementation of mysysGit in
P:\dev\apps\vcs\git\mingw64\share\gitweb\gitweb.cgi:
#!/usr/bin/perlP:/dev/apps/vcs/git/usr/bin/perl.exe
But this one is missing the CGI.pm module. Just copy it from ActivePerl:
copy P:\dev\apps\prg\perl-5.22.0.2200\lib\CGI.pm ^
P:\dev\apps\vcs\git\mingw64\share\gitweb
xcopy /E /I P:\dev\apps\prg\perl-5.22.0.2200\lib\CGI ^
P:\dev\apps\vcs\git\mingw64\share\gitweb\CGI
When the Apache HTTP Server is restarted you should be able to browse the Git Repository at http://
freedumbytes.dev.net/git-repo.
11.1.4.3. Git private repository
With the above macro setup, it is possible to simply add a private Git repository that is only available at for example
http://localhost/git-private with the following changes in P:\dev\apps\httpserver\apache-conf\httpdvhosts.conf:
80
Version Control System
<VirtualHost *:80>
…
</VirtualHost>
<VirtualHost 127.0.0.1:80>
Use GitRepos /git-private P:/dev/data/repo/private/git gitweb-private.conf
</VirtualHost>
with its own GitWeb configuration file P:\dev\data\httpserver\home\git\gitweb-private.conf:
$projectroot = "/p/dev/data/repo/private/git";
$stylesheet = "git-private/static/gitweb.css";
$logo = "git-private/static/git-logo.png";
$favicon = "git-private/static/git-favicon.png";
$javascript = "git-private/static/gitweb.js";
$projects_list_description_width = 75
11.1.4.4. Repository styling
Style the repository with for example the gitweb-theme (an alternative theme for GitWeb, strongly inspired by
GitHub):
cd /d P:\dev\data\httpserver\home\git
git clone git://github.com/kogakure/gitweb-theme
or upgrade with:
cd /d P:\dev\data\httpserver\home\git\gitweb-theme
git pull
Configure the theme in P:/dev/data/httpserver/home/git/gitweb.conf:
…
$stylesheet = "git-repo/staticgitweb-theme/gitweb.css";
$logo = "git-repo/staticgitweb-theme/git-logo.png";
$favicon = "git-repo/staticgitweb-theme/git-favicon.png";
$javascript = "git-repo/staticgitweb-theme/gitweb.js";
…
Point Apache HTTP Server to the correct location in P:\dev\apps\httpserver\apache-conf\httpd-gitmacro.conf:
…
Alias /git-repo/static P:/dev/apps/vcs/git/share/gitweb/static
Alias /git-repo/gitweb-theme P:/dev/data/httpserver/home/git/gitweb-theme
When the Apache HTTP Server is restarted you should be able to browse the Git Repository with a new theme at
http://freedumbytes.dev.net/git-repo.
11.1.5. Defining a project
Create a shell script P:\dev\apps\windows\batch\git-create-repo.sh:
#!/bin/bash
if [ $# -lt 3 ]
then
echo "Usage: git-create-repo <git-repo-location> <project-name> \"<projectdescription>\" [-jenkinsHook]."
exit 9
else
git_repo="$1"
project_name="$2"
project_description="$3"
jenkins_hook="$4"
81
Chapter 11.
echo "Project request for $project_name - $project_description"
if [ -d "$git_repo" ]
then
echo "Located Git repository at $git_repo"
else
echo "Create Git repository at $git_repo"
mkdir $git_repo || exit 1
fi
if [ -d "$git_repo/$project_name" ]
then
echo "Project $project_name already exists."
exit 2
else
echo "Create project $project_name"
cd $git_repo
git init --bare $project_name
echo "Set project description to $project_description"
cd $project_name
echo "$project_description" > description
echo "Set description $project_description"
git config http.receivepack true
echo "Disable auto-converting CRLF line endings into LF"
git config core.autocrlf false
echo "Make 'git pull' on master always use rebase"
git config branch.master.rebase true
echo "Setup rebase for every tracking branch"
git config branch.autosetuprebase always
if [[ "$jenkins_hook" == "-jenkinsHook" ]]
then
echo "Setup Jenkins git hook"
echo "#!/bin/sh" > hooks/post-receive
echo "" >> hooks/post-receive
echo "curl http://freedumbytes.dev.net/jenkins/git/notifyCommit?url=http://
freedumbytes.dev.net/git-repo/$project_name" >> hooks/post-receive
else
echo "DONT setup Jenkins git hook"
fi
tmp=${TMPDIR-/tmp}
tmp=$tmp/git-clone.$RANDOM.$RANDOM.$RANDOM.$$
echo "Create temporary clone of project $project_name in $tmp"
mkdir $tmp || exit 3
cd $tmp
git clone $git_repo/$project_name $tmp/$project_name
cd $project_name
Note
See Safely Creating Temporary Files in Shell Scripts.
echo "Add .gitignore to project"
cp P:/dev/data/repo/.gitignore $tmp/$project_name
git config user.name "freedumbytes.dev.net GitWeb"
git config user.email [email protected]
82
Version Control System
git
git
git
git
config core.autocrlf false
add .gitignore
commit -am "initial commit."
push origin master
(see also note below about line endings)
echo "Cleanup temporary clone of project $project_name in $tmp"
cd ../..
rm -rf $tmp || exit 4
fi
fi
Note
Line endings… the scourge of every Windows-based developer that tries to mingle with linuxor mac-based developers. Though most modern text editors can handle both newline types
without issue, git is not as graceful. Combined with Eclipse issue 301775: “EGit/JGit ignores
the core.autocrlf flag which may be quite inconvenient for Windows users” the command
git config core.autocrlf false is added to the above script. The article linked at the
beginning of this note also supplies information to fix this setting issue and how to reset your
repos at a later stage.
Create a new bare repository with the following command git-create-repo.sh P:/dev/data/repo/git
dpl-manual.git "Production Development Line manual" -jenkinsHook.
11.1.5.1. Anonymous Jenkins Notify Hook
To enable anonymous access from the local area network
\httpserver\apache-conf\httpd-jenkins.conf:
to the Jenkins hook
edit P:\dev\apps
<IfModule proxy_module>
<IfModule proxy_ajp_module>
AllowEncodedSlashes NoDecode
ProxyPass /jenkins
ajp://localhost:8069/jenkins nocanon
ProxyPassReverse /jenkins ajp://localhost:8069/jenkins
<Location /jenkins>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
<Location /jenkins/git/notifyCommit>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
</IfModule>
</IfModule>
11.1.6. Working on a project
Ask Git to clone a copy of a repository with the following batch file P:\dev\apps\windows\batch\gitclone.bat:
@echo off
if not "%2"=="" goto cloneRepo
echo Usage: git-clone ^<username^> ^<projectname^>
goto end
:cloneRepo
cd /d C:\dev\projects
if exist \projects\%2 ren "%2" "%2.old"
git clone http://%[email protected]/git-repo/%2
cd %2
git config core.autocrlf false
(see also note about line endings)
:end
83
Chapter 11.
Clone the remote repository with the following command git-clone jjasper dpl-manual.
Now you have a personal copy of the remote repository in a new directory named C:\dev\projects\dpl-manual. You can edit the files in your working copy and then commit and push those changes back into the remote
repository.
Other useful Git command options are:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
git help <command> for more information on a specific command.
git branch to list, create, or delete branches.
git status to list files changed in working directory.
git add file contents to the index aka staging area.
git checkout a branch or paths to the working directory.
git commit record (or --amend) changes to the local repository (for example git commit -am "use -a
to skip add of modified file to staging area first.").
git fetch latest changes from origin to local repository.
git pull latest changes from origin and then merge into your current branch.
git push your work back up to the origin.
git diff displays changes between commits, commit and working directory, etc.
git mv is a convenience function for renaming files.
git revert some existing commits.
git merge joins two or more development histories together.
git rebase takes all the changes that were committed on one branch and replays them on another one. Do
not rebase commits that you have pushed to a public repository.
Tip
Currently the design of the Git staging area only permits files to be listed. If you really need a
directory to exist in checkouts you should create a file in it. A .gitignore file works well for
this purpose, you can leave it empty or fill in the names of files you expect to show up in the
directory and don't want to check-in (see also MarkEmptyDirs).
11.2. Subversion (SVN) client only
Subversion is a version control system that is a compelling replacement for CVS in the open source community.
11.2.1. Resources
• Download prepackaged binaries.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: -.
• The Subversion Book: Version Control with Subversion.
• Subversion Quick Start, Complete Reference and CVS to SVN Crossover Guide.
•
SVNKit is a pure Java Subversion library. You would like to use SVNKit when you need to access or modify
Subversion repository from your Java application, be it a standalone program, plugin or web application.
11.2.2. Subversion installation guide
Download the archive (alternative location): svn-win32-1.8.14-ap24.zip for Apache 2.4.x [version 1.8.14].
Extract this .zip file to P:\dev\apps\vcs.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and Edit the Path to append %SVN_HOME%\bin;. Also add a New system variable SVN_HOME pointing
to P:\dev\apps\vcs\svn-win32-1.8.14. Optionally add a New system variable SVN_EDITOR pointing to for
example P:\dev\apps\editor\ultraedit\Uedit32.exe.
Verify the installation with svn --version.
11.2.3. Global ignores
Edit the %APPDATA%\subversion\config file to ignore Eclipse, Maven and backup files as follows:
### Section for configuring miscelleneous Subversion options.
[miscellany]
global-ignores = .classpath .project .settings target *.bak *~ *.log
84
Version Control System
11.2.4. Delete directories
To immediately delete a directory with its subdirectories use svn delete -m "Delete resources from
project X." http://freedumbytes.dev.net/svn-repo/project-x/trunk/src/main/resources/.
This is useful when svn delete src\main\resources followed by svn commit -m "Delete resources
from project X." results in “svn: Aborting commit: 'C:\dev\projects\project-x\src\main\resources' remains in
conflict”.
11.2.5. Credentials
Sometimes users will want to remove specific credentials from the disk cache. To do this, you need to navigate into
the %APPDATA%\Subversion\auth\svn.simple area and manually delete the appropriate cache file. Credentials are cached in individual files; if you look inside each file, you will see keys and values. The svn:realmstring
key describes the particular server realm that the file is associated with, for example:
K 8
passtype
…
K 15
svn:realmstring
V 61
<http://viewvc.tigris.org:80> CollabNet Subversion Repository
K 8
username
…
END
11.3. FishEye
Your source code repository contains an abundance of useful information that is not easy to extract, comprehend or keep up to date. FishEye painlessly opens up your repository to help you better understand your changing
source.
11.3.1. Resources
• Download FishEye Standalone and plugins.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: FishEye - Apache configuration Alias /fisheye/static, FishEye
- MySQL Connector/J mysql-connector-java-x.y.z-bin.jar and FishEye - Windows service Fisheye-Control.bat / wrapper folder / Fisheye-Install-NTService.bat.
• FishEye Documentation Home, Getting started, Backing up and restoring FishEye data, Running FishEye as a
Windows service, JVM system properties and Git manifest..
• Migrating to MySQL.
• Atlassian Blogs.
11.3.2. FishEye installation guide
Download the archive: fisheye-3.9.1.zip [version 3.9.1].
Extract this .zip file to P:\dev\apps\vcs.
Press
+Break keys to open the Windows System Properties. Select Advanced system settings → Environment Variables and Edit the Path to append %FISHEYE_HOME%\bin;. Also add a New system variable
FISHEYE_HOME pointing to P:\dev\apps\vcs\fecru-3.9.1.
Verify the installation with: .
cd /d %FISHEYE_HOME%
set JAVA_HOME=P:\dev\apps\prg\java-x64\jdk1.8.0_74
fisheyectl.bat run
Terminate the server with Ctrl+C.
Warning
If you now notice that FishEye tries to start spontaneously in its own Windows Command
Processor (cmd.exe) when the server is rebooted, you might have some startup setting that
85
Chapter 11.
triggers the start.bat file. In my case it was the auto-start of the Task Manager during boot
up. Just delete the start.bat, stop.bat and run.bat (or rename to start.bat.disable
for example) because they redirect to fisheyectl.bat anyway.
Terminate the server with Ctrl+C.
For the ease of future upgrades press +Break keys to open the Windows System Properties. Select Advanced
system settings → Environment Variables and add a New system variable FISHEYE_INST pointing to P:\dev
\data\vcs\fisheye. And perform the following steps:
•
•
•
•
mkdir %FISHEYE_INST%
move P:\dev\apps\vcs\fecru-3.9.1\config.xml P:\dev\data\vcs\fisheye
mkdir %FISHEYE_INST%\lib
move P:\dev\apps\vcs\fecru-3.9.1\var P:\dev\data\vcs\fisheye
11.3.3. FishEye configuration
Restart FishEye again with fisheyectl start. Verify that the server is running in your browser at http://
freedumbytes.dev.net:8060.
Note
In case of “java.lang.OutOfMemoryError: PermGen space” just set
FISHEYE_OPTS=Xmx512m -Xms128m before running fisheyectl start (see also Section 11.3.5, “Windows
service”).
When you access FishEye for the first time you will be asked for:
1.
2.
3.
4.
To Obtain evaluation license and Enter existing license.
Please include Crucible as part of this evaluation.
Skip for now Connect to JIRA.
Create password and Confirm password.
If you need to reset the administrator password, delete the admin-hash in the config element of your
config.xml.
Connect to the FishEye Admin GUI http://freedumbytes.dev.net:8060/admin/ and configure FishEye.
11.3.3.1. Global Settings
Select Global Settings → Server → Web Server → Edit settings:
•
•
•
•
•
Web context: fisheye.
HTTP Bind Address: 127.0.0.1:8060.
Ajp13 Bind Address: 127.0.0.1:8061.
Site URL: http://freedumbytes.dev.net/fisheye/.
Timezone : Europe/Amsterdam and click Update.
Select Global Settings → Server → Mail Server → Edit config:
• Send mail from: Server Address (below).
• From Address: [email protected].
• SMTP Host name: mail.freedumbytes.dev.net and click Save, followed by Send test email.
Stop/start FishEye using fisheyectl. Verify that the server is running in your browser at http://localhost:8060/fisheye.
11.3.4. Apache configuration
Instruct Apache to proxy (using mod_proxy_ajp) all URLs whose path portions begin with /fisheye/ using the
following P:\dev\apps\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
86
Version Control System
</Proxy>
# FishEye
Include ../apache-conf/httpd-fisheye.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-fisheye.conf:
<IfModule proxy_module>
<IfModule proxy_ajp_module>
ProxyPass /fisheye
ajp://localhost:8061/fisheye
ProxyPassReverse /fisheye ajp://localhost:8061/fisheye
#
#
ProxyPass /fisheye
http://localhost:8060/fisheye
ProxyPassReverse /fisheye http://localhost:8060/fisheye
#
#
#
#
<IfModule mod_jk.c>
JkMount /fisheye
fisheye
JkMount /fisheye/* fisheye
</IfModule>
Alias /fisheye/static
"P:\dev\apps\vcs\fecru-3.9.1\content\static"
ProxyPass /fisheye/static/
!
<Location /fisheye>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
</IfModule>
</IfModule>
When the Apache HTTP Server is restarted you should be able to browse FishEye at http://freedumbytes.dev.net/
fisheye.
11.3.4.1. Privacy Policy
Next configure if Analytics collects data about the usage of FishEye and sends it to Atlassian (see the privacy
policy for details).
11.3.4.2. Security
Next configure at the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ the Security Settings →
Authentication:
•
•
•
•
For Global Permissions: Global Anonymous Access and Crucible Anonymous Access select Turn Off.
For Built-in: Public Signup select Turn Off.
For User List Visibility and Email Visibility: select Visible to logged in users only.
For Authentication settings click Setup AJP13 authentication:
• Cache TTL (positive): 5 mins.
• Auto-add: Create a FishEye user on successful login and Apply those settings.
Also configure the Repository Settings → Defaults:
• For Permissions: Anonymous uncheck Can Read, All logged-in users check Can Read and Save changes.
Stop/start FishEye using fisheyectl. When the Apache HTTP Server is restarted you should be able to browse
FishEye with your freedumbytes.dev.net realm username and password.
Once the user, who is also the FishEye administrator, has logged in select Security Settings → Administrators
and place yourself in the Admin Users. This way you no longer need to enter the Administration Password.
Tip
The HTTP Bind Address 127.0.0.1:8060 could be removed now that the AJP authentication
is setup and running. In case of problems with the AJP Bind Address you will be able to reset
the HTTP Bind Address by reinserting it
in the config.xml as follows:
<web-server context="fisheye"
site-url="http://freedumbytes.dev.net/fisheye/">
<http bind="127.0.0.1:8060"/>
87
Chapter 11.
<ajp13 bind="127.0.0.1:8061"/>
</web-server>
11.3.5. Windows service
To restart automatically on Microsoft Windows, create a Windows service.
Download the Tanuki Java Service Wrapper archive: wrapper.zip.
Extract this .zip file to P:\dev\apps\vcs\fecru-3.9.1.
Note
In case of an upgrade just copy the one extracted in the prior FishEye version:
copy P:\dev\apps\vcs\fecru-3.7.0\Fisheye-Control.* ^
P:\dev\apps\vcs\fecru-3.9.1
xcopy /E /I P:\dev\apps\vcs\fecru-3.7.0\wrapper ^
P:\dev\apps\vcs\fecru-3.9.1\wrapper
Optionally comment out the jmx entries
and edit the following entries - in the service wrapper configuration file P:\dev\apps\vcs\fecru-3.9.1\wrapper\conf\wrapper.conf:
…
# Java Application
wrapper.java.command=P:\dev\apps\prg\java-x64\jdk1.8.0_74\bin\java
…
# Java Additional Parameters
wrapper.java.additional.1=-server
wrapper.java.additional.2=-showversion
wrapper.java.additional.3=-Djava.awt.headless=true
# JDK 1.5 Additional Parameters for jmx
# wrapper.java.additional.4=-Dcom.sun.management.jmxremote
# wrapper.java.additional.5=-Dcom.sun.management.jmxremote.port=4242
# wrapper.java.additional.6=-Dcom.sun.management.jmxremote.authenticate=false
# wrapper.java.additional.7=-Dcom.sun.management.jmxremote.ssl=false
# wrapper.java.additional.8=-Dcom.sun.management.jmxremote.password.file=./
wrapper/jmxremote.password
# wrapper.java.additional.9=-Dwrapper.mbean.name="wrapper:type=Java Service
Wrapper Control"
wrapper.java.additional.104=-Dfile.encoding=UTF-8
wrapper.java.additional.5=-Dfisheye.inst=%FISHEYE_INST%
#wrapper.java.additional.6=-Xrs
see also Section 3.1.3.1, “Standard Edition
Tools Reference”
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=256
# Maximum Java Heap Size (in MB)
wrapper.java.maxmemory=1024
…
# Log file to use for wrapper output logging.
wrapper.logfile==var/log/wrapper.log%FISHEYE_INST%/var/log/wrapper.log
…
#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=Fisheyefreedumbytes.dev.net FishEye
88
Version Control System
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=Fisheyefisheye
wrapper.ping.timeout=300
in wrapper.log)
(see also Error "JVM appears hung"
# Display name of the service
wrapper.ntservice.displayname=freedumbytes.dev.net FishEye
# Description of the service
wrapper.ntservice.description=FishEye gives Git, Subversion and CVS a Web
interface.
Register the FishEye service from folder cd /d %FISHEYE_HOME% in an elevated command prompt: wrapper\bin\Fisheye-Install-NTService.bat. Start FishEye with net start fisheye.
Note
In case of an upgrade sc delete fisheye first (see also Section 1.1.5, “Task Manager replacement” in case of “The specified service has been marked for deletion.”).
Important
In case of a new jdk installation use an elevated command prompt just run net stop fisheye and net start fisheye. Verify the upgrade at http://freedumbytes.dev.net/fisheye/admin/sysinfo.do.
Note
Should the following error “Error: no `server' JVM at `P:\dev\apps\prg\java\jre…\bin\server\jvm.dll'” occur check for stray java.exe files (see tip and warning in Section 3.1.2, “JDK installation guide”)
11.3.5.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net FishEye and select Properties → Log On to use This account .\Tomcat. After password conformation click Apply and restart the service.
11.3.6. Database migration
For migration from the default embedded FishEye HSQLDB database to an external database create a MySQL
user called fishseye-user and database called fisheye with the following commands:
mysql -u root -p
mysql> create database fisheye character set utf8 collate utf8_bin;
mysql> grant all privileges on fisheye.*
-> to 'fisheye-user'@'localhost' identified by 'password';
mysql> flush privileges;
mysql> select host,user from mysql.user;
mysql> select host,db,user from mysql.db;
mysql> quit
Download the Connector/J [version 5.1.36] and add the driver mysql-connector-java-5.1.36-bin.jar
from the archive mysql-connector-java-5.1.36.zip to the FishEye classpath placing it into P:\dev\data\vcs\fisheye\lib. For older versions of FishEye remove the one that is already in P:\dev\apps\vcs
\fecru-3.9.1\lib\dbdrivers\mysql. Requires a restart of FishEye to locate this new jar.
89
Chapter 11.
Connect to the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ and configure MySQL database.
Select Systems Settings → Database → Edit:
•
•
•
•
•
•
•
•
•
Test Connection of Built-In hsqldb.
Type: MySQL.
Driver Location: User Supplied - FISHEYE_INST\lib.
URL: jdbc:mysql://localhost/fisheye.
User Name: fisheye-user.
Password: password.
Minimum Pool Connections: 5.
Maximum Pool Connections: 20.
Parameters:
• useUnicode=true
• characterEncoding=UTF8
• connectionCollation=UTF8_bin
• Test Connection and click Save & Migrate.
11.3.7. Repository Settings
Connect to the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ and configure Repository Settings.
Select Repositories → Native Repository Access → Add Existing… with:
•
•
•
•
•
•
•
•
•
Repository type: Git.
Name: dpl-manual.
Description: Production Development Line manual. and click Next.
Repository Location: http://[email protected]/git-repo/dpl-manual.git (see also Section 7.1.4.1, “Authentication, authorization and access control”).
Authentication Style: Password for http(s).
Password: password and click Show advanced settings.
Rename Detection: copies and click Next.
Store Diff Info: enabled.
Enable Repository After Adding:disabled, click Test Connection and Add this repository when Connection
succeeded.
Select Repositories → Native Repository Access → Add Existing… with:
•
•
•
•
•
•
•
•
•
•
Repository type: Subversion.
Name: svn.
Description: Subversion Repository. and click Next.
SVN URL: http://localhost/svn-repo.
Username: fisheye (see also Section 7.1.4.1, “Authentication, authorization and access control”).
Password: password and click Show advanced settings.
Charset: default (UTF-8).
Initial Import: Do not Import.
Use Built-in Symbolic Rules: enabled.
And then Apply the Following Rules: /project/trunk/…, /project/branches/NAME/…, /project/
tags/NAME/… and click Next.
• Store Diff Info: enabled.
• Enable Repository After Adding:disabled, click Test Connection and Add this repository when Connection
succeeded.
To activate a repository select for example Repositories → dpl-manual → Summary and Actions → Enable →
Start → Save.
11.3.8. User profile
On the Dashboard page click on the logged-in user
edit for example:
at the top right of the menu bar and select Settings to
• Display Settings.
• Profile & Email.
Important
The repository types CVS and Subversion map commits based on the username. To match
Git commits select Administration → Users and Edit for example jjasper to set his Email
to the one supplied to git config --global user.email [email protected].
• Author Mapping and Add for CVS the commiter: %USERDOMAIN%\jjasper.
90
Chapter 12.
Chapter 12. Issue Tracker
12.1. JIRA
JIRA is a bug tracking, issue tracking, and project management application.
12.1.1. Resources
• Download JIRA and plugins.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: JIRA - HTTP Binding address, JIRA - MySQL Connector/J mysql-connector-java-x.y.z-bin.jar, JIRA - Properties jira.home, JIRA - Apache Configuration Context
path / Connector protocol AJP, JIRA - Windows service tomcat7.exe.x64 / tcnative-1.dll.x64
/ tomcat7.exe //US//jira and JIRA - FishEye plugin upgrade.
Note
Or just run p:\dev\apps\editor\winmerge\WinMergeU.exe P:\dev\apps\issue\atlassian-jira-6.3.14-standalone\conf
P:\dev\apps\issue\atlassian-jira-6.4.11-standalone\conf to copy the changes in for example
server.xml,
Note
And run p:\dev\apps\editor\winmerge\WinMergeU.exe P:\dev\apps\issue\atlassian-jira-6.3.14-standalone\atlassian-jira\WEB-INF
\classes\jira-application.properties
P:\dev\apps\issue\atlassian-jira-6.4.11-standalone\atlassian-jira\WEB-INF\classes for jira-application.properties.
• JIRA Documentation, Important Directories and Files and User's Guide.
• FishEye integration with the FishEye plugin to view Issue and Project changesets.
• Atlassian Blogs.
12.1.2. JIRA installation guide
Download the archive from All JIRA Download Options: atlassian-jira-6.4.11.zip [version 6.4.11].
Extract this .zip file to P:\dev\apps\issue.
Important
As of JIRA 4.3 'in-place database upgrades' is officially supported.
12.1.2.1. HTTP Binding
Change the listening ports
and
and restricted to localhost
by editing the configuration file P:\dev
\apps\issue\atlassian-jira-6.4.11-standalone\conf\server.xml:
<Server port="80058062 " address="127.0.0.1"
shutdown="SHUTDOWN">
…
<Service name="Catalina">
<Connector port="80808063 " address="127.0.0.1"
12.1.2.2. Database settings
Create a MySQL user called jira-user and database called jira with the following commands:
mysql -u root -p
mysql> create database jira character set utf8 collate utf8_bin;
mysql> grant all privileges on jira.*
91
Chapter 12.
->
mysql>
mysql>
mysql>
mysql>
to 'jira-user'@'localhost' identified by 'password';
flush privileges;
select host,user from mysql.user;
select host,db,user from mysql.db;
quit
Download the Connector/J [version 5.1.36] and add the driver mysql-connector-java-5.1.36-bin.jar
from the archive mysql-connector-java-5.1.36.zip to the JIRA classpath placing it into P:\dev\apps
\issue\atlassian-jira-6.4.11-standalone\lib. For older versions of JIRA remove the one that is already there.
Create the JIRA database connection information in P:\dev\data\issue\jira\dbconfig.xml (see also Tuning Database Connections):
<?xml version="1.0" encoding="UTF-8"?>
<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type>mysql</database-type>
<schema-name></schema-name>
<jdbc-datasource>
<url>jdbc:mysql://localhost/jira?
useUnicode=true&amp;characterEncoding=UTF8&amp;connectionCollation=UTF8_bin</url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<username>jira-user</username>
<password>password</password>
<pool-min-size>20</pool-min-size>
<pool-max-size>20</pool-max-size>
<pool-max-wait>30000</pool-max-wait>
<pool-max-idle>20</pool-max-idle>
<pool-remove-abandoned>true</pool-remove-abandoned>
<pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
<validation-query>select 1</validation-query>
<min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
<time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
<pool-test-while-idle>true</pool-test-while-idle>
<validation-query-timeout>3</validation-query-timeout>
</jdbc-datasource>
</jira-database-config>
12.1.3. JIRA configuration
Edit the data directory by changing the following property
in the P:\dev\apps\issue\atlassian-jira-6.4.11-standalone\atlassian-jira\WEB-INF\classes\jira-application.properties file:
# The jira.home configuration must be set and specifies the directory
# in which JIRA will store its data files.
# This must be set to an absolute path. Relative paths are not allowed.
# Ensure that only one JIRA instance uses the selected JIRA Home.
#
jira.home = P:/dev/data/issue/jira
Note
It is possible to overwrite this value with JIRA_HOME (see also Section 12.1.5, “Windows service”).
Disable Secure Administrator Sessions by creating the following property
ra\jira-config.properties file:
in the P:\dev\data\issue\ji-
jira.websudo.is.disabled=true
Verify the installation by changing to cd /d P:\dev\apps\issue\atlassian-jira-6.4.11-standalone
and running bin\startup.bat.
Verify that the server is running in your browser at http://localhost:8063. The Server ID for this JIRA instance is
required to retrieve a new license from my.atlassian.com.
92
Issue Tracker
12.1.3.1. Required settings
You should see the JIRA setup wizard:
1. Application Properties:
• Application Title: freedumbytes.dev.net JIRA.
• Mode: Private.
• Base URL: http://freedumbytes.dev.net/jira and click Next.
• Automated Backups: Disable Automated Backups. TODO
2. Specify Your License Key:
• Your License Key: … and click Next.
3. Set Up Administrator Account:
• Fullname: JIRA Administrator.
• Email: [email protected].
• Username: admin.
• Password: password.
• Confirm Password: password and click Next.
4. Set Up Email Notifications:
• Configure Email Notifications: Now.
• Name: JIRA SMTP Server.
• From address: [email protected].
• Email prefix: [JIRA].
• Server Type: SMTP Host.
• Service Provider: Custom.
• Host Name: mail.freedumbytes.dev.net.
• Protocol: SMTP.
• SMTP Port: 25.
• Username: leave empty.
• Password: leave empty and click Finish.
12.1.3.2. User, groups & roles
User Management menu:
• Select Groups and in Add Group form type:
• Name: jira-system-administrators and click Add Group.
For jira-system-administrators select Edit Members:
• Under Add members to selected group(s) select user for group by clicking
• Check admin and click Select.
• Next click << Join.
.
• Select Users and click Add User:
• Username: jjasper.
• Password: password.
• Confirm: password.
• Full Name: Jene Jasper.
• Email: [email protected] and click Create and Edit Groups:
• In Available Groups select jira-system-administrators / jira-administrators / jira-developers and
click Join >> and << Return to viewing user 'Jene Jasper'.
• Select Global permissions in Add Permission form choose:
• Permission: JIRA System Administrators.
• Group: jira-system-administrators and click Add.
In JIRA Permissions form:
• For JIRA System Administrators select delete the jira-administrators and confirm Delete.
• Select User Default Settings and click Edit default values:
• Default outgoing email format: html.
• Notify users of their own changes: No and click Update.
And Apply the email format setting for existing users.
12.1.4. Apache configuration
Configure the JIRA application server to accept an ajp connection
on web context /jira
by editing the
configuration file P:\dev\apps\issue\atlassian-jira-6.4.11-standalone\conf\server.xml:
<Server port="8062"
address="127.0.0.1" shutdown="SHUTDOWN">
<Service name="Catalina">
93
Chapter 12.
…
<!-<Connector port="80098064 " address="127.0.0.1"
redirectPort="8443" enableLookups="false"
protocol="AJP/1.3" URIEncoding="UTF-8" />
-->
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps" …>
<Context path="/jira
…
</Service>
" docBase="${catalina.home}/atlassian-jira" …>
…
</Server>
Instruct Apache to proxy all URLs whose path portions begin with /jira/ using the following P:\dev\apps
\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# JIRA
Include ../apache-conf/httpd-jira.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-jira.conf:
<IfModule proxy_module>
<IfModule proxy_http_module>
#<IfModule proxy_ajp_module>
# ProxyPass /jira
ajp://localhost:8064/jira
# ProxyPassReverse /jira ajp://localhost:8064/jira
ProxyPass /jira
http://localhost:8063/jira
ProxyPassReverse /jira http://localhost:8063/jira
<Location /jira>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
#</IfModule>
</IfModule>
</IfModule>
When JIRA and the Apache HTTP Server are restarted you should be able to browse JIRA at http://
freedumbytes.dev.net/jira.
Tip
If the browser displays a 401 HTTP error then the Apache HTTP Server logged-in user doesn't
exist in JIRA or the password doesn't match.
12.1.4.1. Privacy Policy
Next configure if Analytics collects data about the usage of JIRA and sends it to Atlassian (see the privacy policy
for details).
94
Issue Tracker
12.1.5. Windows service
To restart automatically on Microsoft Windows create a service using an elevated command prompt as follows:
cd /d P:\dev\apps\issue\atlassian-jira-6.4.11-standalone
rename
rename
rename
rename
bin\tomcat7.exe tomcat7.exe.x86
bin\apr\tcnative-1.dll tcnative-1.dll.x86
bin\tomcat7.exe.x64 tomcat7.exe
bin\apr\tcnative-1.dll.x64 tcnative-1.dll
set JAVA_HOME=P:\dev\apps\prg\java-x64\jdk1.8.0_74
set CATALINA_HOME=P:\dev\apps\issue\atlassian-jira-6.4.11-standalone
bin\service.bat install jira
bin\tomcat7.exe //US//jira --DisplayName="freedumbytes.dev.net JIRA" ^
--Description="JIRA - Issue tracking and project management." ^
--Startup=auto
bin\tomcat7.exe //US//jira --JvmMx=768 --JvmMs=256 ^
++JvmOptions=-Djava.awt.headless=true;-Datlassian.standalone=JIRA
bin\tomcat7.exe //US//jira ++JvmOptions=-Dmail.mime.decodeparameters=true
Start it with net start jira.
Note
In case of an upgrade sc delete jira first (see also Section 1.1.5, “Task Manager replacement” in case of “The specified service has been marked for deletion.”).
Tip
As an alternative to change the additional settings of the JIRA service run: P:\dev\apps
\issue\atlassian-jira-6.4.11-standalone\bin\tomcat7w.exe //ES//jira such
as Java → Java Virtual Machine P:\dev\apps\prg\java\jdk1.8.0_74\jre\bin\server\jvm.dll.
Important
In case of a new jdk installation just run P:\dev\apps\issue\atlassian-jira-6.4.11-standalone\bin\tomcat7.exe
//US//jira
--Jvm
auto (when
JAVA_HOME is still pointing to the 64-bit version; see also Section 8.1.3.2, “Tomcat Manager”).
Verify the installation and the JVM memory usage at http://freedumbytes.dev.net/jira/secure/admin/ViewSystemInfo.jspa.
12.1.5.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net JIRA and select Properties → Log On to use This account
.\Tomcat. After password conformation click Apply and restart the service.
12.1.6. Global settings
System menu:
• Select General Configuration and click Edit Settings:
• Allow unassigned issues: On.
• Accept remote API calls: On (for Eclipse Mylyn plugin support) and click Update.
Note
When using Mylyn and “Submit failed” in Eclipse with following error message “JIRA
could not complete this action due to a missing form token.” disable Form Token Check-
95
Chapter 12.
ing by creating/editing the following property
ra\jira-config.properties file:
in the P:\dev\data\issue\ji-
jira.xsrf.enabled=false
jira.websudo.is.disabled=true
Important
Shut down JIRA first
ra-config.properties.
before
editing
P:\dev\data\issue\jira\ji-
• Under Advanced select Attachments and click Edit Settings:
• Attachment Path: Use Default Directory and click Update.
• Under Issue Features activate Time Tracking.
• Under Issue Features activate Issue Linking.
• Under User Interface select Look and Feel and click Edit Settings:
• Time Format: HH:mm.
• Day Format: EEEE HH:mm.
• Complete Date/Time Format: yyyy-MM-dd HH:mm.
• Day/Month/Year Format: yyyy-MM-dd.
• Check Use ISO8601 standard in Date and click Update.
• Under General Configuration click Advanced Settings and select every Value to be edited:
• jira.date.picker.java.format: yyyy-MM-dd and click Update.
• jira.date.picker.javascript.format: %Y-%m-%d.
• jira.date.time.picker.java.format: yyyy-MM-dd HH:mm.
• jira.date.time.picker.javascript.format: %Y-%m-%d %H:%M.
• Under User Interface select System Dashboard and click Add Gadget such as FishEye Charts.
Issues menu:
• Under Issue Types select Sub-Tasks and Enable Sub-Tasks.
12.1.7. Project
Projects menu:
• Select Projects and in Add Project form type:
• Name: Development Production Line manual.
• Key: DPLMNL.
• Project Lead: Jene Jasper and click Add.
Click Edit Project to supply a Description: DocBook about setting up a Production Development
Line. and click Update.
Under Roles for Default Assignee click
to change it to Unassigned and click Update.
Under Components:
• Name: manual with Description: The Short Story. and click Add.
Under Versions:
• Name: 2.0 Description: The complete picture. with expected Release Date 2011-08-31 and click
Add.
12.1.8. FishEye integration
12.1.8.1. Integration users
To auto-add the jira user (see also Section 7.1.4.1, “Authentication, authorization and access control”) in FishEye
just login with that user at http://freedumbytes.dev.net/fisheye/ and logout again.
Optionally at the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ select the User Settings →
Users and Edit user jira:
• Display name: JIRA Integration.
• Email: [email protected] and click Apply.
96
Issue Tracker
Next at the JIRA Admin GUI http://freedumbytes.dev.net/jira/secure/admin/user/UserBrowser.jspa Create User:
•
•
•
•
•
Username: fisheye.
Password: password.
Confirm: password.
Full Name: FishEye Integration.
Email: [email protected] and click Create.
12.1.8.2. Application links
At the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ select the Global Settings → Application Links and Create new link: http://freedumbytes.dev.net/jira. Disable I am an administrator on
both instances and click Continue. Ignore Create reciprocal link and click Close. Edit this new Application Link
freedumbytes.dev.net JIRA to change the Outgoing Authentication to Basic Access using the fisheye integration user from the prior paragraph and click Close.
Next at the JIRA Admin GUI Add-ons http://freedumbytes.dev.net/jira/plugins/servlet/applinks/listApplicationLinks Create new link: http://freedumbytes.dev.net/fisheye. Disable I am an administrator on both
instances and click Continue. Ignore Create reciprocal link and click Close. Edit this new Application Link freedumbytes to change:
• Application Details the Application Name to freedumbytes.dev.net FishEye.
• Outgoing Authentication to enable Basic Access using the jira integration user from the prior paragraph
and click Close.
Optionally Configure FishEye Server to switch Integration setup to FishEye integration only,
12.1.8.2.1. FishEye entity mappings
Optionally link a FishEye repository to a JIRA project via a project link. For example select Projects → Development Production Line manual → Settings → Configure Project Links → Add Link → freedumbytes.dev.net
FishEye and in the Enter link details form type:
• Type: FishEye Repository.
• Key: dpl-manual and click Create.
After this there should be something to see under the FishEye/Crucible entity mappings in the FishEye Configuration.
12.1.8.3. FishEye plugin upgrade
At the FishEye Admin GUI http://freedumbytes.dev.net/fisheye/admin/ select the Systems Settings → Manage
Add-ons to filter Action required and just Update or Update All.
Next at the JIRA Admin GUI Add-ons http://freedumbytes.dev.net/jira/plugins/servlet/upm#manage filter Manage add-ons that have Action required and just Update or Update All.
12.1.9. User profile
On the Dashboard page click on the logged-in user
for example:
at the top right of the menu bar and select Profile to edit
• Preferences.
• Navigator Columns.
97
98
Chapter 13.
Chapter 13. Repository Manager
13.1. Nexus
Nexus is a Maven repository manager, created to provide reliable access to artifacts required for development
and provisioning.
13.1.1. Resources
• Download Nexus.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: Nexus - HTTP Binding application-host / application-port /
nexus-work and Nexus - Windows service wrapper.conf / nexus.bat install.
Note
Or just run p:\dev\apps\editor\winmerge\WinMergeU.exe P:\dev\apps\repo\nexus-2.11.1-01\conf
P:\dev\apps\repo\nexus-2.11.4-01\conf to
copy the changes in for example nexus.properties,
Note
To reset Nexus Logging Configuration to the latest changes delete them from P:\dev
\data\repo\maven\nexus\conf P:\dev\apps\repo\nexus-2.11.4-01\conf
to manually copy those changes in for example logback.properties, logback-nexus.xml and logback-overrides.xml,
Note
And
run
p:\dev\apps\editor\winmerge\WinMergeU.exe
P:
\dev\apps\repo\nexus-2.11.1-01\bin\jsw\conf
P:\dev\apps\repo\nexus-2.11.4-01\bin\jsw\conf for wrapper.conf.
•
Books such as Repository Management with Nexus.
13.1.2. Nexus installation guide
Download the archive: nexus-2.11.4-01-bundle.zip [version 2.11.4-01].
Extract this .zip file to P:\dev\apps\repo.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and add the New system variables NEXUS_HOME and PLEXUS_NEXUS_WORK pointing to P:\dev\apps
\repo\nexus-2.11.4-01 and P:\dev\data\repo\maven\nexus.
13.1.2.1. HTTP Binding
Configure the container for Nexus
in
po\nexus-2.11.4-01\conf\nexus.properties:
the
Plexus
property
file
P:\dev\apps\re-
# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.
# Jetty section
application-port=80818067
application-host=0.0.0.0127.0.0.1
…
# Nexus section
nexus-work=${basedir}/../sonatype-work/nexusP:\\dev\\data\\repo\\maven\\nexus
99
Chapter 13.
runtime=${bundleBasedir}/nexus/WEB-INF
13.1.3. Windows service
To restart automatically on Microsoft Windows, create a Windows service. Use the Tanuki Java Service Wrapper
shipped with Nexus.
Edit the following entries
in the service wrapper configuration file P:\dev\apps\repo\nexus-2.11.4-01\bin\jsw\conf\wrapper.conf:
# Set the JVM executable
# (modify this to absolute path if you need a Java that is not on the OS path)
wrapper.java.command=javaP:\dev\apps\prg\java\jdk1.8.0_74\bin\java
# Additional JVM parameters (tune if needed, but match the sequence of numbers!)
# wrapper.java.additional.1=-XX:MaxPermSize=192m
wrapper.java.additional.21 =-Djava.io.tmpdir=./tmp
# wrapper.java.additional.3=-Djava.net.preferIPv4Stack=true
wrapper.java.additional.42 =-Dcom.sun.jndi.ldap.connect.pool.protocol="plain
ssl"
wrapper.java.additional.42 .stripquotes=TRUE
#wrapper.java.additional.5=-Xdebug
#wrapper.java.additional.6=-Xnoagent
#wrapper.java.additional.7=-Djava.compiler=NONE
#wrapper.java.additional.8=Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
#wrapper.java.additional.9=-XX:+HeapDumpOnOutOfMemoryError
wrapper.java.additional.3=-Xms128m
wrapper.java.additional.4=-Xmx1024m
#wrapper.java.additional.5=-Xrs
see also Section 3.1.3.1, “Standard Edition
Tools Reference”
…
#
#
#
#
#
#
#
Size Java memory, in MB (-Xms)
wrapper.java.initmemory=256
Size Java memory, in MB (-Xmx).
This option only supports a setting up to 4000 (4Gb).
If you need more, comment this option out
and use an explicit wrapper.java.additional option with -Xmx
wrapper.java.maxmemory=768
…
# Set up JSW Console
wrapper.console.title=Sonatype Nexusfreedumbytes.dev.net Nexus
…
# Set up JSW as NT Service (unused on other OSes)
wrapper.ntservice.name=nexus-webappnexus
wrapper.ntservice.displayname=freedumbytes.dev.net Nexus
wrapper.ntservice.description=Nexus is a Maven repository manager.
Register the Nexus service with the command in an elevated command processor: %NEXUS_HOME%\bin
\nexus.bat install. Start Nexus with net start nexus. A nexus.xml file should now be created in the
P:\dev\data\repo\maven\nexus\conf folder. Verify that the server is running in your browser at http://localhost:8067/nexus.
Note
In case of an upgrade sc delete nexus first (see also Section 1.1.5, “Task Manager replacement” in case of “The specified service has been marked for deletion.”).
Important
In case of a new jdk installation use an elevated command prompt just run net stop nexus
and net start nexus. Verify the upgrade at http://localhost:8067/nexus/#supporttools.
100
Repository Manager
13.1.3.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net Nexus and select Properties → Log On to use This account .\Tomcat. After password conformation click Apply and restart the service.
13.1.4. Apache configuration
To proxy Nexus add another Virtual Host on port 81 using the following P:\dev\apps\httpserver\apacheconf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# Nexus
Include ../apache-conf/httpd-nexus.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-nexus.conf for anonymous
access:
<IfModule proxy_module>
<IfModule proxy_http_module>
<IfModule proxy_module>
<IfModule proxy_http_module>
ProxyPass /nexus
http://localhost:8067/nexus
ProxyPassReverse /nexus http://localhost:8067/nexus
</IfModule>
</IfModule>
<Location /nexus>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
</IfModule>
</IfModule>
When the Apache HTTP Server is restarted you should be able to browse Nexus at http://freedumbytes.dev.net/
nexus.
13.1.5. Nexus configuration
13.1.5.1. Users
Log In with the admin and default password admin123. Select Security → Users to change the Email addresses
of the admin, anonymous and deployment users to for example [email protected].
Right click on the admin and deployment user to Set Password and Log Out.
To add additional (admin) users. Select Security → Users → Add… → Nexus User:
•
•
•
•
•
•
•
User ID: jjasper.
First Name: Jene.
Last Name: Jasper.
Email: [email protected].
Status: Active.
New Password and Confirm Password.
Role Management: Add and for example check Nexus Administrator Role and click OK followed by Save.
13.1.5.2. Server Administration
Log In with the admin and the new password. Select Administration → Server.
101
Chapter 13.
Configure the SMTP Settings:
•
•
•
•
•
Hostname: mail.freedumbytes.dev.net.
Port: 25.
Username: leave blank.
Password: leave blank.
System Email: [email protected].
Enable Application Server Settings:
• Base URL: http://freedumbytes.dev.net/nexus and click Save.
13.1.5.3. Capabilities
Optionally select Administration → Capabilities (see also Configuring Repository Health Check and Accessing
and Configuring Capabilities).
Configure the Health Check Configuration → Settings:
• Enabled: Checked.
• Configure for all proxy repositories: Checked.
13.1.5.4. Repositories
Activate downloading of the remote indexes for the proxy repositories that Nexus ships. Select Views/Repositories → Repositories and repeat the following step for Central, Apache Snapshots and Codehaus Snapshots:
• Left click on the repository and switch to the Configuration tab to set Download Remote Indexes: True and
click Save.
Select Administration → Scheduled Tasks → Refresh to check the Status of the Repair Repositories Index task
(see also NEXUS-431), that was started automatically. When the task is already finished it is possible to view the
information in Views/Repositories → System Feeds → System changes in Nexus.
When the repository indexing is finished it is possible to use Artifact Search and actually find something.
Important
All Codehaus services have been terminated.
13.1.5.4.1. Reinstate Public Snapshot Repositories
Recreate the separate Public Snapshot Repositories (see also NEXUS-3374) by selecting Views/Repositories →
Repositories → Add… → Repository Group with:
•
•
•
•
•
Group ID: public-snapshots.
Group Name: Public Snapshot Repositories.
Provider: Maven2.
Format: maven2.
Publish URL: true and click Save.
Select Views/Repositories → Repositories → Refresh → Public Snapshot Repositories and on the Configuration tab drag Apache Snapshots from the Available Repositories in Ordered Group Repositories and click Save.
For the Public Repositories on the Configuration tab remove Apache Snapshots from the Ordered Group
Repositories and click Save.
13.1.5.4.2. JBoss
Optionally configure the JBoss repository (see also JBBUILD-688) by selecting Views/Repositories → Repositories → Add… → Proxy Repository with:
•
•
•
•
•
Repository ID: jboss.
Repository Name: JBoss.
Provider: Maven2.
Repository Policy: Release.
Remote Storage Location: https://repository.jboss.org/nexus/content/repositories/releases/.
• Download Remote Indexes: True.
• Checksum Policy: StrictIfExists and click Save.
• Repository ID: jboss-thirdparty.
102
Repository Manager
•
•
•
•
Repository Name: JBoss 3rd party.
Provider: Maven2.
Repository Policy: Release.
Remote
Storage
Location:
https://repository.jboss.org/nexus/content/repositories/thirdparty-releases/.
• Download Remote Indexes: True.
• Checksum Policy: StrictIfExists and click Save.
Select Views/Repositories → Repositories → Refresh → Public Repositories and on the Configuration tab
drag JBoss from the Available Repositories somewhere below Central in Ordered Group Repositories and click
Save.
Then drag JBoss 3rd party from the Available Repositories just below JBoss in Ordered Group Repositories
and click Save.
13.1.5.4.3. Spring
Optionally configure the SpringSource Enterprise Repositories by selecting Views/Repositories → Repositories
→ Add… → Proxy Repository with:
•
•
•
•
•
•
•
Repository ID: spring-release.
Repository Name: SpringSource EBR - SpringSource Bundle Releases.
Provider: Maven2.
Repository Policy: Release.
Remote Storage Location: http://repository.springsource.com/maven/bundles/release/.
Download Remote Indexes: True.
Checksum Policy: StrictIfExists and click Save.
•
•
•
•
•
•
•
Repository ID: spring-external.
Repository Name: SpringSource EBR - External Bundle Releases.
Provider: Maven2.
Repository Policy: Release.
Remote Storage Location: http://repository.springsource.com/maven/bundles/external/.
Download Remote Indexes: True.
Checksum Policy: StrictIfExists and click Save.
•
•
•
•
•
•
•
Repository ID: spring-milestone.
Repository Name: SpringSource EBR – External Bundle Milestones.
Provider: Maven2.
Repository Policy: Release.
Remote Storage Location: http://repository.springsource.com/maven/bundles/milestone/.
Download Remote Indexes: True.
Checksum Policy: StrictIfExists and click Save.
Select Views/Repositories → Repositories → Refresh → Public Repositories and on the Configuration tab
drag SpringSource EBR - SpringSource Bundle Releases from the Available Repositories somewhere below
Central in Ordered Group Repositories.
Then drag SpringSource EBR - External Bundle Releases from the Available Repositories just below
SpringSource EBR - SpringSource Bundle Releases in Ordered Group Repositories.
Finally drag SpringSource EBR – External Bundle Milestones from the Available Repositories just below
SpringSource EBR - External Bundle Releases in Ordered Group Repositories and click Save.
13.1.5.5. Scheduled tasks
When the below mentioned tasks are configured it is possible to start extra unscheduled runs with Administration → Scheduled Tasks, right clicking on the desired task and selecting Run. Follow the task progress in Views/
Repositories → System Feeds → System changes in Nexus → Refresh.
13.1.5.5.1. Indexing
Configure a task to publish hosted releases index by selecting Administration → Scheduled Tasks → Add with:
•
•
•
•
•
•
•
Name: Publish hosted releases index.
Task Type: Publish Indexes.
Repository/Group: Releases (Repo).
Alert Email : [email protected].
Recurrence: Daily.
Start Date: Today.
Recurring Time: 22:00 and click Save.
Configure a task to reindex all repositories by selecting Administration → Scheduled Tasks → Add with:
103
Chapter 13.
•
•
•
•
•
•
•
•
Name: Reindex all repositories.
Task Type: Repair Repositories Index.
Repository/Group: All Repositories.
Alert Email : [email protected].
Recurrence: Weekly.
Start Date: Today.
Recurring Time: 00:00.
Selected Days: Sunday and click Save.
Configure a task to download all repositories indexes by selecting Administration → Scheduled Tasks → Add
with:
•
•
•
•
•
•
•
•
Name: Download all repositories indexes.
Task Type: Download Indexes.
Repository/Group: All Repositories.
Alert Email : [email protected].
Recurrence: Weekly.
Start Date: Today.
Recurring Time: 20:00.
Selected Days: Monday and click Save.
Configure a task to optimize all repositories indexes by selecting Administration → Scheduled Tasks → Add with:
•
•
•
•
•
•
•
•
Name: Optimize indexes.
Task Type: Optimize Repository Index.
Repository/Group: All Repositories.
Alert Email : [email protected].
Recurrence: Weekly.
Start Date: Today.
Recurring Time: 21:00.
Selected Days: Tuesday and click Save.
13.1.5.5.2. Cleanup
Configure a task to cleanup snapshots by selecting Administration → Scheduled Tasks → Add with:
•
•
•
•
•
•
•
•
•
•
•
•
Name: Cleanup snapshots.
Task Type: Remove Snapshots From Repository.
Repository/Group: All Repositories.
Minimum snapshot count: 1.
Snapshot retention (days): 7.
Remove if released: Checked.
Grace period after release (days) : 5.
Delete immediately: Checked.
Alert Email : [email protected].
Recurrence: Daily.
Start Date: Today.
Recurring Time: 19:00 and click Save.
Configure a task to cleanup interaction information by selecting Administration → Scheduled Tasks → Add with:
•
•
•
•
•
•
•
•
Name: Cleanup interaction information.
Task Type: Purge Nexus Timeline.
Purge older items than (days) : 30.
Alert Email : [email protected].
Recurrence: Monthly.
Start Date: Today.
Recurring Time: 23:00.
Days: Last and click Save.
Configure a task to cleanup unused items by selecting Administration → Scheduled Tasks → Add with:
• Name: Cleanup unused items.
Note
But uncheck Enable for now.
• Task Type: Evict Unused Proxied Items From Repository Cache.
• Repository/Group: All Repositories.
104
Repository Manager
•
•
•
•
•
•
Evict items older than (days): 360.
Alert Email : [email protected].
Recurrence: Monthly.
Start Date: Today.
Recurring Time: 08:00.
Days: 1 and click Save.
Configure a task to cleanup trash by selecting Administration → Scheduled Tasks → Add with:
•
•
•
•
•
•
•
Name: Cleanup trash.
Task Type: Empty Trash.
Purge items older than (days): 7.
Alert Email : [email protected].
Recurrence: Daily.
Start Date: Today.
Recurring Time: 22:30 and click Save.
13.1.6. Maven integration
13.1.6.1. Artifact repository
Configure Maven to use the Nexus Repository with the following mirror settings
in the Maven configuration file P:\dev\apps\build\apache-maven-3.3.9\conf\settings.xml to correspond with in the
Views/Repositories → Repositories available Repository Path of the Public Snapshot Repositories and the
Public Repositories:
<mirrors>
<mirror>
<id>nexus-public-snapshots</id>
<mirrorOf>public-snapshots.dev.net </mirrorOf>
<url>
http://freedumbytes.dev.net/nexus/content/groups/public-snapshots
</url>
</mirror>
<mirror>
<id>nexus-central</id>
<mirrorOf>* </mirrorOf>
<url>http://freedumbytes.dev.net/nexus/content/groups/public</url>
</mirror>
</mirrors>
Configure Maven to use the Nexus Public Repositories by default (see also * mirrorOf
) with the following profile
and activateProfile settings in the Maven configuration file P:\dev\apps\build\apachemaven-3.3.9\conf\settings.xml:
<profiles>
<profile>
<id>development </id>
<repositories>
<repository>
<id>central.dev.net</id>
<url>
http://freedumbytes.dev.net/nexus/content/groups/public
</url> <!-- (see
) -->
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central.dev.net</id>
<url>
http://freedumbytes.dev.net/nexus/content/groups/public
</url> <!-- (see
) -->
<releases>
<enabled>true</enabled>
</releases>
105
Chapter 13.
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>development</activeProfile>
</activeProfiles>
Important
The repositories defined in the development profile have releases as well as snapshots enabled because the Views/Repositories → Repositories for the Public Repositories contains
the hosted Releases (internal releases), 3rd party and Central as well as the hosted Snapshots
(internal snapshots). The updatePolicy is set to always to make sure that from the hosted
internal snapshot repository the latest version is used.
Configure Maven to use the Nexus Public Snapshot Repositories by request (see also public-snapshots.dev.net
mirrorOf ) with the following profile settings in the Maven configuration file P:\dev\apps\build\apachemaven-3.3.9\conf\settings.xml:
<profiles>
…
<profile>
<id>public-snapshots</id>
<repositories>
<repository>
<id>public-snapshots.dev.net</id>
<url>
http://freedumbytes.dev.net/nexus/content/groups/public-snapshots
</url> <!-- (see
) -->
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public-snapshots.dev.net</id>
<url>
http://freedumbytes.dev.net/nexus/content/groups/public-snapshots
</url> <!-- (see
) -->
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
Important
The url entry host must match the mirrorof entry otherwise Maven will look in the Nexus
public area because of its * mirrorOf setting.
106
Repository Manager
Note
The updatePolicy is set to always but for proxied snapshot repositories the actual version
is determined by Artifact Max Age setting (default value of 1440 minutes = 24 hours) of that
particular snapshot repository in Nexus.
For an existing pom.xml run from the command line mvn help:active-profiles and mvn -P public-snapshots help:active-profiles to verify these settings.
13.1.6.2. Artifact deployment
Configure Maven projects to use the Nexus Repository for deployments with the following distributionManagement repository settings - in the Maven project pom.xml to correspond with in the Views/Repositories →
Repositories available Repository Path of the hosted Releases and Snapshots repositories:
<distributionManagement>
<repository>
<id>nexus-releases</id> <!-- (see
) -->
<name>Internal Releases</name>
<url>http://freedumbytes.dev.net/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id> <!-- (see
) -->
<name>Internal Snapshots</name>
<url>http://freedumbytes.dev.net/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
Configure Maven to use the Nexus Repository deployment user with the following server settings - in the
Maven configuration file P:\dev\apps\build\apache-maven-3.3.9\conf\settings.xml to correspond
with in the Security → Users available User ID with Nexus Deployment Role:
<servers>
<server>
<id>nexus-releases </id>
<username>deployment</username>
<password>password</password>
</server>
<server>
<id>nexus-snapshots </id>
<username>deployment</username>
<password>password</password>
</server>
<server>
<id>nexus-thirdparty </id>
<username>deployment</username>
<password>password</password>
</server>
</servers>
Note
It is possible to encrypt the password using Section 4.2.6, “Password Encryption”.
Important
In case of partial deployments, with the maven release plugin for instance, the retries will get
HTTP 400 errors. Therefore select Views/Repositories → Repositories → Releases → Configuration and change the Deployment Policy to Allow Redeploy.
13.1.6.3. Third-party artifacts
As an alternative to adding a missing third-party artifact from the command line with:
107
Chapter 13.
mvn deploy:deploy-file -DrepositoryId=nexus-thirdparty (see
) ^
-Durl=http://freedumbytes.dev.net/nexus/content/repositories/thirdparty ^
-DgeneratePom=true ^
-DgroupId=… -DartifactId=… -Dversion=… -Dpackaging=… ^
-Dfile=…
select Views/Repositories → Repositories → 3rd party and on the Artifact Upload tab configure the Group,
Artifact and Version (GAV) settings for the third-party artifact.
108
Chapter 14.
Chapter 14. Continuous Integration
14.1. Jenkins
In a nutshell, Jenkins (formerly known as Hudson) provides an easy-to-use so-called continuous integration
system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain
a fresh build. The automated, continuous build increases the productivity.
14.1.1. Resources
• Download Jenkins and plugins.
• Alternatives: Hudson and Bamboo.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: Jenkins - Installation guide Tomcat webapps.
• Jenkins Documentation such as Plugins, Securing, Extend and Fingerprint.
• Jenkins Features Controlled with System Properties.
•
Quick overview of Continuous Integration by Martin Fowler.
• Jenkins CI: The Origins of Butlers, Build Masters and Bowties.
14.1.2. Jenkins installation guide
Download the latest archive: jenkins.war [version 1.648].
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and add a New system variable JENKINS_HOME pointing to P:\dev\data\ci\jenkins. You need to
reboot the server for the Path setting to take effect.
Deploy the .war in Tomcat by dropping it into the directory P:\dev\apps\webserver\apachetomcat-8.0.26\webapps.
Note
Stop Tomcat service when Jenkins doesn't restart properly because the P:\dev\apps\webserver\apache-tomcat-8.0.26\webapps\jenkins could not be cleaned completely. After Tomcat is stopped just delete the folder webapps\jenkins and restart Tomcat service.
14.1.2.1. Maven integration
When using Maven with password encryption it will always look for the file settings-security.xml in the
fixed location %USERPROFILE%\.m2. Therefore make sure to create one for the Log On Windows user with a
copy of for example C:\Users\jjasper\.m2\settings-security.xml into C:\Users\tomcat\.m2.
Important
This still may not be enough when using for example truezip-maven-plugin which fails
with “IOException: Unable to create P:\dev\data\ci\jenkins\jobs\…\${project.artifactId}${project.version}.war\extras” trying to copy additional files into a war. To fix this rightclick on the directory P:\dev\data\ci\jenkins\jobs and select Properties → Security →
Edit… → Users (COMPUTERNAME\Users) to allow Modify and thus Write and click OK.
14.1.3. Apache configuration
Instruct Apache to proxy all URLs whose path portions begin with /jenkins/ using the following P:\dev\apps
\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
109
Chapter 14.
</Proxy>
# Jenkins
Include ../apache-conf/httpd-jenkins.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-jenkins.conf:
<IfModule proxy_module>
<IfModule proxy_ajp_module>
AllowEncodedSlashes NoDecode
ProxyPass /jenkins
ajp://localhost:8069/jenkins nocanon
ProxyPassReverse /jenkins ajp://localhost:8069/jenkins
<Location /jenkins>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
</IfModule>
</IfModule>
Note
The entries at
are required to suppress the message “It appears that your reverse proxy set
up is broken.” on the Manage Jenkins page.
When the Apache HTTP Server is restarted you should be able to browse Jenkins at http://freedumbytes.dev.net/
jenkins.
14.1.4. Jenkins configuration
14.1.4.1. System
Select Jenkins → Manage Jenkins → Configure Global Security or type config in the search box to set:
• Enable security and configure Access Control:
• Security Realm: Delegate to servlet container.
• Authorization: Logged-in users can do anything.
• Prevent Cross Site Request Forgery exploits: Default Crumb Issuer (see also Section 8.1.5.1, “Remote
authentication”) and click Save.
Select Jenkins → Manage Jenkins → Configure System or type config in the search box to set:
•
•
•
•
•
•
•
•
# of executors: 6 (where a good value to start with would be the number of processors on your system).
Quiet period: 30.
SCM checkout retry count: 3.
Add Ant installation:
• Name: ANT_HOME.
• Disable Install automatically.
• ANT_HOME: P:\dev\apps\build\apache-ant-1.9.6.
Add Maven installation:
• Name: M2_HOME.
• Disable Install automatically.
• MAVEN_HOME: P:\dev\apps\build\apache-maven-3.3.9.
Maven Project Configuration:
• Optionally disable Help make Jenkins better by sending anonymous usage statistics and crash reports
to the Jenkins project.
Jenkins Location:
• Jenkins URL: http://freedumbytes.dev.net/jenkins/.
• System Admin e-mail address: [email protected].
E-mail Notification:
• SMTP server: mail.freedumbytes.dev.net.
• Default user e-mail suffix: @company.org and click Save.
14.1.4.2. Plugins
Select Jenkins → Manage Jenkins → Manage Plugins. Switch to the Advanced tab and click Check now to find
updates. When done Go back to update center and switch to the Available tab to check (one-at-a-time works
best) for example the following plugins (the other project information will be handled with Chapter 17, Quality
Assurance):
110
Continuous Integration
•
•
•
•
•
•
•
•
•
•
•
All Changes shows all changes which influenced the builds of a project.
Change Log History copied to a later build when a build is deleted.
Dashboard View provides a portal-like view for the Jenkins instance.
Modern Status provides an alternative set of status and action icons to provide a fresh look to Jenkins and to
be friendly for all users i.e. iconic not just color indication.
Build Trigger Badge displays icon representing the cause of a build directly in the build history. It lets you
quickly know which cause triggered a build.
Timestamper adds timestamps to the Console Output with the option to switch to between System clock
time and Elapsed time.
Dependency Graph View of the Jenkins projects using Graphviz. Displays the dependencies between jobs
based on versions in the dependencies of the project pom.xml. Thus shows which components currently use
this snapshot/HEAD variant of the project. Useful to see which projects will be effected by check-ins and release of a certain project.
Git allows use of Git as a build SCM.
JIRA integration (see also Section 14.1.5, “JIRA integration”).
Configuration Slicing to perform mass configuration of select project properties, including email, timer, discard
old builds, and Maven configuration.
Obsolete SonarQube Scanner integration (see also Section 17.2.8, “Jenkins integration”).
After successful Install of all selected plugins reload Jenkins at http://freedumbytes.dev.net/tomcat/manager/html for the latest version of the plugin to show up in the Installed tab.
Note
To manual install the plugin when Jenkins is deployed on Tomcat it is also possible to just copy
the .hpi file to P:\dev\data\ci\jenkins\plugins.
14.1.4.2.1. Configure Plugins
Select Jenkins → Manage Jenkins → Configure System or type config in the search box to set:
• Dependency Graph Viewer Configuration:
• Check Enable rendering with graphviz.
• Dot Executable Path: P:\dev\apps\editor\graphviz\bin\dot.exe.
14.1.4.3. Subversion authentication
Setup Subversion authentication in Jenkins at http://freedumbytes.dev.net/jenkins/scm/SubversionSCM/enterCredential:
• Repository URL: http://freedumbytes.dev.net/svn-repo.
• Username/password authentication:
• User name: jenkins.
• Password: password.
Note
When creating a new job for the Subversion scm you would otherwise have been presented
with a link in “Maybe you need to enter credential?” to supply them for the specified URL.
Or alternatively use credentials (see also Section 14.1.4.4, “Git authentication”):
111
Chapter 14.
14.1.4.4. Git authentication
For Git authentication by Jenkins look at _netrc setup in Section 8.1.3.1.1, “netrc” or select Jenkins → Manage
Jenkins → Manage Credentials and Add Credentials → Username with password:
•
•
•
•
Scope: Global.
Username: jenkins.
Password: password.
Description: apache proxy user and click Save.
14.1.5. JIRA integration
JIRA Plugin for Jenkins and Jenkins Plugin for JIRA integrate Jenkins and Hudson/Jenkins CI Servers with JIRA
to display builds in JIRA.
14.1.5.1. Jenkins Plugin installation guide
Download the archive: jenkins-jira-plugin-1.4.5.hpi [version 1.4.5].
Just drop the downloaded *.hpi or *.jpi file into the P:\dev\data\ci\jenkins\plugins directory and rename
to jenkins-jira-plugin.hpi. You will then need to restart Jenkins (many containers let you do this without
restarting the container).
Next at the JIRA Admin GUI Add-ons http://freedumbytes.dev.net/jira/plugins/servlet/upm/marketplace/featured Find new add-ons with Search the Marketplace for jenkins and just Install.
Note
In case of an issue (see also JJI-134) with the latest version download an older *.obr version and
select Add-ons → Manage add-ons → Upload add-on to install this prior version.
14.1.5.2. Application links
At the JIRA Admin GUI Add-ons http://freedumbytes.dev.net/jira/plugins/servlet/applinks/listApplicationLinks
Create new link: http://freedumbytes.dev.net/jenkins. In pop-up Configure Application URL click Continue to configure:
• Application Name: freedumbytes.dev.net Jenkins.
• Application Type: Jenkins and click Continue.
Edit this new Application Link freedumbytes.dev.net Jenkins to change:
• Outgoing Authentication to enable Basic Access reusing the jira integration user from the section Section 12.1.8.1, “Integration users” and click Close.
Next at the JIRA Admin GUI Add-ons http://freedumbytes.dev.net/jira/secure/admin/ConfigureJenkinsIntegration!default.jspa Jenkins Configuration select Actions to Auto enable new Jobs and enable the already listed
jobs followed by Actions → Refresh Job List to Sync Jobs.
14.1.6. Slave configuration
A butler is a domestic worker in a large household. A valet is a servants who serve as personal attendants to their
employer.
Select Jenkins → Manage Jenkins → Manage Nodes to add:
• New Node with:
• Node name: jeeves.
• As Dumb Slave and click OK.
Configure this new node as follows:
•
•
•
•
•
•
# of executors: 6 (where a good value to start with would be the number of processors on your system).
Remote root directory: P:\dev\data\ci\jeeves.
Labels: windows.
Usage: Utilize this node as mush as possible.
Launch method: Launch slave agents via Java Web Start.
Availability: Keep this slave on-line as much as possible and click Save.
Select Jenkins → Build Executor Status → jeeves to connect the slave to Jenkins using Launch agent from
browser on slave by clicking the orange Launch button. This will download the file slave-agent.jnlp. To
install the slave jeeves run this file and supply proxy credentials:
112
Continuous Integration
•
•
•
•
User name: jjasper.
Password: password.
Labels: windows.
Leave Save this password in your password list unchecked and click OK → Run → File → Install as a service.
Note
Don't forget to create the slave folder first with mkdir P:\dev\data\ci\jeeves.
Edit the generated id
and name
in P:\dev\data\ci\jeeves\jenkins-slave.xml to insert /tomcat :
<service>
<id>jenkinsslave-P__dev_data_ci_jeeves </id>
<name>Jenkins Slavefreedumbytes.dev.net Jeeves </name>
<description>
This service runs a slave for Jenkins continuous integration system.
</description>
<executable>P:\dev\apps\prg\java\jre1.8.0_74\bin\java.exe</executable>
<arguments>
<!-- -Xrs see also Section 3.1.3.1, “Standard Edition Tools Reference” -->
-jar "%BASE%\slave.jar" -jnlpUrl
http://freedumbytes.dev.net/jenkins/computer/jeeves/slave-agent.jnlp
-secret …
</arguments>
<logmode>rotate</logmode>
<onfailure action="restart" />
</service>
To activate the changes reinstall the service with the following commands in an elevated command processor (see
also Section 1.1.5, “Task Manager replacement” in case of “WMI.WmiException: ServiceMarkedForDeletion”):
cd /d P:\dev\data\ci\jeeves
jenkins-slave.exe stop
jenkins-slave.exe uninstall
del *.log
jenkins-slave.exe install
jenkins-slave.exe start
services.msc
Important
In case of a new jdk installation use an elevated command prompt just run net stop jeeves
and net start jeeves. Verify the upgrade at http://freedumbytes.dev.net/jenkins/computer/jeeves/systemInfo.
Note
The jdk upgrade for Jenkins master is handled when the upgrade is done for Tomcat and can
be verified at http://freedumbytes.dev.net/jenkins/systemInfo.
Next fix the following error in P:\dev\data\ci\jeeves\jenkins-slave.err.log:
Failing to obtain http://freedumbytes.dev.net/jenkins/computer/jeeves/slaveagent.jnlp?encrypt=true
java.io.IOException: Failed to load …: 401 Unauthorized
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:275)
at hudson.remoting.Launcher.run(Launcher.java:219)
at hudson.remoting.Launcher.main(Launcher.java:192)
Waiting 10 seconds before retry
Which is also displayed in http://freedumbytes.dev.net/jenkins/computer/jeeves/ node page as “Connection was
broken” and P:/dev/logs/httpserver/freedumbytes.dev.net-access.log:
113
Chapter 14.
[201605 01:11:16] "GET /jenkins/computer/jeeves/slave-agent.jnlp?encrypt=true
HTTP/1.1" 401 381 "-" "Java/1.8.0_74"
Just allow anonymous access for the local area network by editing P:\dev\apps\httpserver\apache-conf
\httpd-jenkins.conf:
<IfModule proxy_module>
<IfModule proxy_ajp_module>
…
<Location /jenkins>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
<Location /jenkins/git/notifyCommit>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
<Location /jenkins/computer/jeeves/slave-agent.jnlp>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
</IfModule>
</IfModule>
After restarting jeeves fix the next error in P:\dev\data\ci\jeeves\jenkins-slave.err.log:
May 07, 2016 1:25:28 AM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: jeeves
May 07, 2016 1:25:28 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
May 07, 2016 1:25:28 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://freedumbytes.dev.net/jenkins/]
May 07, 2016 1:25:28 AM hudson.remoting.jnlp.Main$CuiListener error
SEVERE: http://freedumbytes.dev.net/jenkins/tcpSlaveAgentListener/ is invalid:
401 Unauthorized
java.lang.Exception: …/tcpSlaveAgentListener/ is invalid: 401 Unauthorized
at hudson.remoting.Engine.run(Engine.java:215)
See also P:/dev/logs/httpserver/freedumbytes.dev.net-access.log:
[20160507 01:25:27] "GET …/computer/jeeves/slave-agent.jnlp?encrypt=true
HTTP/1.1" 200 736 "-" "Java/1.8.0_74"
[20160507 01:25:28] "GET …/tcpSlaveAgentListener/ HTTP/1.1" 401 381 "-"
"Java/1.8.0_74"
Again allow anonymous access for the local area network by editing P:\dev\apps\httpserver\apache-conf
\httpd-jenkins.conf:
<IfModule proxy_module>
<IfModule proxy_ajp_module>
…
<Location /jenkins/computer/jeeves/slave-agent.jnlp>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
<Location /jenkins/tcpSlaveAgentListener>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
</IfModule>
</IfModule>
114
Continuous Integration
Now after restarting jeeves check P:\dev\data\ci\jeeves\jenkins-slave.err.log:
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main createEngine
INFO: Setting up slave: jeeves
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://freedumbytes.dev.net/jenkins/]
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to freedumbytes.dev.net:49403
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP2-connect
May 07, 2016 1:38:02 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected
See also P:/dev/logs/httpserver/freedumbytes.dev.net-access.log:
[20160507 01:38:01] "GET …/computer/jeeves/slave-agent.jnlp?encrypt=true
HTTP/1.1" 200 736 "-" "Java/1.8.0_74"
[20160507 01:38:02] "GET …/tcpSlaveAgentListener/ HTTP/1.1" 200 12 "-"
"Java/1.8.0_74"
Note
And access to slave-agnet-jnlp is still not possible without the secret code:
Figure 14.1. Jenkins Slave Agent
Optionally select Jenkins → Manage Jenkins → Manage Nodes to change:
• master → Configure with:
• # of executors: 2.
• Labels: master.
• Usage: Only build jobs with label restrictions matching this node and click Save.
Historically, Jenkins master and slaves behaved as if they altogether form a single distributed process. This means
a slave can ask a master to do just about anything within the confinement of the operating system, such as accessing files on the master or trigger other jobs on Jenkins. Should you use Slave To Master Access Control Jenkins
→ Manage Jenkins → Configure Global Security and check Enable Slave → Master Access Control.
14.1.6.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net Jeeves and select Properties → Log On to use This account .\Tomcat. After password conformation click Apply and restart the service.
115
116
Chapter 15.
Chapter 15. Integrated Development
Environment
15.1. Eclipse
Eclipse is an open source community whose projects are focused on building an open development platform
comprised of extensible frameworks, tools and runtimes for building, deploying and managing software across
the lifecycle.
15.1.1. Resources
• Download or Upgrading Eclipse .
• Upgrade checklist:
• Related products: Plugins installation & configuration guide.
• References: -.
• Integration configuration changes: Plugins Eclipse - installation guide vm / javaagent lombok /
eclipse.exe -initialize / osgi.instance.area.default, Eclipse - Configuration and Eclipse encoding.
• Eclipse Tutorials, Articles and plugins: EGit, JGit, Mylyn, Subclipse, M2Eclipse.
• Git version control with Eclipse (EGit).
•
Developing with Eclipse & Maven.
• Unicode/UTF-8 in your Eclipse Java projects. ResourceBundle Editor plugin is for editing Java resource bundles.
It lets you manage all localized .properties files in one screen. Some of its features include sorted keys, warning
icons on missing keys/values, conversion to/from Unicode, hierarchical view of keys, and more. UTF-8 encoding
and Spring message sources.
15.1.2. Eclipse installation guide
Download the archive: eclipse-jee-mars-2-win32-x86_64.zip [version 4.5.2].
Extract this .zip file to P:\dev\apps\ide.
Now rename P:\dev\apps\ide\eclipse to P:\dev\apps\ide\eclipse-4.5.2.
Configure
the
vm
settings
\eclipse-4.5.2\eclipse.ini:
(and
windows
processes)
-
in
P:\dev\apps\ide
-startup
…
--launcher.library
…
-product
org.eclipse.epp.package.jee.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
P:/dev/apps/prg/java-x64/jdk1.8.0_74/jre/bin/server/jvm.dll
--launcher.appendVmargs
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
Note
Or when upgrading just run p:\dev\apps\editor\winmerge\WinMergeU.exe P:\dev
\apps\ide\eclipse-4.5.2\eclipse.ini P:\dev\apps\ide\eclipse-4.5.1.
117
Chapter 15.
Initialize the Eclipse configuration with P:\dev\apps\ide\eclipse-4.5.2\eclipse.exe -initialize.
Configure the user's area and the default workspace in P:\dev\apps\ide\eclipse-4.5.2\configuration
\config.ini:
[email protected]/workspaceC\:/workspace-4.5.2
For ease of use create a shortcut on the Quick Launch Toolbar by dragging eclipse.exe from P:\dev\apps
\ide\eclipse-4.5.2 onto it. Click this shortcut to start Eclipse with this now default Workspace at C:\workspace-4.5.2.
15.1.3. Eclipse upgrading
Figure 15.1. Eclipse Updates Available
Tip
In case of a newer version of the Eclipse IDE itself create copies of the prior one to for example
P:\dev\apps\ide\eclipse-4.5.2 and also its workspace to C:\workspace-4.5.2. Edit
any shortcut on the Quick Launch Toolbar according. Click this shortcut to start Eclipse and
switch to the new default Workspace at C:\workspace-4.5.2.
Figure 15.2. Eclipse prior version
Click on the Updates Available popup or:
• Select Help → Check for Updates:
118
Integrated Development Environment
Figure 15.3. Eclipse Available Updates
• Check the ones that must be installed and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Note
A second restart of Eclipse is necessary to show to latest splash screen:
Figure 15.4. Eclipse latest version
Note
To revert an installation select Help → About Eclipse → Installation Details → Installation
History and move from Current Installation down and click Revert.
119
Chapter 15.
Figure 15.5. Eclipse Installation History
15.1.4. Eclipse configuration
Set the following Code Style preferences at Window → Preferences → Java → Code Style:
• Select Clean Up and click Edit for Active profile: Eclipse [built-in] to roll your own Profile name
freedumbytes.dev.net. Export those Clean Up settings as eclipse.codestyle.cleanup.xml.
• Select Formatter and click Edit for Active profile: Eclipse [built-in] to roll your own Profile name
freedumbytes.dev.net. Export the Formatter settings as eclipse.codestyle.formatter.xml.
120
Integrated Development Environment
Tip
To turn the formatter off and on use @formatter:off and @formatter:on.
• Select Organize Imports and click New for the company package net.dev.freedumbytes. Export the Organize Import settings as eclipse.importorder. And change the number of imports needed for * to 0.
By the way the shortcuts for formatting source and organizing imports are Ctrl+Shift+F and Ctrl+Shift+O.
Tip
To activate formatting and import organizing when the file is saved select Window → Preferences → Java → Editor → Save Actions and check Perform the selected actions on save for
Format source code → Format edited lines and Organize imports.
Important
Unless you are going to use Lombok then select Format source code → Format all lines (and
just use aforementioned @formatter) to avoid “ArrayIndexOutOfBoundsException: -1” during
CleanUpPostSaveListener on Ctrl+S.
Caution
Do not run the Additional actions because it can be expensive and slow down the workbench
and you might want to preview those changes before accepting them (see also Keep your code
clean with Eclipse).
To use the same settings for the other editors select Window → Preferences and type filter text “indent”:
• Editor for CSS, HTML and XML:
• Line width 256.
• Indent using spaces.
• Indentation size 2.
To disable auto folding at Window → Preferences → Java → Editor → Folding and uncheck all elements under
Initially fold these elements.
Change code completion in Window → Preferences → Java → Editor → Content Assist to Completion overwrites.
Optionally select Window → Preferences and type filter text “typing” and uncheck Tab key adjusts the indentation of the current line for Editor for Java and JavaScript. Don't forget to Apply the changes.
15.1.4.1. Perspectives
Set the following Perspective preferences:
• Left click on the icon Open Perspective to add the Java shortcut and the
cut.
• Right click on the icon Java to no longer Show Text.
• Optionally right click on the icon Java EE to Close it.
Team Synchronizing short-
Use Ctrl+F8 to cycle through the perspectives.
15.1.4.2. Views
Open the view
Package Explorer with Alt+Shift+Q, P and left click on the icon
following changes:
local menu to make the
• Package Presentation → Flat.
• Filters… and check Libraries from external.
• Top Level Elements → Working Sets.
121
Chapter 15.
Tip
The shortcut for the local menu is Ctrl+F10 when the view is active. This is also the shortcut
for the ruler menu in editors.
Cycle through the views to Outline using Ctrl+F7. This view can be kept closed (unless you are going to use
Lombok) because Ctrl+O shows the outline of the current source when needed. And Ctrl+F3 shows the outline
at the current cursor position.
Tip
Instead of clicking through the view
Package Explorer just open the resources with
Ctrl+Shift+R or the java types with Ctrl+Shift+T. Now in the editor click Alt+Shift+W and select
Package Explorer to locate it in that view, should you be interested in the files at the
same location.
The view
Console can be opened with Alt+Shift+Q, C.
15.1.4.3. Editors
Useful general editor shortcuts:
•
•
•
•
Use F12 to jump back to the last active editor from any view and Ctrl+F6 to cycle through the editors.
With Alt+Left and Alt+Right it is possible to move through the file history.
Goto line with Ctrl+L.
Search in files with Incremental Find Ctrl+J and typing the search text. Find next occurrence with Ctrl+K and
the prior one with Ctrl+Shift+K.
• Search in workspace with Ctrl+H.
Tip
Because the Java shortcut for finding references is easier to use (see also Java editor shortcuts [122] below) Customize… the Search popup by unchecking Java Search, JavaScript
Search, Plug-in Search and Remote Search (that option will still be available through the
Search menu).
When working in Ctrl+M maximized mode and a search result is selected this resource is also opened in maximized mode. Simply switch back to the search view with Ctrl+F7. Use Delete to remove search results from
the tree. Navigate to the prior search result with Ctrl+, and the next search result with Ctrl+..
Tip
To exclude unused working sets or projects in the workspace from search results and other
views just Close Project or the complete working set in the view Package Explorer.
Note
When encountering the following error “An internal error occurred during: Items filtering.
Class file name must end with .class” during search, close Eclipse:
• Delete <workspace>/.metadata/.plugins/org.eclipse.jdt.core/*.index.
• Delete
<workspace>/.metadata/.plugins/org.eclipse.jdt.core/
savedIndexNames.txt.
Useful Java editor shortcuts:
• Goto declaration with F3.
• Find references in workspace with Ctrl+Shift+G.
• Find declarations in workspace with Ctrl+G.
122
Integrated Development Environment
• Popup type hierarchy with Ctrl+T.
• Change case to lower Ctrl+Shift+Y or upper Ctrl+Shift+X.
Spell checking is supported by Eclipse and when you see a squiggly mark place the cursor on the word and press
Ctrl+1 to view the correction proposals.
Tip
Ctrl+Shift+L opens the shortcuts preference page.
15.1.5. Plugins installation & configuration guide
Install the following plugins.
Note
Should a plugin Update Site only list an earlier version try the above described Eclipse upgrading option. This resulted in the latest version for BIRT (see also Section 15.1.5.8, “Memory Analyzer”).
It is also possible to search online at http://marketplace.eclipse.org/ and drag to install:
Figure 15.6. Eclipse Marketplace Drag to Install
15.1.5.1. Lombok
Project Lombok (features) to spice up your java by Reducing Boilerplate Code.
Download the archive: lombok.jar [version 1.16.8].
Copy this .jar file to P:\dev\apps\ide. Edit
follows:
in P:\dev\apps\ide\eclipse-4.5.2\eclipse.ini as
…
-vmargs
-Dosgi.requiredJavaVersion=1.7
-Xms256m
-Xmx1024m
-javaagent:P:/dev/apps/ide/lombok.jar
Verify installation with Help → About Eclipse which should list Lombok now also.
Tip
When using Lombok the getters and setters are no longer available in the code. To be able to
find references in the workspace (Ctrl+Shift+G) you are going to need the Outline view. To
save space just drag it next to the Task List tab.
123
Chapter 15.
15.1.5.2. EGit
EGit [version 4.3.0] is an Eclipse Team provider for the Git version control system. Git is a distributed SCM,
which means every developer has a full copy of all history of every revision of the code, making queries against
the history very fast and versatile.
JGit [version 4.3.0] is the Java implementation of Git. It is a library, that also can be used in your own applications.
It also provides some sort of CLI operations. EGit on the other side is the Eclipse team provider plugin for Git,
which uses JGit as Git implementation. Simplified you could say EGit is the UI part, and JGit the background part.
JGit doesn't depend on EGit, but EGit does depend on JGit.
Install the plugin EGit in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/egit/updates/ with Name EGit P2 Repository and click Ok.
• Select to Work with: EGit Update Site - http://download.eclipse.org/egit/updates/.
• Select the following components:
• Eclipse Git Team Provider [4.3.0]
• Eclipse Git Team Provider - Task focused interface [4.3.0]
• Command Line Interface for Java implementation of Git [4.3.0]
• Java implementation of Git [4.3.0]
• Java implementation of Git - optional Http support using Apache httpclient [4.3.0] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Important
Should the Commit Message in the Git Staging view not match with the curent Mylyn Task
just copy its details:
Figure 15.7. Eclipse Mylyn Task List view
after that paste the correct details:
124
Integrated Development Environment
Figure 15.8. Eclipse EGit Staging view
15.1.5.2.1. EGit configuration
Set the following preferences at Window → Preferences:
• Select Team → Git and as Default Repository folder enter C:\dev\projects and click OK.
15.1.5.3. Subclipse
Subclipse [version 1.10.13] is an Eclipse Team Provider plug-in providing support for Subversion within the
Eclipse IDE.
Install the plugin Subclipse in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://subclipse.tigris.org/update_1.10.x/ with Name Subclipse 1.10.x
Update Site and click Ok.
• Select to Work with: Subclipse 1.10.x Update Site - http://subclipse.tigris.org/update_1.10.x/.
• Select the following components:
• CollabNet Merge Client [4.1.0]
• Subclipse (Required) [1.10.13]
• Subclipse Integration for Mylyn 3.x (Optional) [3.0.0]
• Subversion Client Adapter (Required) [1.10.3]
• Subversion JavaHL Native Library Adapter [1.8.15]
• Subversion Revision Graph [1.1.1]
• SVNKit Library [1.8.12]
• JNA Library [4.1.0]
• SVNKit Client Adapter (Not required) [1.8.9] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Note
Optionally select Window → Preferences → Team → SVN → Usage Reporting to uncheck Allow the Subclipse team to receive anonymous usage statistics for this Eclipse installation.
15.1.5.3.1. Subclipse configuration
Set the following preferences at Window → Preferences:
• Select Team → SVN and as SVN Interface Client choose SVNKit (Pure Java) and click OK.
15.1.5.4. Mylyn
Mylyn [version 3.19.0] is a task-focused interface for Eclipse that reduces information overload and makes
multi-tasking easy. It does this by making tasks a first class part of Eclipse, and integrating rich and offline editing
for repositories such as Bugzilla, Trac, and JIRA. Once your tasks are integrated, Mylyn monitors your work activity
to identify relevant information, and uses this task context to focus the user interface on the task-at-hand. This
puts the information you need at your fingertips and improves productivity by reducing searching, scrolling, and
navigation. By making task context explicit Mylyn also facilitates multitasking, planning, reusing past efforts, and
sharing expertise.
Update the plugin Mylyn in Eclipse:
125
Chapter 15.
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/mylyn/releases/latest with Name Mylyn for
Eclipse and click Ok.
• Select to Work with: Mylyn for Eclipse - http://download.eclipse.org/mylyn/releases/latest.
• Select the following components (uncheck Hide items that are already installed):
• Mylyn Task List [3.19.0]
• Mylyn Task-Focused Interface [3.19.0]
• Mylyn WikiText [2.8.0]
• Mylyn Builds Connector: Hudson/Jenkins [1.11.0]
• Mylyn Context Connector: Eclipse IDE [3.19.0]
• Mylyn Context Connector: Java Development [3.19.0]
• Mylyn Context Connector: Plug-in Development [3.19.0]
• Mylyn Context Connector: Team Support [3.19.0]
• Mylyn Versions Connector: Subclipse [1.11.0]
• Mylyn Versions Connector: Git [1.11.0] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
For JIRA support:
• Select Help → Install New Software….
• Add… the Location http://update.atlassian.com/atlassian-eclipse-plugin/rest/e3.7/ with
Name Atlassian Connector for Eclipse and click Ok.
• Select to Work with: Atlassian Connector for Eclipse - http://update.atlassian.com/atlassian-eclipse-plugin/rest/e3.7/.
• Select the following component:
• Atlassian Connector for Eclipse [3.2.5] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Note
Optionally select Window → Preferences → Atlassian Connector → Usage Data to uncheck
Enable monitoring and automatic submission.
Warning
We are discontinuing the support for Atlassian IDE Connectors (source and fork).
15.1.5.4.1. Mylyn configuration
Set the following Window → Preferences → Mylyn:
• In Tasks define:
• Change Week Start to Monday.
• Enable Track time spent within Eclipse when a task is active.
• Optionally set Stop time accumulation after 15 minutes of inactivity.
• In Team define Commit Comment Template:
${connector.task.prefix} ${task.key}: ${task.description}
${task.url}
and click Apply.
In Java perspective activate the Mylyn views with Window → Show View → Other… or shortcut Alt+Shift+Q,
Q and from Mylyn select: Task List, Task Repositories and Builds.
Open the Task List view with Alt+Shift+Q, K (see also the User Guide for shortcuts and a UI Legend, which is
also available in the local menu → Show UI Legend).
15.1.5.4.2. JIRA integration
In the Task Repositories view open the
JIRA and click Next:
local menu with Ctrl+F10 to
• Server: http://freedumbytes.dev.net/jira.
126
Add Task Repository…. Select
Integrated Development Environment
•
•
•
•
Label: freedumbytes.dev.net JIRA.
User ID: jjasper.
Password: password.
Open Additional Settings:
• Subtasks: Show linked tasks.
• Advanced Configuration:
• Date Picker Format: yyyy-MM-dd.
• Date Time Picker Format: yyyy-MM-dd HH:mm.
• Open Task Editor Settings: Confluence (default).
• Validate Settings and click Finish and do not create a query yet.
Add queries to the freedumbytes.dev.net JIRA task repository by right clicking on it and selecting
Query…. Select Create query using form and click Next:
New
• Query Title: freedumbytes.dev.net JIRA issues.
• Assigned To: Current User and click Finish.
Note
The other issues, that are viewed in Eclipse, will show up in the category Uncategorized.
15.1.5.4.3. Jenkins integration
In the
Builds view select
Add Build Server…. Select
Hudson (supports Jenkins) and click Next:
•
•
•
•
Server: http://freedumbytes.dev.net/jenkins.
Label: freedumbytes.dev.net Jenkins builds.
Keep: Anonymous checked.
Open Http Authentication and check Enable Http Authentication:
• User ID: jjasper.
• Password: password.
• Validate and click Refresh for Build Plans.
• Click Select All in Build Plans and click Finish.
Set the following Window → Preferences:
• In Mylyn → Builds check Automatically refresh builds and click Apply.
15.1.5.5. Maven
Maven integration [version 1.6.2] for Eclipse provides tight integration for Maven into the IDE.
Install the plugin M2Eclipse in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/technology/m2e/releases/ with Name m2e
Update Site and click Ok.
• Select to Work with: m2e Update Site - http://download.eclipse.org/technology/m2e/releases/.
• Type filter text: m2e.
• Select the following components:
• m2e - Maven Integration for Eclipse (includes Incubating components) [1.6.2]
• m2e - slf4j over logback logging (Optional) [1.6.2] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Important
If you get the following JDK warning: “The Maven Integration requires that Eclipse be running
in a JDK, because a number of Maven core plugins are using jars from the JDK. Please make
sure the -vm option in eclipse.ini [117] is pointing to a JDK and verify that Installed JREs are
also using JDK installs.”
Select Window → Preferences → Java → Installed JREs → Add… a Standard VM and Next set
the JRE home with Directory… to P:\dev\apps\prg\java-x64\jdk1.8.0_74 and click
Finish. Now check this jdk1.8.0_74 and Remove the old jre1.x.x_xx and apply with OK (see also
Section 15.1.2, “Eclipse installation guide” [117]).
127
Chapter 15.
15.1.5.5.1. Maven configuration
Set the following preferences Window → Preferences:
• In Team → Ignored Resources → Add Pattern… for target, .settings, .classpath and .project and
click Apply.
Note
As an alternative see also Section 11.1.2.5, “Ignores template” for Git and Section 11.2.3,
“Global ignores” for Subversion.
• In Maven → Installations:
• Add… the latest Maven installation Directory…: P:\dev\apps\build\apache-maven-3.3.9 and click
OK. Check this new Maven installation and click Apply.
• Next in Maven → User Settings point to the corresponding Maven settings:
• Global Settings: P:\dev\apps\build\apache-maven-3.3.9\conf\settings.xml.
• In Maven:
• Check Hide folders of physically nested modules (experimental) when using a git project (see also the
note below).
Important
Using the option Hide folders of physically nested modules (experimental) can lead to
merge conflicts messages in Team Synchronizing.
Note
As an alternative right-click on the submodule and select Properties or Alt+Enter to set the
attribute Derived. Alas the Git Plugin will then mark the submodule as ignored in .gitignore. By the way the M2E plugin should set the derived flag on modules folders as well as
on output folders, such as target/classes, on project import. But there seems to be a bug
because the flag ain't set for the module folders.
Tip
When running mvn clean the derived flag is reset on the target folder. Instead of setting
it for every single target folder, right-click on the Working Set, select Maven → Update
Project… and click OK or use Alt+F5.
• In Maven → User Interface:
• Optionally check Open XML page in the POM editor by default and click OK.
For configuration of the lifecycle mappings see Section 16.1.13, “M2Eclipse lifecycle configuration”.
Occasionally Eclipse build fails with the error “<path>/target/m2e-wtp/web-resources/META-INF/MANIFEST.MF
(No such file or directory)”. Change the preferences at Window → Preferences → Maven → Java EE Integration
→ WAR Project preferences and uncheck Maven Archiver generates files under the build directory (see also
M2E-WTP FAQ).
15.1.5.6. e(fx)clipse
e(fx)clipse [version 2.3.0] provides JavaFX tooling for the Eclipse IDE. Read more about the latest developments on BestSolution's specific blog.
Install the plugin e(fx)clipse in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/efxclipse/updates-released/2.3.0/site/
with Name e(fx)clipse Update Site and click Ok.
• Select to Work with: e(fx)clipse Update Site - http://download.eclipse.org/efxclipse/updates-released/2.3.0/site/.
• Select the following components:
• e(fx)clipse - IDE [2.3.0] and click Next twice.
128
Integrated Development Environment
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Note
This also should take care of “Access restriction: … is not API (restriction on required library '…
\jre\lib\ext\jfxrt.jar')” messages.
15.1.5.7. JD-Eclipse
JD-Eclipse [version 1.0.0-RC2]allows you to display all the Java sources during your debugging process, even
if you do not have them all.
Install the plugin JD-Eclipse in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://jd.benow.ca/jd-eclipse/update/ with Name JD-Eclipse
Site and click Ok.
Update
Note
For installation of a more recent version see also GitHub.
• Select to Work with: JD-Eclipse Update Site - http://jd.benow.ca/jd-eclipse/update/.
• Select the following components:
• JD-Eclipse Plug-in [0.1.5] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
15.1.5.8. Memory Analyzer
BIRT [version 4.5.0] is an open source technology platform used to create data visualizations and reports that
can be embedded into rich client and web applications.
Install the plugin BIRT in Eclipse to be able to use the optional Memory Analyzer Charts:
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/birt/update-site/4.4/ with Name BIRT Update Site and click Ok.
• Select to Work with: BIRT Update Site - http://download.eclipse.org/birt/update-site/4.4/.
• Select the following components:
• BIRT Framework [4.4.2] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Memory Analyzer (MAT) [version 1.5.0] is a fast and feature-rich Java heap analyzer that helps you find memory
leaks and reduce memory consumption.
Install the plugin Memory Analyzer in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://download.eclipse.org/mat/1.5/update-site/ with Name MAT Update
Site and click Ok.
• Select to Work with: MAT Update Site - http://download.eclipse.org/mat/1.4/update-site/.
• Select the following components:
• Memory Analyzer [1.5.0]
• Memory Analyzer (Charts) [optional] [1.5.0] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Select Window → Perspective → Open perspective → Other… →
Memory Analysis to analyze .hprof files.
VisualVM is a visual tool integrating several commandline JDK tools and lightweight profiling capabilities. Designed for both production and development time use, it further enhances the capability of monitoring and performance analysis for the Java SE platform. It is supplied with the JDK and can be run from the commandline with
jvisualvm and used to create for example Thread and Heap dumps.
Or run an Java applications with the following options:
129
Chapter 15.
• -XX:+HeapDumpOnOutOfMemoryError to enable the JVM to dump the Java heap in HPROF binary format
(.hprof file) when an OutOfMemoryError error occurs.
• -XX:HeapDumpPath=C:\dev\projects to specify the path and file name of the HPROF dump file.
15.1.5.9. Code Coverage
EclEmma [version 2.3.3] is a free Java code coverage tool for Eclipse.
Install the plugin EclEmma in Eclipse:
•
•
•
•
Select Help → Install New Software….
Add… the Location http://update.eclemma.org/ with Name EclEmma and click Ok.
Select to Work with: EclEmma - http://update.eclemma.org/.
Select the following components:
• EclEmma Java Code Coverage [2.3.3] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
• To complete the installation restart Eclipse.
Tip
Instead of using the shortcut Alt+Shift+X, T to Run As → 1 JUnit Test use the shortcut
Alt+Shift+E, T to Coverage As → 1 JUnit Test. After its first usage a Coverage view appears
in the tabs at the bottom of the screen. Optionally just drag it next to the
Task List and
Outline tabs.
Figure 15.9. Eclipse EclEmma Code Coverage Plugin
15.1.5.10. SonarLint
SonarLint [version 2.0.2] is an Eclipse plugin that provides on-the-fly feedback to developers on new bugs and
quality issues injected into Java, JavaScript and PHP code.
Install the plugin SonarLint in Eclipse:
• Select Help → Install New Software….
• Add… the Location http://eclipse.sonarlint.org/ with Name SonarLint for Eclipse Update
Site and click Ok.
• Select to Work with: SonarLint for Eclipse Update Site - http://eclipse.sonarlint.org/.
• Select the following components:
• SonarLint for Eclipse [2.0.2].
• SonarLint for Eclipse Java Configuration Helper [2.0.2] and click Next twice.
• Choose I accept the terms of the license agreements after reading them and Finish.
130
Integrated Development Environment
• To complete the installation restart Eclipse.
15.1.5.10.1. SonarLint configuration
In Java perspective configure the connection to SonarQube with Window → Show View → Other… or shortcut
Alt+Shift+Q, Q and from SonarLint select: SonarQube Servers.
In the
•
•
•
•
SonarQube Servers view create the New → Server connection with:
Server URL: http://freedumbytes.dev.net/sonarqube.
Server Label: freedumbytes.dev.net SonarQube.
Username / Token: sonarlint (see also Section 17.2.4.3, “Users”).
Password: password and after Test connection click Finish.
Note
See also Section 17.2.5, “Apache configuration” about allowing anonymous access to SonarQube for SonarLint because it uses the /api to get the information:
"GET /api/system/status HTTP/1.1" 200 53 "-" "SonarLint Eclipse
2.0.2.20160427-0800-RELEASE"
"GET /api/plugins/installed HTTP/1.1" 200 2155 "-" "SonarLint
Eclipse 2.0.2.20160427-0800-RELEASE"
"GET /api/authentication/validate?format=json HTTP/1.1" 200 14 "-"
"SonarLint Eclipse 2.0.2.20160427-0800-RELEASE"
Now bind one or more Eclipse project(s) in a Working Set to their remote SonarQube pair. Right click on project(s)
and select SonarLint → Bind to a SonarQube project... → Auto bind selected projects and click Finish.
Figure 15.10. Eclipse SonarLint Quality Issues Plugin
15.1.6. Team support
15.1.6.1. Mylyn tasks
It is possible to filter completed tasks with
Hide Completed Tasks.
131
Chapter 15.
Important
When you didn't save passwords in the Repository Settings you will see the warning icon synchronization failed in front of the related queries. In that case just double click on the repository name in the
Task Repositories view, reenter the required passwords, Validate Settings and click Finish. After that it should be possible to
Synchronize with the repository
in the Task List view.
New tasks/issues can now be created in Eclipse by clicking
New Task,
New Subtask or Alt+Shift+N, T (or
creating one directly from events in the Error Log view with Report as Bug):
• Selecting the appropriate repository and click Next.
• Select the product after Update Projects from Repository when it isn't already there and click Finish.
• After entering the issue click Submit.
Tip
If you get the following error: “Unable to submit at this time. Check connectivity and retry.”
when the connection is valid, try to reproduce the error using the Open with Web Browser
option. For example when running Bugzilla without an SMTP server configured this causes the
above mentioned error. In the Web Browser you will see the following error: “There was an error
sending mail from '[email protected]' to '[email protected]':Couldn't
connect to localhost”. In this case make sure that all users have Bugmail Disabled.
If you notice that the changes did make it in the issue tracker open the Task again. Click
Synchronize Incoming Changes to fetch them and then delete the now obsolete local changes
with Clear outgoing.
The following shortcuts are available for tasks:
• Ctrl+F12: Open task dialog.
• Ctrl+Shift+F12: Open repository task dialog to find tasks not available on the
and drop this
Issue or
Bug onto the
• Ctrl+F9: Activate task dialog.
• Ctrl+Shift+F9: Deactivate current task.
Task List view. Then drag
Task List if necessary.
Important
It is possible to hyperlink other task in comments but for these hyperlinks to be useful also for
the issue trackers themselves use only the following formats:
• Bugzilla: bug 1 or bug #2.
• JIRA: the project key followed by issue number, for example: JMW-1.
These same entries can be used in comments in java and resource files. To activate hyperlinking
in those files associate the appropriate Task Repository by right clicking on the project and
open Properties → Task Repository and selecting the appropriate one.
15.1.6.2. Mylyn task focus
When you first activate a task you will notice that the
Package Explorer view is empty in
Focus on Active
Task mode. It is possible to drill down from the Working Set or any other node to the interesting bits using
Alt+click or the plus icon displayed behind the node to Show Filtered Children. Use Ctrl+click to select multiple interesting nodes. When finished marking interesting nodes click (without Ctrl) on whitespace or an already
marked node to filter the uninteresting nodes again. Type Ctrl+Alt+Shift+Up to
Mark as Landmark an element in the resource tree. Type Ctrl+Alt+Shift+Down to Remove from Context the selected node.
Note
Closing a file will make its node uninteresting immediately (see also Window → Preferences
→ Mylyn → Context → Remove file from context when editor is closed).
132
Integrated Development Environment
Tip
Once the task is finished attach the current context
the last context should the task (re)enter someone's
and select Context → Retrieve… to do so.
to it. This way it is possible to restore
Task List. Just right click on the task
15.1.6.3. Bugfixing
Should the code require bugfixing and a resource needs to be changed in the bugfix as well as a new feature being
worked on one might consider to create a patch for the new feature and revert the current changes.
Open the
Team Synchronizing perspective and in the
Synchronize view right click on the Change Set for
the conflicting new feature. Select Create Patch… to open the Changes pane in the Show Change Sets mode.
Select the Save to clipboard setting and click Finish.
Right click on the Change Set for the conflicting new feature again and select
Open Corresponding Task.
Open the
Attachments, click
Attach…, with Clipboard setting and click Next. Check Patch and enter a
Description of backup patch and click Finish (or Next to verify what you are going to save first).
Finally right click on the Change Set for the conflicting new feature to Override and Update all the changed
resources.
Once the bugfix is commited reactive the new feature with Ctrl+F9 in the activate task dialog and go to the task
itself with Ctrl+F12. Open the Attachments, select the attachment with your Description of backup patch
by double clicking on it. The patch will be opened in the Eclipse Web Browser. First type Shift+F10 and Select All
then type Shift+F10 again and select Copy. Now in the Package Explorer view right click on a project node and
select Team → Apply Patch… from the Clipboard with Next → Finish. In case of conflicts you might need to
play with or Guess the Maximum fuzz factor and Generate a .rej file for unmerged hunks next to the problem
resource to manually apply some of the changes.
Important
Make sure that formatting changes aren't a big part of the patch (see also Tip on Eclipse Save
Actions).
133
134
Chapter 16.
Chapter 16. Project
Lets setup a base structure, for Maven projects to come, with the following JIRA project:
• Maven Setup [MVNSTP]: Maven support components (see also repository branches/maven-setup).
With the following components:
1. setup: Setup the site, license and plugin configuration files.
2. base-pom: Java Project Object Model: dependencies, build and reporting settings.
3. versions-rules: A ruleSet file containing the rules that control how to compare version numbers.
4. lifecycle-mapping: Eclipse workspace project configuration and behaviour during Eclipse workspace build.
and versions:
• 3.0-beta - Base structure for Maven projects to come.
• 3.1-beta - Quality Assurance with SonarQube.
Important
For the release procedure the version should end with -SNAPSHOT, but it is left out for the
sake of consistency with the version of this document itself. And of course also because
of inter-dependencies between for example Maven Setup and Maven Skins projects, which
would require extra releases and thus different release roadmaps of those projects. Now
for a proof of concept it is a simple mvn install to test out new features.
16.1. Setup base components
Start a new bare Git repository maven-setup by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git maven-setup.git "Maven support components" -jenkinsHook in Git Bash.
Clone this remote repository with the following command git-clone jjasper maven-setup.
Create the minimal POM in C:\dev\projects\maven-setup\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>net.dev.freedumbytes.maven</groupId>
+ <artifactId>setup</artifactId>
+ <version>3.1-beta</version>
+ <packaging>pom</packaging>
+</project>
In Eclipse create a Working Set Maven Setup and import this Maven Setup project into it with File → Import…
→ Maven → Existing Maven Projects from Root directory C:\dev\projects\maven-setup and click Finish.
Note
To exclude the target directory from search actions and the like, right click on it and select
Properties → Derived.
Tip
When running mvn clean the derived flag is reset on the target folder. Instead of setting it for
every single target folder, right-click on the Working Set, select Maven → Update Project…
and click OK or use Alt+F5.
135
Chapter 16.
16.1.1. Team Synchronizing Git
Right-click on the Working Set MVNSTP and select Team → Share Project… → Git → Next → Use or create
Repository in parent folder of project and click Finish.
Open the
Team Synchronizing perspective and select
Synchronize… → Git and click Next to synchronize
with the
Destination refs/heads/master for the
maven-setup [master] and Include local uncommited
changes in comparison and click Finish.
Other available options are
Pull and
Push.
16.1.2. Project information
Supply the project information in C:\dev\projects\maven-setup\pom.xml:
<artifactId>setup</artifactId>
<version>3.1-beta</version>
<packaging>pom</packaging>
+
+
+
+
+
+
+
<name>Free Dumb Bytes Maven Setup</name>
<description>
Setup the site, license and plugin configuration files.
</description>
<url>${mavenHost}/maven-setup</url>
<inceptionYear>2010</inceptionYear>
+
+
+
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
+
+
+
+
+
+
+
<licenses>
<license>
<name>GNU Lesser General Public License</name>
<url>http://www.gnu.org/licenses/lgpl.html</url>
<distribution>repo</distribution>
</license>
</licenses>
+
+
+
+
<organization>
<name>Free Dumb Bytes</name>
<url>${organizationHost}</url>
</organization>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<developers>
<developer>
<id>jjasper</id>
<name>Jene Jasper</name>
<email>[email protected]</email>
<organization>Free Dumb Bytes</organization>
<organizationUrl>${organizationHost}</organizationUrl>
<roles>
<role>developer</role>
</roles>
<timezone>+1</timezone>
<properties>
<picUrl>${avatarHost}/avatar/jjasper?s=64&amp;noCache=true</picUrl>
</properties>
</developer>
</developers>
<contributors />
<mailingLists />
</project>
136
Project
Note
All patch snippets are split into logical blocks and non essential lines are removed for better
page breaks in the generated pdf and the html print out.
16.1.3. Environment
Define the Continuous Integration build system, the Issue Tracker system and the Version Control System management in C:\dev\projects\maven-setup\pom.xml:
<mailingLists />
+
+
+
+
+
+
+
+
<scm>
<developerConnection>
scm:git:${gitHost}/maven-setup.git
</developerConnection>
<url>${fisheyeHost}/browse/maven-setup</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/maven-setup</url>
</ciManagement>
+
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/MVNSTP</url>
</issueManagement>
+ <properties>
+
<devHost>http://freedumbytes.dev.net</devHost>
+
<mavenHost>http://freedumbytes.dev.net/mvn-sites</mavenHost>
+
<tomcatHost>http://freedumbytes.dev.net/tomcat</tomcatHost>
+
<glassfishHost>http://freedumbytes.dev.net/glassfish</glassfishHost>
+
<apacheHost>http://freedumbytes.dev.net/manual</apacheHost>
+
<organizationHost>http://freedumbytes.dev.net/mvn-sites/maven-setup/teamlist.html</organizationHost>
+
<gitHost>http://freedumbytes.dev.net/git-repo</gitHost>
+
<svnHost>https://svn.java.net/svn/jmodalwindow~svn</svnHost>
+
<fisheyeHost>http://freedumbytes.dev.net/fisheye</fisheyeHost>
+
<avatarHost>http://freedumbytes.dev.net/fisheye</avatarHost>
+
<jiraHost>http://freedumbytes.dev.net/jira</jiraHost>
+
<jenkinsHost>http://freedumbytes.dev.net/jenkins</jenkinsHost>
+
<nexusHost>http://freedumbytes.dev.net/nexus</nexusHost>
+ </properties>
</project>
Tip
Should any of the hosts change and a project could not upgrade to the latest Maven Setup
parent it now is possible to override it in the Maven configuration file P:\dev\apps\build
\apache-maven-3.3.9\conf\settings.xml:
<profiles>
…
+
+
+
+
+
+
<profile>
<id>hosts</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
137
Chapter 16.
+
+
+
<gitHost>http://freedumbytes.dev.net/git</gitHost>
</properties>
</profile>
</profiles>
It is even possible to override that settings from the command line with the option -DgitHost=http://
freedumbytes.dev.net/scm/git.
16.1.4. Site
The Site Plugin is used to generate a site for the project. The generated site also includes the project's reports
that were configured in the <reporting/> section of the POM.
16.1.4.1. Configuration
Setup the initial site descriptor in C:\dev\projects\maven-setup\src\site\site.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/DECORATION/1.6.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0
+
http://maven.apache.org/xsd/decoration-1.6.0.xsd">
+ <bannerLeft>
+
<name>Free Dumb Bytes</name>
+
<href>${devHost}</href>
+ </bannerLeft>
+
+ <publishDate position="left" format="yyyy-MM-dd HH:mm:ss z" />
+
+ <version position="right" />
+ <body>
+
<menu name="Free Dumb Bytes" inherit="top">
+
<item name="Maven" href="${mavenHost}" />
+
<item name="Git" href="${gitHost}" />
+
<item name="Subversion" href="${svnHost}" />
+
<item name="FishEye" href="${fisheyeHost}" />
+
<item name="JIRA" href="${jiraHost}" />
+
<item name="Jenkins" href="${jenkinsHost}" />
+
<item name="Nexus" href="${nexusHost}" />
+
<item name="HTTP Server" href="${apacheHost}" />
+
<item name="Tomcat" href="${tomcatHost}" />
+
<item name="GlassFish" href="${glassfishHost}" />
+
<item name="Development Production Line"
+
href="http://jmodalwindow.java.net/manual/dpl/html/index.html" />
+
<item name="Recent releases"
+
href="${fisheyeHost}/qsearch?q=%5Bmaven-release-plugin
%5D&amp;t=1&amp;s=0" />
+
</menu>
+
<menu inherit="bottom" ref="parent" />
+
<menu inherit="bottom" ref="modules" />
+
<menu inherit="bottom" ref="reports" />
+ </body>
+</project>
Note
Set the landing page for jiraHost as follows:
138
Project
Figure 16.1. JIRA Home Page
Setup the Project Info Reports in C:\dev\projects\maven-setup\pom.xml:
</properties>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<configuration>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<linkOnly>true</linkOnly>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>summary</report>
<report>license</report>
<report>project-team</report>
<report>modules</report>
<report>scm</report>
<report>issue-tracking</report>
<report>cim</report>
<report>distribution-management</report>
<report>dependency-info</report>
<report>dependencies</report>
<report>dependency-management</report>
<report>dependency-convergence</report>
<report>plugins</report>
<report>plugin-management</report>
<report>mailing-list</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
Important
When using Nexus disable the generation of the repository locations in the maven-project-info-reports-plugin <configuration/> of the <reporting/> section with <dependencyLocationEnabled/> set to false (see also issue MPIR-137). This is also a performance boost.
Verify those settings with mvn
index.html.
site in your browser at file:///C:/dev/projects/maven-setup/target/site/
139
Chapter 16.
16.1.4.2. Apache Maven Fluido Skin
The Apache Maven Fluido Skin is an Apache Maven site skin built on top of Twitter's Bootstrap.
To switch from the Maven Default Skin to the Apache Maven Fluido Skin edit C:\dev\projects\maven-setup\src\site\site.xml:
<publishDate position="left" format="yyyy-MM-dd HH:mm:ss z" />
<version position="right" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<skin>
<groupId>${skinGroupId}</groupId>
<artifactId>${skinArtifactId}</artifactId>
<version>${skinVersion}</version>
</skin>
<custom>
<fluidoSkin>
<topBarEnabled>true</topBarEnabled>
<navBarStyle>navbar-inverse</navBarStyle>
<sideBarEnabled>true</sideBarEnabled>
<leftColumnClass>span2</leftColumnClass>
<bodyColumnClass>span10</bodyColumnClass>
<sourceLineNumbersEnabled>true</sourceLineNumbersEnabled>
<copyrightClass>pull-right</copyrightClass>
</fluidoSkin>
</custom>
<body>
<menu name="Free Dumb Bytes" inherit="top">
Supply the skin settings in C:\dev\projects\maven-setup\pom.xml:
<properties>
…
<nexusHost>http://freedumbytes.dev.net/nexus</nexusHost>
+
+
+
+
+
+
<skinGroupId>org.apache.maven.skins</skinGroupId>
<skinArtifactId>maven-fluido-skin</skinArtifactId>
<skinVersion>${mavenFluidoSkinVersion}</skinVersion>
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
</properties>
<reporting>
16.1.4.3. Project page
Next create a more html like project page instead of the default displayed plain text project <description/>
from the pom.xml in C:\dev\projects\maven-setup\src\site\apt\index.apt:
+ ----+ Index
+ ----+ Jene Jasper
+ -----+ 2010-02-23
+ -----+
+~~ NOTE: For help with the syntax of this file, see:
+~~ http://maven.apache.org/doxia/references/apt-format.html
+Free Dumb Bytes Maven Setup
+
+ Setup the site, license and plugin configuration files
+ (such as the required version of the basic plugins
+ and the generated site reports).
140
Project
+* Project Information
+
+ This POM defines the following default information:
+
+ * organization
+
+ * developers
+
+ * contributors
+
+ []
+ Projects that extend from this POM must at least override the following
settings:
+
+ * name
+
+ * description
+
+ * url
+
+ * inceptionYear
+
+ * optionally developers and contributors
+
+ * scm
+
+ * ciManagement
+
+ * issueManagement
+
+ []
Note
Maven uses Doxia for its content generation framework. It supports several markup formats:
APT (Almost Plain Text), Confluence, Simplified DocBook, FML (FAQ Markup Language), FO,
iText, LaTeX, RTF, TWiki, XDoc (popular in Apache land) and XHTML.
16.1.5. Plugin Versions
After running mvn site check the Plugin Management, Build Plugins and Report Plugins reports in your browser
at file:///C:/dev/projects/maven-setup/target/site/plugin-management.html and file:///C:/dev/projects/mavensetup/target/site/plugins.html to find out about the plugins that get invoked by default. Thus the first batch of
plugins that will require a version are configured in C:\dev\projects\maven-setup\pom.xml (see also SoftwareEntwicklung Beratung Schulung for latest release notes):
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
<mavenCleanPluginVersion>2.6.1</mavenCleanPluginVersion>
<mavenToolchainsPluginVersion>1.1</mavenToolchainsPluginVersion>
<versionsMavenPluginVersion>2.2</versionsMavenPluginVersion>
<mavenPluginPluginVersion>3.4</mavenPluginPluginVersion>
<mavenDependencyPluginVersion>2.10</mavenDependencyPluginVersion>
<truezipMavenPluginVersion>1.2</truezipMavenPluginVersion>
<mavenResourcesPluginVersion>2.7</mavenResourcesPluginVersion>
<mavenAntrunPluginVersion>1.8</mavenAntrunPluginVersion>
<mavenCompilerPluginVersion>3.3</mavenCompilerPluginVersion>
<mavenAnimalSnifferPluginVersion>1.15</mavenAnimalSnifferPluginVersion>
<mavenDependencyCheckVersion>1.3.6</mavenDependencyCheckVersion>
<jacocoMavenPluginVersion>0.7.5.201505241946</jacocoMavenPluginVersion>
<mavenSurefirePluginVersion>2.18.1</mavenSurefirePluginVersion>
<mavenSurefireReportPluginVersion>
${mavenSurefirePluginVersion}
</mavenSurefireReportPluginVersion>
<mavenFailsafePluginVersion>
${mavenSurefirePluginVersion}
</mavenFailsafePluginVersion>
<mavenJarPluginVersion>2.6</mavenJarPluginVersion>
<mavenEjbPluginVersion>2.5.1</mavenEjbPluginVersion>
141
Chapter 16.
+
<mavenWarPluginVersion>2.6</mavenWarPluginVersion>
+
<mavenRarPluginVersion>2.4</mavenRarPluginVersion>
+
<mavenEarPluginVersion>2.10.1</mavenEarPluginVersion>
+
<mavenSourcePluginVersion>2.4</mavenSourcePluginVersion>
+
<mavenJavadocPluginVersion>2.10.3</mavenJavadocPluginVersion>
+
<mavenAssemblyPluginVersion>2.6</mavenAssemblyPluginVersion>
+
<mavenInstallPluginVersion>2.5.2</mavenInstallPluginVersion>
+
<mavenDeployPluginVersion>2.8.2</mavenDeployPluginVersion>
+
<mavenReleasePluginVersion>2.5.2</mavenReleasePluginVersion>
+
<mavenScmPluginVersion>1.9.4</mavenScmPluginVersion>
+
<mavenSitePluginVersion>3.4</mavenSitePluginVersion>
+
<mavenProjectInfoReportsPluginVersion>2.8.1</
mavenProjectInfoReportsPluginVersion>
</properties>
+
+
+
+
+
+
+
+
142
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${mavenCleanPluginVersion}</version>
</plugin>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${versionsMavenPluginVersion}</version>
<configuration>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${mavenPluginPluginVersion}</version>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${mavenDependencyPluginVersion}</version>
</plugin>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${mavenResourcesPluginVersion}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${mavenAntrunPluginVersion}</version>
</plugin>
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${mavenCompilerPluginVersion}</version>
<configuration>
<encoding>UTF-8</encoding>
Project
+
+
</configuration>
</plugin>
Note
Should
the
compiler
plugin
3.x
fail
with
the
message
“Caused
by:
org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure” and no
further information is shown about the real cause, even when using options -e or -X, then try using the older version 2.5.1 as follows: mvn org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile and hey presto back is the following error message “[ERROR]
Failure executing javac, but could not parse the error:” with “the following stack trace for details.”.
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacocoMavenPluginVersion}</version>
<configuration>
<sourceEncoding>UTF-8</sourceEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefirePluginVersion}</version>
</plugin>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${mavenFailsafePluginVersion}</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${mavenJarPluginVersion}</version>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>${mavenEjbPluginVersion}</version>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${mavenWarPluginVersion}</version>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-rar-plugin</artifactId>
<version>${mavenRarPluginVersion}</version>
</plugin>
+
<plugin>
143
Chapter 16.
144
+
+
+
+
+
+
+
+
+
+
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>${mavenEarPluginVersion}</version>
<configuration>
<encoding>UTF-8</encoding>
<duplicateArtifactsBreakTheBuild>
true
</duplicateArtifactsBreakTheBuild>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${mavenSourcePluginVersion}</version>
</plugin>
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${mavenJavadocPluginVersion}</version>
<configuration>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${mavenAssemblyPluginVersion}</version>
</plugin>
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${mavenInstallPluginVersion}</version>
<configuration>
<createChecksum>true</createChecksum>
<updateReleaseInfo>false</updateReleaseInfo>
</configuration>
</plugin>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>${mavenDeployPluginVersion}</version>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${mavenReleasePluginVersion}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>${mavenScmPluginVersion}</version>
</plugin>
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${mavenSitePluginVersion}</version>
<configuration>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${mavenProjectInfoReportsPluginVersion}</version>
<configuration>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<linkOnly>true</linkOnly>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>index</report>
And produces reports, on demand with -PenableUpdatesReports, of those project dependencies, plugins and
properties, which have newer versions available:
</properties>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<profiles>
<profile>
<id>enableUpdatesReports</id>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${versionsMavenPluginVersion}</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</profile>
</profiles>
<build>
This is for example a property-updates-report:
145
Chapter 16.
Figure 16.2. Maven Versions Property Updates Report
Create a rule set file C:\dev\projects\maven-setup\src\config\maven-versions-rules.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<ruleset comparisonMethod="maven"
+ xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0
+
http://www.mojohaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
+ <rules>
+
<rule groupId="commons-logging" artifactId="commons-logging">
+
<ignoreVersions>
+
<ignoreVersion type="regex">.*-does-not-exist</ignoreVersion>
+
</ignoreVersions>
+
</rule>
+
+
<rule groupId="log4j" artifactId="log4j">
+
<ignoreVersions>
+
<ignoreVersion type="regex">.*-atlassian.*</ignoreVersion>
+
</ignoreVersions>
+
</rule>
+
+
<rule groupId="com.google.guava">
+
<ignoreVersions>
+
<ignoreVersion type="regex">.*-rc.*</ignoreVersion>
+
</ignoreVersions>
+
</rule>
+
+
<rule groupId="log4j" artifactId="log4j">
+
<ignoreVersions>
+
<ignoreVersion type="regex">.*-atlassian.*</ignoreVersion>
+
</ignoreVersions>
+
</rule>
+
+
<rule groupId="com.google.guava">
+
<ignoreVersions>
+
<ignoreVersion type="regex">.*-rc.*</ignoreVersion>
+
</ignoreVersions>
+
</rule>
+
+
<rule groupId="org.springframework">
146
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<ignoreVersions>
<ignoreVersion type="regex">.*\.M.*</ignoreVersion>
<ignoreVersion type="regex">.*\.RC.*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="org.hibernate">
<ignoreVersions>
<ignoreVersion type="regex">.*\.Alpha.*</ignoreVersion>
<ignoreVersion type="regex">.*\.Beta.*</ignoreVersion>
<ignoreVersion type="regex">.*\.CR.*</ignoreVersion>
<ignoreVersion type="regex">.*-atlassian-.*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="junit">
<ignoreVersions>
<ignoreVersion type="regex">.*-beta-.*</ignoreVersion>
<ignoreVersion type="regex">.*-brew.*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="org.mockito">
<ignoreVersions>
<ignoreVersion type="regex">.*-dev.*</ignoreVersion>
<ignoreVersion type="regex">.*-beta.*</ignoreVersion>
<ignoreVersion type="regex">.*-rc.*</ignoreVersion>
</ignoreVersions>
</rule>
<rule groupId="org.slf4j">
<ignoreVersions>
<ignoreVersion type="regex">.*jbossorg.*</ignoreVersion>
</ignoreVersions>
</rule>
</rules>
</ruleset>
To allow free access to this file just upload it as an artifact in the Releases repository of Nexus:
147
Chapter 16.
Figure 16.3. Maven Versions Rules Nexus Upload
Or just start a new bare Git repository maven-versions-rules by calling /p/dev/apps/windows/batch/git-create-repo.sh
/p/dev/data/repo/git
maven-versions-rules.git
"A
ruleSet file containing the rules that control how to compare version numbers." jenkinsHook in Git Bash (see also repository branches/maven-versions-rules).
Finally configure the rule set usage in C:\dev\projects\maven-setup\pom.xml:
<properties>
…
<skinVersion>${mavenFluidoSkinVersion}</skinVersion>
+
+
<versionsRulesVersion>1.0-kappa</versionsRulesVersion>
+
<versionsRulesPath>
+
${nexusHost}/content/groups/public/net/dev/freedumbytes/maven/versionsrules
+
</versionsRulesPath>
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
<pluginManagement>
148
Project
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${versionsMavenPluginVersion}</version>
<configuration>
<outputEncoding>UTF-8</outputEncoding>
+
<rulesUri>
+
${versionsRulesPath}/${versionsRulesVersion}/versions-rules${versionsRulesVersion}.xml
+
</rulesUri>
</configuration>
</plugin>
16.1.5.1. Encoding
To suppress the following warning “[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!” set the encoding parameters of the plugins that support it to UTF-8,
that is a variable-length character encoding for Unicode, or ISO-8859-1 (informally referred to as Latin-1).
To set the same encoding in Eclipse select Window → Preferences and type filter text “encoding”:
• General:
• Workspace → Text file encoding → Other → UTF-8
• Content Types → Text set Default encoding to UTF-8 and Update the following:
• Java Properties File.
• Java Source File.
• JSP.
• JSP Fragment.
• JSP Tag Definition.
• XML JSP Tag Definition.
• Editors → Text Editors → Spelling → Encoding → Other → UTF-8
• Web apply Encoding ISO 10646/Unicode(UTF-8) for the following:
• CSS Files.
• HTML Files.
• JSP Files.
• XML → XML Files → Encoding → ISO 10646/Unicode(UTF-8).
16.1.6. Deployment
Configure the deployment of the project site on the Apache HTTP Server and the artifacts in the Nexus Repository.
16.1.6.1. Site
Enable WebDAV on the Apache HTTP Server (see Section 7.1.13, “Module mod_dav configuration”) for uploading
of the Maven sites content and amend the setup C:\dev\projects\maven-setup\pom.xml:
</issueManagement>
+
+
+
+
+
+
+
+
<distributionManagement>
<site>
<id>mvn-sites </id>
<name>Maven Documentation Sites</name>
<url>dav:${mavenHost}/maven-setup</url>
</site>
</distributionManagement>
<properties>
<mavenProjectInfoReportsPluginVersion>2.8.1</
mavenProjectInfoReportsPluginVersion>
+
+
<wagonMavenPluginVersion>1.0</wagonMavenPluginVersion>
+
<wagonFtpVersion>2.10</wagonFtpVersion>
+
<wagonWebdavJackrabbitVersion>2.10</wagonWebdavJackrabbitVersion>
</properties>
+
<build>
<extensions>
149
Chapter 16.
+
+
+
+
+
+
+
+
+
+
+
+
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>${wagonFtpVersion}</version>
</extension>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav-jackrabbit</artifactId>
<version>${wagonWebdavJackrabbitVersion}</version>
</extension>
</extensions>
<pluginManagement>
<artifactId>maven-site-plugin</artifactId>
<version>${mavenSitePluginVersion}</version>
<configuration>
<generateSitemap>true</generateSitemap>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
+
and make note of this in C:\dev\projects\maven-setup\src\site\apt\index.apt:
Projects that extend from this POM must at least override the following
settings:
* name
* description
* url
* inceptionYear
* optionally developers and contributors
* scm
* ciManagement
* issueManagement
+
+ * distributionManagement of the site
[]
Encrypt the Jenkins user password
with mvn --encrypt-password password and place it in the Maven
configuration file P:\dev\apps\build\apache-maven-3.3.9\conf\settings.xml:
<servers>
…
<server>
<id>mvn-sites</id>
<username>jenkins</username>
<password>{encrypted password}
</server>
</servers>
</password>
Verify those settings with mvn site-deploy in your browser at http://freedumbytes.dev.net/mvn-sites/mavensetup/index.html.
16.1.6.2. Artifact
Configure Nexus as the default artifact repository for the artifact deployment with the following <distributionManagement/> settings in the C:\dev\projects\maven-setup\pom.xml:
+
150
<distributionManagement>
<repository>
Project
+
+
+
+
+
+
+
+
+
<id>nexus-releases</id>
<name>Internal Releases</name>
<url>${nexusHost}/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus-snapshots</id>
<name>Internal Snapshots</name>
<url>${nexusHost}/content/repositories/snapshots</url>
</snapshotRepository>
<site>
<id>mvn-sites</id>
Note
Those repositories are defined in the development profile settings.
and amend the C:\dev\projects\maven-setup\src\site\apt\index.apt:
* Project Information
This POM defines the following default information:
* organization
* developers
* contributors
+
+ * distributionManagement of the releases and snapshots
+
+ <<Note>>: All supported Maven repositories are configured in
+ {{{${nexusHost}/index.html#view-repositories}Nexus}}
[]
Note
To filter properties into any supported documentation format, add a .vm extension to
the filename. Thus rename the file to C:\dev\projects\maven-setup\src\site\apt
\index.apt.vm.
Verify those settings with mvn deploy in your browser at http://freedumbytes.dev.net/nexus/index.html#nexussearch;gav~net.dev.freedumbytes.maven~setup~~~.
151
Chapter 16.
Figure 16.4. Free Dumb Bytes Maven Setup
16.1.6.3. Navigation tree reuse
To be able to reuse the project setup site descriptor C:\dev\projects\maven-setup\src\site\site.xml
attach it as an artifact along with the pom.xml:
+
<mavenAssemblyPluginVersion>2.5.3</mavenAssemblyPluginVersion>
<buildHelperMavenPluginVersion>1.9.1</buildHelperMavenPluginVersion>
<mavenInstallPluginVersion>2.5.2</mavenInstallPluginVersion>
…
</properties>
<build>
<pluginManagement>
<plugins>
…
+
+
+
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${buildHelperMavenPluginVersion}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
</plugins>
</pluginManagement>
+
+
+
+
+
+
+
+
+
+
+
+
+
152
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>site-descriptor-reuse</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
<configuration>
<artifacts>
<artifact>
<file>src/site/site.xml</file>
<classifier>site</classifier>
<type>xml</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Verify those settings with mvn deploy in your browser at http://freedumbytes.dev.net/nexus/index.html#nexussearch;gav~net.dev.freedumbytes.maven~setup~~~site.
16.1.7. Java base POM
Configure the default Java projects settings in a base-pom.
16.1.7.1. Compiler
The Compiler Plugin is used to compile the sources of your project. The default compiler is javac and is used to
compile Java sources. To compile the sources using the latest JDK of all available java compilers in the Maven
settings reference ${jdk.1.8.javac}.
Define a new module base-pom in C:\dev\projects\maven-setup\pom.xml:
</distributionManagement>
+
+
+
<modules>
<module>base-pom</module>
</modules>
<properties>
Supply the new module C:\dev\projects\maven-setup\base-pom\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven</groupId>
+
<artifactId>setup</artifactId>
+
<version>3.1-beta</version>
+ </parent>
+
+
+
+
+
+
+
+
<artifactId>base-pom</artifactId>
<packaging>pom</packaging>
+
+
+
+
+
+
+
<properties>
<baseJdkVersion>1.8</baseJdkVersion>
<baseJavadocVersion>1.8</baseJavadocVersion>
<baseJavacExecutable>${jdk.1.8.javac}</baseJavacExecutable>
<baseJavaExecutable>${jdk.1.8.jvm}</baseJavaExecutable>
<baseJavadocExecutable>${jdk.1.8.javadoc}</baseJavadocExecutable>
</properties>
<name>Free Dumb Bytes Java SE Base POM</name>
<description>
Java Project Object Model: dependencies, build and reporting settings.
</description>
<inceptionYear>2010</inceptionYear>
153
Chapter 16.
Note
Those executables are defined in the compiler profile settings.
+ <build>
+
<pluginManagement>
+
<plugins>
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-compiler-plugin</artifactId>
+
<version>${mavenCompilerPluginVersion}</version>
+
<configuration>
+
<fork>true</fork>
+
<executable>${baseJavacExecutable}</executable>
+
<compilerVersion>${baseJdkVersion}</compilerVersion>
+
<source>${baseJdkVersion}</source>
+
<target>${baseJdkVersion}</target>
+
<showDeprecation>true</showDeprecation>
+
<showWarnings>true</showWarnings>
+
<meminitial>128m</meminitial>
+
<maxmem>512m</maxmem>
+
</configuration>
+
</plugin>
+
</plugins>
+
</pluginManagement>
+ </build>
+</project>
Important
The fork option needs to be set to true for the ${base…} settings to take effect.
16.1.7.2. Surefire
Split unit and integration tests by delegating integration tests to the Maven Failsafe plugin (see also The correct
way to use integration tests in your build process).
The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application.
Configure it in C:\dev\projects\maven-setup\base-pom\pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
…
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
154
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefirePluginVersion}</version>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<runOrder>hourly</runOrder>
<jvm>${baseJavaExecutable}</jvm>
<disableXmlReport>false</disableXmlReport>
<reportFormat>brief</reportFormat>
<trimStackTrace>false</trimStackTrace>
<printSummary>true</printSummary>
<includes>
<include>**/Test*.java</include>
<include>**/*Test.java</include>
<include>**/*TestCase.java</include>
Project
+
+
+
+
+
+
+
<include>**/*UnitTest.java</include>
</includes>
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
The Failsafe Plugin is designed to run integration tests while the Surefire Plugin is designed to run unit tests. The
name (failsafe) was chosen both because it is a synonym of surefire and because it implies that when it fails, it
does so in a safe way. Configure it in C:\dev\projects\maven-setup\base-pom\pom.xml:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${mavenFailsafePluginVersion}</version>
<configuration>
<skipTests>${skipIntegrationTests}</skipTests>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<runOrder>hourly</runOrder>
<jvm>${baseJavaExecutable}</jvm>
<disableXmlReport>false</disableXmlReport>
<reportFormat>brief</reportFormat>
<trimStackTrace>false</trimStackTrace>
<printSummary>true</printSummary>
<includes>
<include>**/IT*.java</include>
<include>**/*IT.java</include>
<include>**/*ITCase.java</include>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Note
Also added two extra wildcard patterns **/*UnitTest.java
the defaults.
and **/*IntegrationTest.java
to
Add both plugins to the build process in C:\dev\projects\maven-setup\base-pom\pom.xml:
</pluginManagement>
+
+
+
+
+
+
+
+
+
+
+
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
</plugins>
</build>
The Surefire Report Plugin parses the generated TEST-*.xml files and renders them to Doxia which creates the
web interface version of the test results.
155
Chapter 16.
</build>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${mavenSurefireReportPluginVersion}</version>
<configuration>
<skipSurefireReport>${skipUnitTests}</skipSurefireReport>
<skipFailsafeReport>${skipIntegrationTests}</skipFailsafeReport>
<aggregate>false</aggregate>
<linkXRef>false</linkXRef>
<showSuccess>true</showSuccess>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>report-only</report>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
Tip
Since Jenkins also shows the Latest Test Result info, this report isn't really necessary.
Now we reach the most important point regarding unit tests. In a big enterprise application integration and unit
tests must be handled differently. Most importantly your build server (e.g. Jenkins) should contain a mixture of
jobs that deal with both kinds of tests. Disable the integration tests during developer builds in C:\dev\projects
\maven-setup\base-pom\pom.xml:
<baseJavadocExecutable>${jdk.1.8.javadoc}</baseJavadocExecutable>
+
+
+
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>true</skipIntegrationTests>
</properties>
Supply a profile to activate the integration tests with mvn verify -PintegrationTests:
</properties>
+
+
+
+
+
+
+
+
+
<profiles>
<profile>
<id>integrationTests</id>
<properties>
<skipIntegrationTests>false</skipIntegrationTests>
</properties>
</profile>
Also supply a profile to activate the integration tests only with mvn verify -PintegrationTestsOnly:
+
+
+
+
+
+
+
+
156
<profile>
<id>integrationTestsOnly</id>
<properties>
<skipUnitTests>true</skipUnitTests>
<skipIntegrationTests>false</skipIntegrationTests>
</properties>
</profile>
Project
+
</profiles>
<build>
<pluginManagement>
This leads to the following list of command line options:
@rem defaults to unittests only
mvn clean verify
@rem skip
mvn clean
mvn clean
mvn clean
mvn clean
all tests
verify -DskipTests
verify -Dmaven.test.skip=true
verify -DskipUnitTests
verify -DskipUnitTests=true
@rem unittests and integrationtests
mvn clean verify -PintegrationTests
mvn clean verify -DskipIntegrationTests=false
@rem integrationtests only
mvn clean verify -PintegrationTestsOnly
mvn clean verify -DskipUnitTests=true -DskipIntegrationTests=false
Tip
Projects that are going to inherit from a base-pom parent can overrule the default skipping of
integration again by supplying their own property setting:
<parent>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>java-se-8-base-pom</artifactId>
<version>3.1-beta</version>
</parent>
…
<properties>
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
And thus back to the usage of the standard commands options:
@rem defaults to unittests only
mvn clean verify
@rem skip all tests
mvn clean verify -DskipTests
mvn clean verify -Dmaven.test.skip=true
16.1.7.3. JaCoCo
The JaCoCo Plugin provides the JaCoCo (Java Code Coverage Library) runtime agent to your tests and allows basic
report creation. Configure it in C:\dev\projects\maven-setup\base-pom\pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
…
+
+
+
+
+
+
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacocoMavenPluginVersion}</version>
<configuration>
<skip>${skipCodeCoverage}</skip>
157
Chapter 16.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<append>false</append>
<excludes>
<exclude>**/generated/*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>agent-unit</id>
<configuration>
<destFile>${coverageReportsPathUnit}</destFile>
</configuration>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>agent-integration</id>
<configuration>
<destFile>${coverageReportsPathIntegration}</destFile>
</configuration>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Tip
Since SonarQube handles the recorded coverage, just skip the Maven reports themselves for
now (see also Section C.3.6.1, “JaCoCo”).
Add the plugin to the build process in C:\dev\projects\maven-setup\base-pom\pom.xml:
</pluginManagement>
+
+
+
+
+
+
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
…
</plugins>
</build>
Enable the code coverage during developer builds in C:\dev\projects\maven-setup\base-pom\pom.xml:
<baseJavadocExecutable>${jdk.1.8.javadoc}</baseJavadocExecutable>
+
+
+
+
+
+
+
+
+
+
158
<skipCodeCoverage>false</skipCodeCoverage>
<coverageReportsPath>
${project.build.directory}/coverage-reports
</coverageReportsPath>
<coverageReportsPathUnit>
${coverageReportsPath}/jacoco-unit.exec
</coverageReportsPathUnit>
<coverageReportsPathIntegration>
${coverageReportsPath}/jacoco-integration.exec
Project
+
</coverageReportsPathIntegration>
<skipUnitTests>${skipTests}</skipUnitTests>
<skipIntegrationTests>true</skipIntegrationTests>
</properties>
Important
To skip code coverage supply the following command line option: -DskipCodeCoverage (instead of -Djacoco.skip=true because of the newly defined properties).
16.1.7.4. Source
The Source Plugin creates a jar archive of the source files of the current project:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${mavenSourcePluginVersion}</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
<configuration>
<attach>true</attach>
<includePom>true</includePom>
<excludeResources>false</excludeResources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Enable conditional activation of the source archive creation through a profile named sources-javadocs:
</properties>
…
+
+
+
+
+
+
+
+
+
+
+
+
+
<profile>
<id>sources-javadocs</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<pluginManagement>
It is possible to force some profiles to get enabled during release (for example to enable time-consuming tasks
that are only relevant at release-time) by setting a comma separated list of profiles names in the releaseProfiles parameter in C:\dev\projects\maven-setup\base-pom\pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
…
<id>attach-sources</id>
…
159
Chapter 16.
</plugin>
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${mavenReleasePluginVersion}</version>
<configuration>
<releaseProfiles>sources-javadocs</releaseProfiles>
</configuration>
</plugin>
</plugins>
</pluginManagement>
16.1.7.5. Javadoc
The Javadoc Plugin uses the Javadoc tool to package the generated javadocs into a jar file for distribution during
for example the Jenkins build:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${mavenJavadocPluginVersion}</version>
<configuration>
<javadocExecutable>${baseJavadocExecutable}</javadocExecutable>
<javadocVersion>${baseJavadocVersion}</javadocVersion>
<source>${baseJdkVersion}</source>
<quiet>true</quiet>
<detectJavaApiLink>false</detectJavaApiLink>
<detectOfflineLinks>false</detectOfflineLinks>
<breakiterator>true</breakiterator>
<show>protected</show>
<minmemory>128m</minmemory>
<maxmemory>512m</maxmemory>
</configuration>
<executions>
<execution>
<id>attach-javadoc</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Important
Set <detectOfflineLinks/> to false because those links will be created as external links
during site generation anyway and (see also issue MJAVADOC-275) to prevent build errors
when using the javadoc goal before all project artifacts are installed in the verify phase).
Also enable conditional activation of the javadoc archive creation through the profile named sourcesjavadocs:
<profiles>
…
<profile>
<id>sources-javadocs</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
+
+
+
+
160
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Project
+
</plugin>
</plugins>
</build>
</profile>
</profiles>
Optionally configure Section C.1, “Javadoc report” for the project site.
16.1.7.6. Toolchains
The Toolchains Plugin allows to share configuration across plugins. For example to make sure the plugins like
compiler, surefire, javadoc, webstart etc. all use the same JDK for execution:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-toolchains-plugin</artifactId>
<version>${mavenToolchainsPluginVersion}</version>
<executions>
<execution>
<goals>
<goal>toolchain</goal>
</goals>
</execution>
</executions>
<configuration>
<toolchains>
<jdk>
<version>${baseJdkVersion}</version>
<vendor>oracle</vendor>
</jdk>
</toolchains>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</pluginManagement>
<plugins>
+<!-- Alas https://issues.jenkins-ci.org/browse/JENKINS-28629
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-toolchains-plugin</artifactId>
+
</plugin>
+-->
+
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
Specific settings of for example maven-source-plugin and maven-javadoc-plugin will overrule the one of maventoolchains-plugin:
[INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ qa-sandbox --[INFO] Required toolchain: jdk [ vendor='oracle' version='1.8' ]
[INFO] Found matching toolchain for type jdk: JDK[P:\dev\apps\prg\javax64\jdk1.8.0_74]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ qa-sandbox --[INFO] Toolchain in maven-compiler-plugin: JDK[P:\dev\apps\prg\javax64\jdk1.8.0_74]
[WARNING] Toolchains are ignored, 'executable' parameter is set to P:\dev\apps
\prg\java-x64\jdk1.8.0_74\bin\javac.exe
[INFO] --- maven-javadoc-plugin:2.10.3:jar (attach-javadoc) @ qa-sandbox --[INFO] Toolchain in maven-javadoc-plugin: JDK[P:\dev\apps\prg\javax64\jdk1.8.0_74]
161
Chapter 16.
[WARNING] Toolchains are ignored, 'javadocExecutable' parameter is set to P:\dev
\apps\prg\java-x64\jdk1.8.0_74\bin\javadoc.exe
16.1.7.7. Animal Sniffer
The Animal Sniffer Plugin is used to build signatures of APIs and to check your classes against previously generated
signatures. This plugin is called animal sniffer because the principal signatures that are used are those of the Java
Runtime, and since Sun traditionally names the different versions of its Java Runtimes after different animals, the
plugin that detects what Java Runtime your code requires was called Animal Sniffer:
+
+
<properties>
<baseJdkVersion>1.8</baseJdkVersion>
<baseJdkSignature>java18</baseJdkSignature>
<baseJdkSignatureVersion>1.0</baseJdkSignatureVersion>
<baseJavadocVersion>1.8</baseJavadocVersion>
<baseJavacExecutable>${jdk.1.8.javac}</baseJavacExecutable>
<baseJavaExecutable>${jdk.1.8.jvm}</baseJavaExecutable>
<baseJavadocExecutable>${jdk.1.8.javadoc}</baseJavadocExecutable>
…
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
…
</plugin>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>${mavenAnimalSnifferPluginVersion}</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>${baseJdkSignature}</artifactId>
<version>${baseJdkSignatureVersion}</version>
</signature>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Also enable conditional activation of the animal sniffer through the profile named api-check:
+
+
+
+
+
+
+
+
+
+
+
<profiles>
…
<profile>
<id>api-check</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
Note
When baseJdkVersion is earlier than baseJavacExecutable an api-check might be in
order (see also How Spring achieves compatibility with Java 6, 7 and 8).
162
Project
16.1.7.8. OWASP Dependency Check
OWASP Dependency Check is a utility that identifies project dependencies and checks if there are any known,
publicly disclosed, vulnerabilities.
<properties>
…
+
+
<owaspReportsPath>${project.build.directory}</owaspReportsPath>
</properties>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
…
</plugin>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>${mavenDependencyCheckVersion}</version>
<configuration>
<outputDirectory>${owaspReportsPath}</outputDirectory>
<format>xml</format>
</configuration>
<executions>
<execution>
<goals>
<goal>aggregate</goal>
</goals>
</execution>
</executions>
</plugin>
Also enable conditional activation of the dependency check through the profile named owasp-single:
<profiles>
…
<profile>
<id>owasp-single</id>
+
+
+
+
<build>
+
<plugins>
+
<plugin>
+
<groupId>org.owasp</groupId>
+
<artifactId>dependency-check-maven</artifactId>
+
</plugin>
+
</plugins>
+
</build>
+
</profile>
+
+
<profile>
+
<id>owasp-multiple</id>
+
+
<properties>
+
<owaspReportsPath>${project.build.directory}/owasp-reports</
owaspReportsPath>
+
</properties>
+
+
<build>
+
<plugins>
+
<plugin>
+
<groupId>org.owasp</groupId>
+
<artifactId>dependency-check-maven</artifactId>
+
</plugin>
+
</plugins>
+
</build>
+
</profile>
163
Chapter 16.
Note
Profile owasp-multiple is available for multi module projects to prevent repeated Issue entries of the same Vulnerable Components in SonarQube due to module dependency hierarchy with help of sonar.dependencyCheck.reportPath setting and the fact that the aggregate file isn't saved in the outputDirectory folder ${owaspReportsPath} (see also Section 17.2.7, “Maven integration”).
Because of the way dependency-check works both false positives and false negatives may exist. Please read How
to read the report to get a better understanding of sorting through the false positives and false negatives. See
the Suppressing False Positives page for more information on how to generate and use the suppression file.
It is important to understand that the first time this task is executed it may take minutes as it downloads and
processes the data from the National Vulnerability Database (NVD) hosted by NIST. After the first batch download,
as long as the plugin is executed at least once every seven days the update will only take a few seconds.
16.1.7.9. JDeps
The JDeps Plugin uses the jdeps tool to analyze classes for internal API calls. For more information about the
standard jdeps tool, please refer to Java Dependency Analysis Tool.
In JDK 8, a new command-line tool, jdeps, is added that developers can use to understand the static dependencies
of their applications and libraries. It also provides an -jdkinternals option to find dependencies to any JDK
internal APIs that are unsupported and private to JDK implementation (see Why Developers Should Not Write
Programs That Call sun Packages).
Tip
SonarQube has a lock-in, pitfall rule: “Classes from sun packages should not be used”.
16.1.7.10. Shade
The Shade Plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to
shade, i.e. rename, the packages of some of the dependencies.
16.1.7.11. Java software platform
Create modules for the JDKs 1.3 a.k.a. Kestrel, 1.4 a.k.a. Merlin, 1.5 a.k.a. Tiger, 1.6 a.k.a. Mustang, 1.7 a.k.a. Dolphin
and 1.8 in C:\dev\projects\maven-setup\base-pom\pom.xml:
<contributors />
+
+
+
+
+
+
+
+
+
<modules>
<module>java-se-3-base-pom</module>
<module>java-se-4-base-pom</module>
<module>java-se-5-base-pom</module>
<module>java-se-6-base-pom</module>
<module>java-se-7-base-pom</module>
<module>java-se-8-base-pom</module>
</modules>
In those modules configure the jvm specific properties of the currently configured plugins (for example for the
Merlin 1.4 module) C:\dev\projects\maven-setup\base-pom\java-se-4-base-pom\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven</groupId>
+
<artifactId>base-pom</artifactId>
+
<version>3.1-beta</version>
+ </parent>
164
Project
+
+
+
+
+
+
<artifactId>java-se-4-base-pom</artifactId>
<packaging>pom</packaging>
<name>Free Dumb Bytes Java SE 4 POM [Merlin]</name>
<description>Java SE 4 Project Object Model.</description>
<inceptionYear>2010</inceptionYear>
And force the version of the surefire plugins that is compatible with jdk1.4.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<properties>
<baseJdkVersion>1.4</baseJdkVersion>
<baseJdkSignature>java14</baseJdkSignature>
<baseJdkSignatureVersion>1.0</baseJdkSignatureVersion>
<baseJavadocVersion>1.42</baseJavadocVersion>
<baseJavacExecutable>${jdk.1.4.javac}</baseJavacExecutable>
<baseJavaExecutable>${jdk.1.4.jvm}</baseJavaExecutable>
<baseJavadocExecutable>${jdk.1.4.javadoc}</baseJavadocExecutable>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${mavenSurefirePluginJDK4Version}</version>
</plugin>
<mavenSurefirePluginJDK4Version>2.5</mavenSurefirePluginJDK4Version>
<mavenFailsafePluginJDK4Version>
${mavenSurefirePluginJDK4Version}
</mavenFailsafePluginJDK4Version>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>${mavenFailsafePluginJDK4Version}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Verify with mvn
help:effective-pom in C:\dev\projects\maven-setup\base-pom and C:\dev
\projects\maven-setup\base-pom\java-se-4-base-pom to see for example the difference between
maven-javadoc-plugin settings.
Note
All the modules java-se-.-base-pom are added as samples and especially java-se-4-base-pom
shows only a subset of the required version changes for surefire and failsafe plugins, but aren't
currently kept up-to-date.
16.1.8. Continuous integration
Browse to http://freedumbytes.dev.net/jenkins/newView to create the following List Views: Application,
Component, Demo, EOL, Maven and Sandbox.
Finally select the Component view http://freedumbytes.dev.net/jenkins/view/Maven/ and create a New Job in
Jenkins with Job name maven-setup to Build a maven2/3 project with the following settings:
Tip
To keep the folder name short use the shorter git project name as Job name maven-setup
and define under Advanced Project Options the longer Display Name.
165
Chapter 16.
• Maven project job name / Discard Old Builds / Log Rotation:
• Click Advanced… to edit Advanced Project Options to Block builds / Project display name:
• Source Code Management for Git with Credentials:
• Configure Git proxy authentication for the Repository URL (see also Section 14.1.4.4, “Git authentication”
to prevent error “stderr: fatal: Authentication failed for 'http://freedumbytes.dev.net/git-repo/mavensetup.git/'”) with add Credentials, when the _netrc solution isn't used.
• Branches to build such as master:
Tip
If not all future branches should trigger build just specify the required ones, for example
for qa-sandbox project:
166
Project
Note
In both cases a manual Build Now will only trigger a build of the branch that was build
during the prior build #.
Test those different settings for example by making changes to two branches and pushing those changes
all at once with git push --all origin.
Warning
Ran into a “Detached HEAD” situation with the following combination of settings:
Branches to build ** and Additional Behaviours Shallow clone (see below).
• Repository browser such as FishEye:
• Additional Behaviours for clone:
Or retrieve some more:
• Build Triggers such as hooks and poll:
Note
Make sure the poll interval is larger than the quiet period [110] otherwise the build will never
start. When using the hooks/post-receive of the git repo instead, make sure the Poll SCM
option is ticked.
• Build Goals and Options:
167
Chapter 16.
• -B or --batch-mode: Batch mode is essential if you need to run Maven in a non-interactive, continuous
integration environment. When running in non-interactive mode, Maven will never stop to accept input
from the user. Instead, it will use sensible default values when it requires input.
• -e, --errors: Will come in handy if you are a Maven developer, or if you need to diagnose an error in a
Maven plugin.
• -P, --activate-profiles: Comma-delimited list of profiles to activate. Currently available profiles:
• integrationTests: activate the integration tests (see also Section 16.1.7.2, “Surefire”).
• integrationTestsOnly: activate the integration tests only; thus skipping unit tests (see also Section 16.1.7.2, “Surefire”).
• sources-javadocs: activation of the source and javadoc archive creation (see also Section 16.1.7.4,
“Source” and Section 16.1.7.5, “Javadoc”).
• enableUpdatesReports: activation of the reports of those project dependencies, plugins and properties, which have newer versions available (see also Section 16.1.5, “Plugin Versions”).
• owasp-single or owasp-multiple: activation of the OWASP Dependency Check reports (see also
Section 16.1.7.8, “OWASP Dependency Check”).
• Disable automatic artifact archiving.
• Disable automatic site documentation artifact archiving.
• Disable automatic fingerprinting of consumed and produced artifacts.
Note
See
also
Section 13.1.6.2,
“Artifact
deployment”
and
Section 4.2.6,
“Password
Encryption”
to
make
sure
the
“Uploading:
http://freedumbytes.dev.net/nexus/content/repositories/snapshots/net/dev/freedumbytes/maven/setup/…-SNAPSHOT/setup-x.y-20131013.201411-1.pom” succeeds.
Tip
When the project invokes plugins with <phase>pre-site</phase> configuration use
phase site-deploy instead of goals site:site site:deploy (see also Section 17.3.7,
“PressGang Example”).
• Build Settings for notifications:
168
Project
Note
In case of the following error “Cause: C:\Windows\System32\config\systemprofile\.m2\settings-security.xml (The system cannot find the file specified)” during a Jenkins build
make sure the Tomcat service is not running under the Local system account.
16.1.9. Release
Let Jenkins take care of the snapshot deployments, but handle the release action from the command line with
the Release Plugin.
The Nexus Repository is already configured as the default for deployments.
Make sure all local changes have been committed with commands:
git
git
git
git
status
tag -l
log --tags --simplify-by-decoration [--pretty="format:%ai %s"]
log --oneline --decorate
Also check if all remote changes are “up to date” with command:
git remote show origin
To change the 3.0-SNAPSHOT version to a release 3.0 version, which also will be tagged in the SCM as mavensetup-3.0, and to create the next 3.1-SNAPSHOT version use the command:
mvn -Dusername=jjasper -Dpassword=password release:prepare
(or try a Dry Run with the option -DdryRun=true followed by mvn
release:rollback to remove all of the created files).
release:clean or mvn
Note
When using release plugin version 2.5.1 or earlier with Maven 3.3.3 and later the following
error occurs “Failed to invoke Maven build. Error configuring command-line. Reason: Maven
executable not found at: …\apache-maven-3.3.3\bin\mvn.bat” because the mvn.bat is renamed to mvn.cmd. When it isn't possible to upgrade the parent base-pom overwrite version 2.5.1 from the command line with mvn -Dusername=jjasper -Dpassword=password
org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare.
Then deploy the release 3.0 version to Nexus using the command:
mvn -Dusername=jjasper -Dpassword=password release:perform
This will result in a checkout of tag setup-3.0 into C:\dev\projects\maven-setup\target\checkout
from which the artifacts and sites will be deployed. Afterwards delete this directory otherwise it might show up
in the Eclipse Team Synchronizing perspective.
Tip
Because Jenkins will overwrite the site with the next snapshot anyway, save time by skipping
site-deploy with:
mvn -Dusername=jjasper -Dpassword=password release:perform Dgoals=deploy
Again verify if all remote changes are “up to date” with command:
git status
169
Chapter 16.
git push
git remote show origin
Note
Now might be a good time to create a Custom skin.
16.1.10. Versions
The Release Plugin is handy for updating SNAPSHOT versions of the modules in a project. But when used on
SNAPSHOT dependencies the next project SNAPSHOT version will be pointing to the next SNAPSHOT of the dependencies also. Which is usually not what is required. In comes the Versions Plugin option mvn versions:usereleases (for usage see also Section 17.3.8, “Publication”).
Look for updates of dependencies with mvn versions:display-dependency-updates and plugins with mvn
versions:display-plugin-updates and the:
• Advance the dependency version to the next higher with mvn versions:use-next-releases with or the
latest with mvn versions:use-latest-releases.
• Switch from a snapshot dependency to its released version with mvn versions:use-releases.
• Upgrade the parent reference with mvn versions:update-parent.
• The Versions Plugin has the following reporting goals [145]:
• versions:dependency-updates-report produces a report of those project dependencies which have newer
versions available.
• versions:plugin-updates-report produces a report of those plugins which have newer versions available.
• versions:property-updates-report produces a report of those properties which are used to control artifact
versions and which properies have newer versions available.
To lock the version of a SNAPSHOT for say a release candidate build use mvn versions:lock-snapshots and
revert with mvn versions:unlock-snapshots.
To set the patch version for a branch version of for example 1.0 to 1.0.1-SNAPSHOT use mvn versions:set DnewVersion=1.0.1-SNAPSHOT.
Remove the backup files with mvn versions:commit or revert changes with mvn versions:revert.
16.1.11. Branch
To create a branch on for example the qa-sandbox project to use Clover instead of JaCoCo code coverage, the
Release Plugin should be able to handle the branch action from the command line with:
cd /d C:\dev\projects\qa-sandbox
mvn release:branch -DbranchName=code-coverage-clover DsuppressCommitBeforeBranch=true -DremoteTagging=false ^
-DupdateBranchVersions=true -DreleaseVersion=1.0.1-SNAPSHOT ^
-DupdateWorkingCopyVersions=false -DpushChanges=false
Alas mvn release:branch fails on Windows to commit changed POM in branch (see also MRELEASE-881). Thus next
as a workaround use the Versions Plugin as follows.
Switch to the new branch:
git branch
git checkout code-coverage-clover
git status
Fix project version:
mvn versions:set -DnewVersion=1.0.1-SNAPSHOT
git status
Remove pom.xml.versionsBackup files:
mvn versions:commit
git status
170
Project
Important
In
case
of
“org.codehaus.mojo:versions-maven-plugin:2.2:set
failed.
NullPointerException”
switch
back
to
version
2.1
(and
join
set
and
commit
goals):
mvn
org.codehaus.mojo:versions-mavenplugin:2.1:set
org.codehaus.mojo:versions-maven-plugin:2.1:commit
DnewVersion=1.0.1-SNAPSHOT.
Commit changed pom.xml files:
git diff
git commit -am "branch code-coverage-clover"
git status
Push the local branch to the remote repository (publish) and set up the tracking information:
git push -u origin code-coverage-clover
git status
Note
In case of the error “src refspec master matches more than one. failed to push some refs to”
there might be a tag with the same name.
Working on this branch in Eclipse:
Figure 16.5. Eclipse Switch To Branch
Don't forget to switch the synchronization destination also:
171
Chapter 16.
Figure 16.6. Eclipse Synchronize Branch
16.1.12. Grouping Dependencies
If you have a set of dependencies which are logically grouped together. You can create a project with pom packaging that groups dependencies together. To solve version mismatch issues, you can use the concept of a Bill of
Materials (BOM) dependency. A BOM dependency keep track of version numbers and ensure that all dependencies (both direct and transitive) are at the same version.
16.1.12.1. Bill of Materials
Lets setup a base structure, for Bill of Materials code to come, with the following JIRA project:
• Bill of Materials [BOMGRP]: of the most popular Maven dependencies (see also repository branches/bill-ofmaterials).
With the following components:
1. bom: Setup the required versions of the most popular Maven dependencies.
2. grouping: Set of dependencies which are logically grouped together.
and versions:
• 3.0-epsilon - Dependency Management.
• 3.1-epsilon - Common, Spring, Hibernate, Test, Log and MySQL groupings.
Start a new bare Git repository bill-of-materials by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git bill-of-materials.git "Maven Bill of Materials" jenkinsHook in Git Bash.
Clone this remote repository with the following command git-clone jjasper bill-of-materials.
Create the minimal POM in C:\dev\projects\bill-of-materials\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven</groupId>
+
<artifactId>setup</artifactId>
+
<version>3.1-beta</version>
+ </parent>
+
+ <artifactId>bom</artifactId>
172
Project
+ <version>3.1-epsilon</version>
+ <packaging>pom</packaging>
+</project>
+
+
+
+
+
+
<name>Free Dumb Bytes Maven Bill of Materials</name>
<description>
Setup the required versions of the most popular Maven dependencies.
</description>
<url>${mavenHost}/bill-of-materials</url>
<inceptionYear>2015</inceptionYear>
+
+
+
+
+
+
+
<scm>
<developerConnection>
scm:git:${gitHost}/bill-of-materials.git
</developerConnection>
<url>${fisheyeHost}/browse/bill-of-materials</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/bill-of-materials</url>
</ciManagement>
+
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/BOMGRP</url>
</issueManagement>
+ <distributionManagement>
+
<site>
+
<id>mvn-sites</id>
+
<name>Maven Documentation Sites</name>
+
<url>dav:${mavenHost}/bill-of-materials</url>
+
</site>
+ </distributionManagement>
+</project>
16.1.12.1.1. Common dependencies
Define the Common dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
</site>
</distributionManagement>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<properties>
<lombokVersion>1.16.8</lombokVersion>
<commonsLangVersion>2.6</commonsLangVersion>
<commonsLang3Version>3.4</commonsLang3Version>
<commonsCodecVersion>1.10</commonsCodecVersion>
<commonsIOVersion>2.4</commonsIOVersion>
<guavaVersion>18.0</guavaVersion>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombokVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang</artifactId>
<version>${commonsLangVersion}</version>
</dependency>
173
Chapter 16.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commonsLang3Version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commonsCodecVersion}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commonsIOVersion}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guavaVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Note
Supply a version for commons-lang for projects that don't yet want to use the repackaged
commons-lang3 from the upcoming Grouping Common Dependencies.
16.1.12.1.2. Spring dependencies
Define the Spring dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
<guavaVersion>18.0</guavaVersion>
+
+
<springVersion>3.2.15.RELEASE</springVersion>
</properties>
<version>${guavaVersion}</version>
</dependency>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
174
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${springVersion}</version>
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${springVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
16.1.12.1.3. Hibernate dependencies
Define the Hibernate dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
<springVersion>3.2.15.RELEASE</springVersion>
+
+
+
+
<hibernateVersion>3.6.10.Final</hibernateVersion>
<ehcacheVersion>2.6.11</ehcacheVersion>
<javassistVersion>3.20.0-GA</javassistVersion>
</properties>
<version>${springVersion}</version>
</dependency>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernateVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernateVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernateVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
175
Chapter 16.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcacheVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassistVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Note
For JPA, use hibernate-entitymanager instead of hibernate-core.
16.1.12.1.4. Test dependencies
Define the Test dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
<hibernateVersion>3.6.10.Final</hibernateVersion>
…
+
+
+
+
+
+
+
+
+
<junitVersion>4.12</junitVersion>
<assertjVersion>3.2.0</assertjVersion>
<mockitoVersion>1.10.19</mockitoVersion>
<powerMockVersion>1.6.4</powerMockVersion>
<cglibVersion>3.1</cglibVersion>
<commonsDbcpVersion>1.4</commonsDbcpVersion>
<h2Version>1.4.190</h2Version>
<hsqldbVersion>2.3.3</hsqldbVersion>
</properties>
<artifactId>spring-orm</artifactId>
<version>${springVersion}</version>
</dependency>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
176
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junitVersion}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertjVersion}</version>
</dependency>
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockitoVersion}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>${powerMockVersion}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>${powerMockVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>${cglibVersion}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commonsDbcpVersion}</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2Version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldbVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
16.1.12.1.5. Log dependencies
Define the Log dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
<h2Version>1.4.190</h2Version>
<hsqldbVersion>2.3.3</hsqldbVersion>
+
+
+
+
<log4jVersion>1.2.17</log4jVersion>
<commonsLoggingVersion>1.2</commonsLoggingVersion>
<slf4jVersion>1.7.13</slf4jVersion>
</properties>
<version>${hsqldbVersion}</version>
</dependency>
+
+
+
+
+
+
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
177
Chapter 16.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<version>${log4jVersion}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commonsLoggingVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4jVersion}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4jVersion}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
16.1.12.1.6. MySQL dependencies
Define the MySQL dependencies versions in C:\dev\projects\bill-of-materials\pom.xml:
<log4jVersion>1.2.17</log4jVersion>
<commonsLoggingVersion>1.2</commonsLoggingVersion>
<slf4jVersion>1.7.13</slf4jVersion>
+
+
+
<mysqlConnectorJVersion>5.1.37</mysqlConnectorJVersion>
<hikariCPVersion>2.4.2</hikariCPVersion>
</properties>
<version>${slf4jVersion}</version>
</dependency>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysqlConnectorJVersion}</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>${hikariCPVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
16.1.12.1.7. Bill of Materials usage
For example the Custom Reflow Skin module uses the unittest BootStrapResponsiveStyleTest to log 1920
and bigger responsive css settings.
178
Project
Change the project parent to import the Bill of Materials dependency version settings in C:\dev\projects
\maven-skins\pom.xml:
</modules>
+
+
<properties>
<bomVersion>3.1-epsilon</bomVersion>
<mavenDefaultSkinVersion>1.1</mavenDefaultSkinVersion>
…
</properties>
+
+
+
+
+
+
+
+
+
+
+
+
<dependencyManagement>
<dependencies>
<dependency>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>bom</artifactId>
<version>${bomVersion}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Remove the now obsolete version settings in C:\dev\projects\maven-skins\maven-reflow-skin
\pom.xml:
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
-
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.2.0</version>
<scope>test</scope>
</dependency>
-
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
</dependencies>
16.1.12.2. Groups
Add the grouping parent module in C:\dev\projects\bill-of-materials\pom.xml:
</distributionManagement>
+
+
+
<modules>
<module>grouping</module>
179
Chapter 16.
+
</modules>
</project>
Create the minimal POM in C:\dev\projects\bill-of-materials\grouping\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven</groupId>
+
<artifactId>bom</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+ <artifactId>grouping</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes Maven Dependencies Grouping</name>
+ <description>
+
If you have a set of dependencies which are logically grouped together.
+
You can create a project with pom packaging
+
that groups dependencies together.
+ </description>
+ <inceptionYear>2015</inceptionYear>
+</project>
16.1.12.2.1. Common group
Add the Common module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<inceptionYear>2015</inceptionYear>
+
+
+
+
<modules>
<module>common</module>
</modules>
</project>
Group the Common
mon\pom.xml:
dependencies
in
C:\dev\projects\bill-of-materials\grouping\com-
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <artifactId>common</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes Common Dependencies</name>
+ <description>Grouping Common Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>org.projectlombok</groupId>
+
<artifactId>lombok</artifactId>
180
Project
+
</dependency>
+
+
<dependency>
+
<groupId>org.apache.commons</groupId>
+
<artifactId>commons-lang3</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>commons-codec</groupId>
+
<artifactId>commons-codec</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>commons-io</groupId>
+
<artifactId>commons-io</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>com.google.guava</groupId>
+
<artifactId>guava</artifactId>
+
</dependency>
+ </dependencies>
+</project>
Figure 16.7. Free Dumb Bytes Common Group
16.1.12.2.2. Spring group
Add the Spring module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<modules>
<module>common</module>
+
<module>spring</module>
</modules>
</project>
Group the Spring dependencies in C:\dev\projects\bill-of-materials\grouping\spring\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
181
Chapter 16.
+ <artifactId>spring</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes Spring Dependencies</name>
+ <description>Grouping Spring Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-jdbc</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-tx</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-context</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-aop</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-beans</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-core</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-context-support</artifactId>
+
</dependency>
+ </dependencies>
+</project>
Figure 16.8. Free Dumb Bytes Spring Group
16.1.12.2.3. Hibernate group
Add the Hibernate module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<modules>
182
Project
<module>common</module>
<module>spring</module>
+
<module>hibernate</module>
</modules>
</project>
Group the Hibernate
nate\pom.xml:
dependencies
in
C:\dev\projects\bill-of-materials\grouping\hiber-
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <artifactId>hibernate</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes Hibernate Dependencies</name>
+ <description>Grouping Hibernate Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>org.hibernate</groupId>
+
<artifactId>hibernate-core</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.hibernate</groupId>
+
<artifactId>hibernate-ehcache</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>net.sf.ehcache</groupId>
+
<artifactId>ehcache-core</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.javassist</groupId>
+
<artifactId>javassist</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>spring</artifactId>
+
<version>3.1-epsilon</version>
+
<type>pom</type>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-orm</artifactId>
+
</dependency>
+ </dependencies>
+</project>
183
Chapter 16.
Figure 16.9. Free Dumb Bytes Hibernate Group
16.1.12.2.4. Test group
Add the Test module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<module>common</module>
<module>spring</module>
<module>hibernate</module>
+
<module>test</module>
</modules>
</project>
Group the Test dependencies in C:\dev\projects\bill-of-materials\grouping\test\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <artifactId>test</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes Test Dependencies</name>
+ <description>Grouping Test Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>junit</groupId>
+
<artifactId>junit</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.assertj</groupId>
+
<artifactId>assertj-core</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.mockito</groupId>
+
<artifactId>mockito-all</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.powermock</groupId>
+
<artifactId>powermock-api-mockito</artifactId>
+
</dependency>
184
Project
+
+
<dependency>
+
<groupId>org.powermock</groupId>
+
<artifactId>powermock-module-junit4</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>spring</artifactId>
+
<version>3.1-epsilon</version>
+
<type>pom</type>
+
</dependency>
+
+
<dependency>
+
<groupId>org.springframework</groupId>
+
<artifactId>spring-test</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>cglib</groupId>
+
<artifactId>cglib</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>commons-dbcp</groupId>
+
<artifactId>commons-dbcp</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>com.h2database</groupId>
+
<artifactId>h2</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.hsqldb</groupId>
+
<artifactId>hsqldb</artifactId>
+
</dependency>
+ </dependencies>
+</project>
185
Chapter 16.
Figure 16.10. Free Dumb Bytes Test Group
The term Mock Objects has become a popular one to describe special case objects that mimic real objects for
testing.
Szczepan Faber and his own Monkey Island.
“Expect-run-verify is the most common pattern in mock frameworks. What's wrong with it?
Can I test what I want, please? I'm a mockist but existing mock frameworks just don't appeal
to me. They spoil my TDD experience. They harm code readability. I needed something better.
That's why I came up with Mockito.”
“I'm about to show that it is very useful to distinguish two basic kinds of interactions: asking
an object of data and telling an object to do something. Fair enough, it may sound obvious
but most mocking frameworks treat all interactions equally and don't take advantage of the
distinction.”
• Mockito - The New Mock Framework on the Block
• Mockito - one of the better mocks
• Mocks and Stubs aren't Spies
•
Mocks Aren't Stubs
• On PowerMock abuse.
16.1.12.2.5. Log group
Add the Log module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<module>spring</module>
<module>hibernate</module>
<module>test</module>
+
<module>log</module>
</modules>
</project>
Group the Log dependencies in C:\dev\projects\bill-of-materials\grouping\log\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
186
Project
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <artifactId>log</artifactId>
+
+ <name>Free Dumb Bytes Log Dependencies</name>
+ <description>Grouping Log Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>log4j</groupId>
+
<artifactId>log4j</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>commons-logging</groupId>
+
<artifactId>commons-logging</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.slf4j</groupId>
+
<artifactId>slf4j-api</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.slf4j</groupId>
+
<artifactId>slf4j-log4j12</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.slf4j</groupId>
+
<artifactId>jcl-over-slf4j</artifactId>
+
</dependency>
+ </dependencies>
+</project>
Note
This artifact has default packaging jar instead of type pom because a default log4j.xml is supplied for test usage (see also type in the figure below).
187
Chapter 16.
Figure 16.11. Free Dumb Bytes Log Group
The above mentioned default implementation of C:\dev\projects\bill-of-materials\grouping\log
\src\main\resources\log4j.xml:
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM
+ "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/
log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+ <appender name="STDOUT" class="org.apache.log4j.ConsoleAppender">
+
<layout class="org.apache.log4j.PatternLayout">
+
<param name="ConversionPattern" value="%d %-5p [%t] %c{2} %x - %m%n" />
+
</layout>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+
<param name="File" value="target/test.log4j"/>
+
<param name="Append" value="false"/>
+
<param name="MaxFileSize" value="100MB"/>
+
<param name="MaxBackupIndex" value="5"/>
+
<layout class="org.apache.log4j.PatternLayout">
+
<param name="ConversionPattern" value="%d %-5p [%t] %c{2} %x - %m%n"/>
+
</layout>
+ </appender>
+
+ <logger name="org.hibernate">
+
<level value="ERROR"/>
+ </logger>
+
+ <logger name="org.hibernate.SQL">
+
<level value="ERROR" />
+ </logger>
+
+ <logger name="org.hibernate.type">
+
<level value="ERROR" />
+ </logger>
+
+ <root>
+
<level value="INFO"/>
+
<appender-ref ref="FILE"/>
+
<appender-ref ref="STDOUT"/>
188
Project
+ </root>
+</log4j:configuration>
16.1.12.2.6. MySQL group
Add the MySQL module in C:\dev\projects\bill-of-materials\grouping\pom.xml:
<module>hibernate</module>
<module>test</module>
<module>log</module>
+
<module>mysql</module>
</modules>
</project>
Group the MySQL dependencies in C:\dev\projects\bill-of-materials\grouping\mysql\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
+
<artifactId>grouping</artifactId>
+
<version>3.1-epsilon</version>
+ </parent>
+
+ <artifactId>mysql</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes MySQL Dependencies</name>
+ <description>Grouping MySQL Dependencies.</description>
+ <inceptionYear>2015</inceptionYear>
+
+ <dependencies>
+
<dependency>
+
<groupId>mysql</groupId>
+
<artifactId>mysql-connector-java</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>com.zaxxer</groupId>
+
<artifactId>HikariCP</artifactId>
+
</dependency>
+
+
<dependency>
+
<groupId>org.javassist</groupId>
+
<artifactId>javassist</artifactId>
+
</dependency>
+ </dependencies>
+</project>
189
Chapter 16.
Figure 16.12. Free Dumb Bytes MySQL Group
16.1.12.2.7. Groups usage
For example the Custom Reflow Skin module uses the unittest BootStrapResponsiveStyleTest to log 1920
and bigger responsive css settings and is already using a Bill of Materials (see also Section 16.1.12.1.7, “Bill of
Materials usage”).
Change the project to use dependencies grouping and to allow to separately upgrade the Bill of Materials introduce a groupVersion property in C:\dev\projects\maven-skins\pom.xml:
+
<properties>
<bomVersion>3.1-epsilon</bomVersion>
<groupVersion>${bomVersion}</groupVersion>
<mavenDefaultSkinVersion>1.1</mavenDefaultSkinVersion>
…
</properties>
Replace the specific dependencies with a dependencies grouping in C:\dev\projects\maven-skins\mavenreflow-skin\pom.xml:
+
+
+
+
+
+
+
190
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
<artifactId>log</artifactId>
<version>${groupVersion}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>net.dev.freedumbytes.maven.dependencies</groupId>
<artifactId>test</artifactId>
<version>${groupVersion}</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
Project
-
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
16.1.13. M2Eclipse lifecycle configuration
Start a new bare Git repository lifecycle-mapping by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git lifecycle-mapping.git "Eclipse workspace project configuration and behaviour during Eclipse workspace build." -jenkinsHook in Git Bash (see
also repository branches/lifecycle-mapping).
To avoid “Plugin execution not covered by lifecycle configuration” error messages and POMs cluttered
with <artifactId>lifecycle-mapping</artifactId> entries create a metadata file C:\dev\projects\lifecycle-mapping\src\config\lifecycle-mapping-metadata.xml (see also GitHub eclipse/m2e-core):
+<?xml version="1.0" encoding="UTF-8"?>
+
+<lifecycleMappingMetadata>
+ <lifecycleMappings>
+
<lifecycleMapping>
+
<packagingType>war</packagingType>
+
<lifecycleMappingId>
+
org.eclipse.m2e.jdt.JarLifecycleMapping
+
</lifecycleMappingId>
+
</lifecycleMapping>
+ </lifecycleMappings>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<goals>
<goal>resources</goal>
<goal>testResources</goal>
<goal>copy-resources</goal>
</goals>
<versionRange>[2.4,)</versionRange>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute>
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<goals>
<goal>resources</goal>
<goal>testResources</goal>
<goal>copy-resources</goal>
</goals>
<versionRange>[0.0.1,2.4)</versionRange>
</pluginExecutionFilter>
<action>
<error>
<message>
maven-resources-plugin prior to 2.4 is not supported by m2e.
Use maven-resources-plugin version 2.4 or later.
</message>
</error>
</action>
</pluginExecution>
+
<pluginExecution>
191
Chapter 16.
192
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<goals>
<goal>copy-dependencies</goal>
<goal>unpack</goal>
</goals>
<versionRange>[2.0,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<goals>
<goal>enforce</goal>
</goals>
<versionRange>[1.0-alpha-1,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<goals>
<goal>install</goal>
</goals>
<versionRange>[1.6-SONATYPE-r940877,)</versionRange>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-remote-resources-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>configure-workspace</goal>
<goal>eclipse</goal>
<goal>clean</goal>
<goal>to-maven</goal>
<goal>install-plugins</goal>
<goal>make-artifacts</goal>
Project
+
+
+
+
+
+
+
+
+
+
+
+
+
<goal>myeclipse</goal>
<goal>myeclipse-clean</goal>
<goal>rad</goal>
<goal>rad-clean</goal>
</goals>
</pluginExecutionFilter>
<action>
<error>
<message>maven-eclipse-plugin is not compatible with m2e</message>
</error>
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<versionRange>[2.0,)</versionRange>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
<!-- theoretically, the following goals should not be bound to
lifecycle,
+
but ignore them just in case -->
+
<goal>jar</goal>
+
<goal>aggregate</goal>
+
<goal>test-jar</goal>
+
</goals>
+
</pluginExecutionFilter>
+
<action>
+
<ignore />
+
</action>
+
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>check</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<versionRange>[1.0-beta-1,)</versionRange>
<goals>
<goal>create</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<versionRange>[0.7.0.201403182114,)</versionRange>
<goals>
<goal>prepare-agent</goal>
193
Chapter 16.
+
+
+
+
+
+
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-style-plugin</artifactId>
<versionRange>[2.0.0,)</versionRange>
<goals>
<goal>resources</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<versionRange>[2.3.7,)</versionRange>
<goals>
<goal>resources</goal>
<goal>generate</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<versionRange>[1.0,)</versionRange>
<goals>
<goal>upload</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
+
<pluginExecution>
+
<pluginExecutionFilter>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-toolchains-plugin</artifactId>
+
<versionRange>[1.0,)</versionRange>
+
<goals>
+
<goal>toolchain</goal>
+
</goals>
+
</pluginExecutionFilter>
+
<action>
+
<ignore />
+
</action>
+
</pluginExecution>
+ </pluginExecutions>
+</lifecycleMappingMetadata>
Finally configure a profile to download the latest deployed metadata.xml in this project C:\dev\projects
\lifecycle-mapping\pom.xml:
<artifactId>lifecycle-mapping</artifactId>
194
Project
<version>1.0-lambda</version>
…
+
+
+
<properties>
<latestLifecycelMappingVersion>1.0-lambda</latestLifecycelMappingVersion>
</properties>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<profiles>
<profile>
<id>downloadLifecycleMapping</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>m2e-lifecycle-mapping</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>${latestLifecycelMappingVersion}</version>
<classifier>metadata</classifier>
<type>xml</type>
<outputDirectory>${maven.home}/conf</outputDirectory>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
<localRepositoryDirectory>
${project.build.directory}/tempRepo
</localRepositoryDirectory>
<stripVersion>true</stripVersion>
<stripClassifier>false</stripClassifier>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>attach-lifecycle-mapping</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${basedir}/src/config/lifecycle-mapping-metadata.xml</
file>
195
Chapter 16.
<classifier>metadata</classifier>
<type>xml</type>
</artifact>
To use this metadata.xml, first deploy it to Nexus with Maven Release and then download the latestLifecycelMappingVersion to current Maven config folder with mvn process-resources -PdownloadLifecycleMapping. Configure Eclipse Window → Preferences → Maven → Lifecycle Mappings and point file location to P:\dev\apps\build\apache-maven-3.3.9\conf\lifecycle-mapping-metadata.xml:
Figure 16.13. Eclipse Maven Lifecycle Mappings
Don't forget to Reload the configuration every time this file is edited or the latest release is downloaded. And
select Maven → Update Project Configuration… Alt+F5 for projects that were having errors with any newly
added pluginExecutionFilters.
16.1.14. Application Integration overview
The Development Production Line in screenshots:
Figure 16.14. Maven Setup About
196
Project
Figure 16.15. Nexus Maven Setup Release 2.0
Figure 16.16. Git Maven Setup Tags
197
Chapter 16.
Figure 16.17. Eclipse Task MVNSTP-20
Figure 16.18. Jenkins View Component
Figure 16.19. Jenkins Maven Setup Build
198
Project
Figure 16.20. Jenkins Maven Setup Build Changes
Figure 16.21. JIRA Issue MVNSTP-20
Figure 16.22. FishEye Revisions MVNSTP-20
199
Chapter 16.
Figure 16.23. FishEye Changeset MVNSTP-20
Figure 16.24. FishEye Maven Setup Commit Graph
200
Chapter 17.
Chapter 17. Quality Assurance
Quality Assurance, or QA for short, refers to planned and systematic production processes that provide confidence in a product's suitability for its intended purpose.
17.1. Maven reports
Instead of configuring the Maven Quality Assurance plugins, of which the output requires a lot of click around
between those reports (see also screenshots) and the cross-reference, combine that information using SonarQube
for better evaluation.
17.2. SonarQube
SonarQube is an open platform to manage code quality. As such, it covers the 7 axes of code quality.
17.2.1. Resources
• Download SonarQube.
• Setup and browsing SonarQube and Projects Drilling Down.Viewing Historical Information, Differential Views,
Issues, Measures and Rules or Pre-commit Check with SonarLint.
• Upgrade checklist:
• Related products: -.
• References: -.
• Integration configuration changes: SonarQube - installation guide SONARQUBE_HOME /
sonar.properties, SonarQube - Temp folder issue temp-wrapper, SonarQube - Rolling policy of log
files, SonarQube - Database settings sonar.properties, SonarQube - Windows Service wrapper.conf
/ Log On and SonarQube - upgrading.
Note
Or just run p:\dev\apps\editor\winmerge\WinMergeU.exe p:\dev\apps\qa
\sonarqube-5.5\conf
p:\dev\apps\qa\sonarqube-5.3\conf to copy the
changes in for example sonar.properties and wrapper.conf.
Note
And
with
p:\dev\apps\editor\winmerge\WinMergeU.exe
p:
\dev\apps\qa\sonarqube-5.5\extensions\plugins
p:\dev\apps\qa
\sonarqube-5.3\extensions\plugins copy installed plugins such as for example
sonar-java-plugin-x.y.jar, sonar-scm-git-plugin-x.y.jar, sonar-scmsvn-plugin-x.y.jar, sonar-widget-lab-plugin-x.y.jar and sonar-dependency-check-plugin-x.y.z.jar. Check the Compatibility Matrix for plugins compatibility and manually upgrade the plugins if necessary.
• SonarQube Products News, Roadmap, Documentation, Features, Quality Profiles, Blog, Plugin Library and Frequently Asked Questions (see also screenshots for example 5.4).
• SonarQube Java Analyzer : The Only Rule Engine You Need.
• Project Space which puts the focus on the Quality Gate and Leak Period concepts.
• Water Leak Changes the Game for Technical Debt Management.
• Web Service API to make it possible to implement a build-breaker strategy on any system.
• SonarQube JavaScript plugin: why compete with JSLint and JSHint?
17.2.1.1. Security resources
The Java Plugin enables analysis of Java projects. It offers more than 300 rules provided by SonarSource, which
span coding conventions, bug detection, and security problems, including coverage of some CERT and CWE rules,
including several from the SANS TOP 25 Most Dangerous Software Errors, as well as some OWASP Top Ten vulnerabilities. This plugin is CWE Compatible, which means that you can search for rules in the plugin that are related to CWE items.
The Open Web Application Security Project (OWASP) is a 501(c)(3) worldwide not-for-profit charitable organization focused on improving the security of software. Our mission is to make software security visible, so that
individuals and organizations worldwide can make informed decisions about true software security risks.
The first goal of the OWASP SonarQube Project is to a create a referential of check specifications targeting
OWASP vulnerabilities and that can be detected by SAST tools (Static Application Security Testing). From there,
the second goal is to provide a reference implementations of most of those checks in the Open Source SonarQube
201
Chapter 17.
language analyzers (Java, JavaScript, PHP and C#). The News is updated as soon as a SonarQube analyzers containing some stuff relating to this OWASP SonarQube project is released.
The Projects pages are constantly being updated. Some pages may contain outdated information. You can help
OWASP to keep these pages current by visiting FixME:
• OWASP Zed Attack Proxy (ZAP) is one of the world's most popular free security tools. It can help you automatically find security vulnerabilities in your web applications while you are developing and testing your applications. Its also a great tool for experienced pentesters to use for manual security testing.
• OWASP Web Testing Environment (WTE), is a collection of application security tools and documentation available in multiple formats such as VMs, Linux distribution packages, Cloud-based installations and ISO images.
• OWASP Offensive Web Testing Framework (OWTF) is a project focused on penetration testing efficiency and
alignment of security tests to security standards like: The OWASP Testing Guide (v3 and v4), the OWASP Top
10, PTES and NIST.
• Dependency-Check is a utility that identifies project dependencies and checks if there are any known, publicly disclosed, vulnerabilities. Currently Java, .NET, Ruby, Node.js, and Python projects are supported; additionally, limited support for C/C++ projects (see also Section 16.1.7.8, “OWASP Dependency Check” and Section 17.2.4.1, “Update Center”).
• OWASP Testing Project and Testing Guide v4.
• OWASP Cheat Sheet Series was created to provide a concise collection of high value information on specific
web application security topics. These cheat sheets were created by various application security professionals
who have expertise in specific topics.
17.2.2. SonarQube installation guide
Download the archive: sonarqube-5.5.zip [version 5.5].
Important
Better skip version 5.4 because of reverse proxy issue with SONAR-7122 Drop the ability to customize the web app context and wait for 5.5 (SONAR-7494 Reintroduce the web app context) and
hope they don't do it again in 6.x.
Alternatively create a subdomain sonarqube.freedumbytes.dev.net and redirect
freedumbytes.dev.net/sonarqube there (see also Section 7.1.9.1.1.1, “Subdomain sample”). But
this subdomain will required extra login.
Extract this .zip file to P:\dev\apps\qa.
Press +Break keys to open the Windows System Properties. Select Advanced system settings → Environment
Variables and add a New system variable SONARQUBE_HOME pointing to P:\dev\apps\qa\sonarqube-5.5.
Change the context , the listening port
and restricted to localhost
\dev\apps\qa\sonarqube-5.5\conf\sonar.properties:
by editing the configuration file P:
#-----------------------------------------------------------------------------# WEB SERVER
# Web server is executed in a dedicated Java process.
# By default heap size is 768Mb.
# Use the following property to customize JVM options.
#
Recommendations:
#
#
The HotSpot Server VM is recommended. The property -server should be added
#
if server mode is not enabled by default on your environment:
#
http://docs.oracle.com/javase/7/docs/technotes/guides/vm/server-class.html
#
#sonar.web.javaOpts=-Xmx512m -Xms128m -XX:MaxPermSize=160m ^
#
-XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
sonar.web.javaOpts=-Xmx512m -XX:+HeapDumpOnOutOfMemoryError -server
…
# Binding IP address. For servers with more than one IP address, this property
# specifies which address will be used for listening on the specified ports.
# By default, ports will be used on all IP addresses associated with the server.
sonar.web.host=127.0.0.1
# Web context. When set, it must start with forward slash
# (for example /sonarqube).
# The default value is root context (empty value).
sonar.web.context=/sonarqube
202
Quality Assurance
# TCP port for incoming HTTP connections. Disabled when value is -1.
sonar.web.port=8072
…
# COMPUTE ENGINE
# The Compute Engine is responsible for processing background tasks.
#sonar.ce.javaOpts=-Xmx512m -Xms128m -XX:MaxPermSize=160m ^
#
-XX:+HeapDumpOnOutOfMemoryError -Djava.net.preferIPv4Stack=true
sonar.web.javaOpts=-Xmx512m -XX:+HeapDumpOnOutOfMemoryError -server
# Same as previous property,
# but allows to not repeat all other settings like -Xmx
#sonar.ce.javaAdditionalOpts=
# The number of workers in the Compute Engine.
# Value must be greater than zero.
# By default the Compute Engine uses a single worker
# and therefore processes tasks one at a time.
#sonar.ce.workerCount=1
…
# ELASTICSEARCH
# Elasticsearch is used to facilitate fast and accurate information retrieval.
#sonar.search.javaOpts=-Xmx1G -Xms256m -Xss256k -Djava.net.preferIPv4Stack=true \
# -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75
\
# -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError
sonar.search.javaOpts=-Xmx1G -Xms256m -Xss256k \
-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75
\
-XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -server
# Same as previous property, but allows to not repeat all other settings like Xmx
#sonar.search.javaAdditionalOpts=
# Elasticsearch port. Default is 9001. Use 0 to get a free port.
# As a security precaution, should be blocked by a firewall
# and not exposed to the Internet.
#sonar.search.port=9001
sonar.search.port=8073
# Elasticsearch host. The search server will bind this address
# and the search client will connect to it.
# Default is 127.0.0.1.
# As a security precaution,
# should NOT be set to a publicly available address.
#sonar.search.host=127.0.0.1
17.2.2.1. Temp folder issue
When running the Java Service Wrapper as a Local System account the following error occurs “WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Temp directory is not writable: C:
\Windows\system32\config\systemprofile\AppData\Local\Temp\”. To prevent this use This account to Log On
(see also Section 17.2.6, “Windows service”) and edit the following entry
in the service wrapper configuration
file P:\dev\apps\qa\sonarqube-5.5\conf\wrapper.conf:
#********************************************************************
# Wrapper Java
#********************************************************************
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Djava.io.tmpdir=%SONARQUBE_HOME%\temp-wrapper
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
Don't forget to create it: mkdir %SONARQUBE_HOME%\temp-wrapper.
17.2.2.2. Rolling policy of log files
Enable the rolling policy
and max number of files
\sonarqube-5.5\conf\sonar.properties:
by editing the configuration file P:\dev\apps\qa
203
Chapter 17.
#-------------------------------------------------------------------------------# LOGGING
# Level of logs. Supported values are INFO(default), DEBUG and TRACE
# (DEBUG + SQL + ES requests)
#sonar.log.level=INFO
# Path to log files. Can be absolute or relative to installation directory.
# Default is <installation home>/logs
#sonar.path.logs=logs
# Rolling policy of log files
#
- based on time if value starts with "time:",
#
for example by day ("time:yyyy-MM-dd")
#
or by month ("time:yyyy-MM")
#
- based on size if value starts with "size:", for example "size:10MB"
#
- disabled if value is "none".
#
That needs logs to be managed by an external system like logrotate.
sonar.log.rollingPolicy=time:yyyy-MM-dd
# Maximum number of files to keep if a rolling policy is enabled.
#
- maximum value is 20 on size rolling policy
#
- unlimited on time rolling policy. Set to zero to disable old file purging.
sonar.log.maxFiles=7
17.2.2.3. Database settings
Create a MySQL user called sonarqube-user and database called sonarqube with the following commands:
mysql -u root -p
mysql> create database sonarqube character set utf8mb4 collate
utf8mb4_unicode_ci;
mysql> grant select, insert, update, delete, create, drop, alter, index on
sonarqube.*
-> to 'sonarqube-user'@'localhost' identified by 'password';
mysql> flush privileges;
mysql> select host,user from mysql.user;
mysql> select host,db,user from mysql.db;
mysql> select * from information_schema.schemata where schema_name = 'sonarqube';
mysql> quit
Configure the SonarQube application server to connect to MySQL (instead of using the H2 embedded database)
with url jdbc:mysql://localhost:3306/sonarqube?
useUnicode=true
&characterEncoding=utf8 &rewriteBatchedStatements=true &useConfigs=maxPerformance by
editing the configuration file P:\dev\apps\qa\sonarqube-5.5\conf\sonar.properties:
#--------------------------------------------------------------------------# DATABASE
…
# User credentials.
# Permissions to create tables, indices and triggers must be granted
# to JDBC user.
# The schema must be created first.
sonar.jdbc.username=sonarqube-user
sonar.jdbc.password=password
…
#----- Embedded Database (default)
# H2 embedded database server listening port, defaults to 9092
#sonar.embeddedDatabase.port=9092
…
#----- MySQL 5.x
# Only InnoDB storage engine is supported (not myISAM).
# Only the bundled driver is supported. It can not be changed.
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonarqube?…
(see jdbc url above)
204
Quality Assurance
…
#----- Connection pool settings
# The maximum number of active connections that can be allocated
# at the same time, or negative for no limit.
# The recommended value is 1.2 * max sizes of HTTP pools.
# For example if HTTP ports are enabled with default sizes
# (50, see property sonar.web.http.maxThreads)
# and sonar.web.https.maxThreads) then sonar.jdbc.maxActive
# should be 1.2 * (50) = 60.
sonar.jdbc.maxActive=60
# The maximum number of connections that can remain idle in the
# pool, without extra ones being released, or negative for no limit.
sonar.jdbc.maxIdle=5
# The minimum number of connections that can remain idle in the pool,
# without extra ones being created, or zero to create none.
sonar.jdbc.minIdle=2
# The maximum number of milliseconds that the pool will wait (when there
# are no available connections) for a connection to be returned before
# throwing an exception, or <= 0 to wait indefinitely.
sonar.jdbc.maxWait=5000
#sonar.jdbc.minEvictableIdleTimeMillis=600000
#sonar.jdbc.timeBetweenEvictionRunsMillis=30000
Important
Don't forget to comment the lines
and
to deactivate the default embedded database
settings. Drivers for the supported databases (except Oracle) are already provided (see also P:
\dev\apps\qa\sonarqube-5.5\lib\jdbc\mysql). Do not replace the provided drivers;
because they are the only ones supported.
17.2.3. Upgrading
After starting SonarQube with %SONARQUBE_HOME%\bin\windows-x86-64\StartSonar.bat or as Windows
service browse to http://localhost:8072/sonarqube/setup or http://freedumbytes.dev.net/sonarqube/setup to
upgrade the database (see also Upgrade guide).
Also browse to the Update Center at http://freedumbytes.dev.net/sonarqube/updatecenter/installed because of
the following errors that might occur after upgrading:
1. “[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0:sonar …: No quality
profiles have been found, you probably don't have any language plugin installed.” when the Java Plugin is not
installed.
2. “[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0:sonar …: Unable to register extension org.sonar.plugins.java.JavaSquidSensor: Lorg/sonar/api/checks/NoSonarFilter;:
org.sonar.api.checks.NoSonarFilter” when the installed Java Plugin is too old.
17.2.4. SonarQube configuration
Verify the installation by running %SONARQUBE_HOME%\bin\windows-x86-64\StartSonar.bat.
Verify that the server is running in your browser at http://localhost:8072/sonarqube or in case of subdomain usage
http://localhost:8072. Click Log in as admin with password admin. Click Administrator → My profile to Change
password.
17.2.4.1. Update Center
After logging in as admin select Administration → System → Update Center → Available and for example select
the following plugins from the SonarQube Plugin Library:
• By default the Java plugin is provided with SonarQube. You can upgrade it from the Update Center or download the latest release from this page.
• The same holds true for SVN Plugin and Git Plugin.
• Widget Lab Plugin adds a Measure history bar chart and improves number formatting in security tag widgets.
• Timeline Plugin displays metric history in a widget that uses the Google Visualization Annotated TimeLine
component (requires internet access).
205
Chapter 17.
• Motion Chart Plugin offers two widgets that display the evolution over time of four predefined metrics (two
axes + bubble color + bubble size) (requires internet access).
Or drop other plugins (that are not available in the Update Center) or an external plugin (from for example excentia) just in P:\dev\apps\qa\sonarqube-5.5\extensions\plugins:
• OWASP Dependency Check Plugin (download) integrates OWASP Dependency Check reports into SonarQube.
• 3D Code Metrics is a SonarQube extension which allows the visual representation of a software project in 3D
in order to detect anomalies.
Restart SonarQube.
17.2.4.2. Settings
Select Administration → Configuration → General Settings and configure:
• General:
• Server base URL: http://freedumbytes.dev.net/sonarqube and Save General Settings.
• Email:
• SMTP host: mail.freedumbytes.dev.net.
• SMTP port: 25.
• Use secure connection: No.
• From address: [email protected].
• Email prefix: [SONARQUBE] and Save Email Settings.
• Look & Feel:
• Enable support of gravatars: False.
• Logo
URL:
http://freedumbytes.dev.net/mvn-sites/maven-setup/images/logos/shadowrun.png.
• Width of image in pixels: 110 and Save Look & Feel Settings.
17.2.4.3. Users
To enable connecting from Eclipse with SonarLint select Administration → Security → Users and Create User:
•
•
•
•
Login: jjasper.
Name: Jene Jasper.
Email: [email protected].
Password: password and click Create.
17.2.4.4. Quality Gates
The Quality Gates page is the place to define your requirements on projects. Select Quality Gates → SonarQube
way and configure:
• When upgrading there might be no default set. In that case click Set as Default when for example SonarQube
way is selected.
• Delete condition New Blocker issues.
• And replace it with Add condition: Blocker issues with Value that is greater than Errror Threshold 0.
17.2.4.5. Module Key
In case of the following error “org.sonar.api.utils.MessageException: Validation of project
failed: o Module "net.dev.freedumbytes.manual.maven:java-se-3-base-pom" is already part of project
"net.dev.freedumbytes.manual.maven:setup"” when it is for example moved to another project:
Figure 17.1. SonarQube background tasks
206
Quality Assurance
causing the background task to fail:
Figure 17.2. SonarQube background task log
To fix this issue just rename the old module key:
Figure 17.3. SonarQube module update key
17.2.5. Apache configuration
Instruct Apache to proxy all URLs whose path portions begin with /sonarqube/ using the following P:\dev
\apps\httpserver\apache-conf\httpd-vhosts.conf include
:
<VirtualHost *:80>
…
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Proxy *>
…
</Proxy>
# SonarQube
Include ../apache-conf/httpd-sonarqube.conf
</IfModule>
</IfModule>
</VirtualHost>
with the following content in P:\dev\apps\httpserver\apache-conf\httpd-sonarqube.conf:
<IfModule proxy_module>
<IfModule proxy_http_module>
ProxyPass /sonarqube
http://localhost:8072/sonarqube
ProxyPassReverse /sonarqube http://localhost:8072/sonarqube
<Location /sonarqube>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
</IfModule>
207
Chapter 17.
</IfModule>
Because since version 5.2 the server is in charge to process reports submitted by batch analysis, allow anonymous access from the local area network
to the following URIs in P:\dev\apps\httpserver\apacheconf\httpd-sonarqube.conf:
<IfModule proxy_module>
<IfModule proxy_http_module>
…
<Location /sonarqube>
Include ../apache-conf/httpd-freedumbytes-realm.conf
</Location>
<Location /sonarqube/batch_bootstrap/>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
<Location /sonarqube/batch/>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
<Location /sonarqube/deploy/plugins/>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
<Location /sonarqube/api/>
<RequireAll>
Include ../apache-conf/httpd-lan-access.conf
</RequireAll>
</Location>
To monitor the queue of pending reports to process and the history of past analysis select Administration →
Projects → Background Tasks.
When the Apache HTTP Server is restarted you should be able to browse SonarQube at http://
freedumbytes.dev.net/sonarqube.
17.2.6. Windows service
To restart automatically on Microsoft Windows, create a Windows service. Use the Tanuki Java Service Wrapper
shipped with SonarQube.
Optionally edit the following entries
\sonarqube-5.5\conf\wrapper.conf:
in the service wrapper configuration file P:\dev\apps\qa
# Path to JVM executable. By default it must be available in PATH.
# Can be an absolute path, for example:
#wrapper.java.command=/path/to/my/jdk/bin/java
wrapper.java.command=P:\dev\apps\prg\java-x64\jdk1.8.0_74\bin\java
…
#********************************************************************
# Wrapper Java
#********************************************************************
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Djava.io.tmpdir=%SONARQUBE_HOME%\temp-wrapper
(see above Section 17.2.2.1, “Temp folder
issue”)
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
…
#********************************************************************
# Wrapper Windows Properties
208
Quality Assurance
#********************************************************************
# Title to use when running as a console
wrapper.console.title=SonarQubefreedumbytes.dev.net SonarQube
…
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=SonarQubesonarqube
# Display name of the service
wrapper.ntservice.displayname=freedumbytes.dev.net SonarQube
# Description of the service
wrapper.ntservice.description=SonarQube is an open source quality management
platform.
Register the SonarQube service with the command in an elevated command processor: %SONARQUBE_HOME%\bin
\windows-x86-64\InstallNTService.bat. Start SonarQube with net start sonarqube.
Note
In case of an upgrade sc delete sonarqube first (see also Section 1.1.5, “Task Manager
replacement” in case of “The specified service has been marked for deletion.”).
Important
In case of a new jdk installation use an elevated command prompt just run net stop sonarqube and net start sonarqube. Verify the upgrade at http://freedumbytes.dev.net/sonarqube/system.
17.2.6.1. Log On Windows user
For the same reason as Section 8.1.3.1, “Log On Windows user” launch the Service Management Console with
services.msc. Right click on freedumbytes.dev.net SonarQube and select Properties → Log On to use This
account .\Tomcat. After password conformation click Apply and restart the service.
17.2.7. Maven integration
Configure Maven Setup project in C:\dev\projects\maven-setup\pom.xml to enable command line action
mvn sonar:sonar. The SonarQube Maven Plugin triggers the code analyzers using Analysis Parameters and the
SonarQube Maven Report Plugin adds a report link to the Maven site, that redirects to the project dashboard in
SonarQube (see also Section 17.2.5, “Apache configuration” about allowing anonymous access to SonarQube for
the batch analysis to submit the process reports):
+
+
+
+
+
+
+
+
+
+
+
<properties>
<devHost>http://freedumbytes.dev.net</devHost>
…
<nexusHost>http://freedumbytes.dev.net/nexus</nexusHost>
<sonarHost>http://freedumbytes.dev.net/sonarqube</sonarHost>
<sonar.host.url>${sonarHost}</sonar.host.url>
<sonar.jacoco.reportPath>
${coverageReportsPathUnit}
</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPath>
${coverageReportsPathIntegration}
</sonar.jacoco.itReportPath>
<sonar.dependencyCheck.reportPath>
${project.build.directory}/dependency-check-report.xml
209
Chapter 17.
+
+
+
+
</sonar.dependencyCheck.reportPath>
<sonar.sourceEncoding>UTF-8</sonar.sourceEncoding>
…
<mavenProjectInfoReportsPluginVersion>
2.8.1
</mavenProjectInfoReportsPluginVersion>
<sonarMavenPluginVersion>2.7.1</sonarMavenPluginVersion>
<mavenSonarReportPluginVersion>0.1</mavenSonarReportPluginVersion>
<wagonMavenPluginVersion>1.0</wagonMavenPluginVersion>
<wagonFtpVersion>2.10</wagonFtpVersion>
<wagonWebdavJackrabbitVersion>2.10</wagonWebdavJackrabbitVersion>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${mavenSitePluginVersion}</version>
…
</plugin>
+
+
+
+
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>${sonarMavenPluginVersion}</version>
</plugin>
</plugins>
</pluginManagement>
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.codehaus.sonar-plugins</groupId>
<artifactId>maven-report</artifactId>
<version>${mavenReportSonarPluginVersion}</version>
<configuration>
<sonarHostURL>${sonarHost}</sonarHostURL>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
Update the site descriptor in C:\dev\projects\maven-setup\src\site\site.xml:
+
<menu name="Free Dumb Bytes" inherit="top">
…
<item name="Nexus" href="${nexusHost}" />
<item name="SonarQube" href="${sonarHost}" />
17.2.8. Jenkins integration
It is no longer recommended to use SonarQube maven builder. It is preferable to set up SonarQube in the build
environment and use a standard Jenkins maven target:
17.2.9. Maven vs SonarQube Quality Assurance reports comparison
To get an idea of the difference between the Quality Assurance reports of Maven and SonarQube take a look at
the following screenshots:
210
Quality Assurance
Figure 17.4. Maven Quality Assurance Sandbox FindBugs Report
Figure 17.5. Maven Quality Assurance Sandbox PMD Report
211
Chapter 17.
Figure 17.6. Maven Quality Assurance Sandbox Checkstyle Report
Figure 17.7. Maven Quality Assurance Sandbox JXR Source XRef (still remembered what violation at
which line?)
212
Quality Assurance
Figure 17.8. Maven Quality Assurance Sandbox SonarQube
Figure 17.9. Maven Quality Assurance Sandbox SonarQube Code Violations
213
Chapter 17.
Figure 17.10. Maven Quality Assurance Sandbox SonarQube Code Violations Drilldown (all violations
at one glance)
214
Quality Assurance
Figure 17.11. Maven Quality Assurance Sandbox SonarQube Dashboard
215
Chapter 17.
Figure 17.12. Maven Quality Assurance Sandbox SonarQube OWASP Dependency Check
Figure 17.13. Maven Quality Assurance Sandbox SonarQube Timemachine
216
Quality Assurance
Figure 17.14. Maven Quality Assurance Sandbox SonarQube Measures
17.3. jDocBook
The purpose of the jDocBook Plugin is to allow the DocBook transformations to occur as a natural part of the
users Maven build. It is used to create this documentation from the master.xml (for more resources see also
Section 5.1, “DocBook”).
17.3.1. Docbook configuration
Lets setup a base configuration, for Maven Docbooks to come, with the following JIRA project:
• Maven Docbook [MVNDBK]: Maven DocBook configuration (see also repository branches/maven-docbook).
With the following components:
1. docbook: Common setup for all DocBook documentation.
2. example: Pressgang Tools example.
and versions:
• 3.0-alpha - HTML and PDF generation with Pressgang Tools example.
Start a new bare Git repository maven-docbook by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git maven-docbook.git "Maven docbook configuration" jenkinsHook in Git Bash.
217
Chapter 17.
Clone this remote repository with the following command git-clone jjasper maven-docbook.
Start out with the Look and Feel of the
PressGang, which is the centralized hub JBoss projects can use to get
assistance with documentation. If you have any questions about writing professional open source documentation
using DocBook XML, you've come to the right place to have them answered.
Create the maven-docbook initial settings POM in C:\dev\projects\maven-docbook\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven</groupId>
+
<artifactId>base-pom</artifactId>
+
<version>3.1-beta</version>
+ </parent>
+
+ <groupId>net.dev.freedumbytes.documentation</groupId>
+ <artifactId>docbook</artifactId>
+ <version>3.0-alpha</version>
+ <packaging>pom</packaging>
+
+ <name>Free Dumb Bytes DocBook Documentation</name>
+ <description>
+
Common setup for all Free Dumb Bytes DocBook documentation.
+ </description>
+ <url>${mavenHost}/maven-docbook</url>
+ <inceptionYear>2010</inceptionYear>
218
+
+
+
+
+
+
+
<scm>
<developerConnection>
scm:git:${gitHost}/maven-docbook.git
</developerConnection>
<url>${fisheyeHost}/browse/maven-docbook</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/maven-docbook</url>
</ciManagement>
+
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/MVNDBK</url>
</issueManagement>
+
+
+
+
+
+
+
<distributionManagement>
<site>
<id>mvn-sites</id>
<name>Maven Documentation Sites</name>
<url>dav:${mavenHost}/maven-docbook</url>
</site>
</distributionManagement>
+
+
+
<properties>
<translation>en-US</translation>
</properties>
+
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
Quality Assurance
+
+
+
<artifactId>maven-jdocbook-plugin</artifactId>
<version>2.3.9</version>
<extensions>true</extensions>
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependencies>
<dependency>
<groupId>org.jboss.pressgang</groupId>
<artifactId>pressgang-jdocbook-style</artifactId>
<type>jdocbook-style</type>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.jboss.pressgang</groupId>
<artifactId>pressgang-xslt-ns</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<configuration>
<sourceDirectory>${project.basedir}/src/docbook</sourceDirectory>
<sourceDocumentName>master.xml</sourceDocumentName>
<masterTranslation>${translation}</masterTranslation>
<imageResource>
<directory>${project.basedir}/src/docbook/${translation}</directory>
<includes>
<include>**/*.svg</include>
<include>**/*.png</include>
<include>**/*.jpg</include>
<include>**/*.gif</include>
<include>**/*.bmp</include>
</includes>
</imageResource>
<cssResource>
<directory>${project.basedir}/src/docbook/${translation}</directory>
<includes>
<include>**/*.css</include>
</includes>
</cssResource>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<formats>
<format>
<formatName>html</formatName>
<stylesheetResource>
classpath:/xslt/org/jboss/pressgang/xhtml.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>pdf</formatName>
<stylesheetResource>
classpath:/xslt/org/jboss/pressgang/pdf.xsl
</stylesheetResource>
<finalName>${project.artifactId}-${translation}.pdf</finalName>
</format>
</formats>
+
<options>
+
<xmlTransformerType>saxon</xmlTransformerType>
+
<xincludeSupported>true</xincludeSupported>
+
<useRelativeImageUris>true</useRelativeImageUris>
+
</options>
+
</configuration>
+
</plugin>
+
</plugins>
+ </build>
+</project>
In Eclipse create a Working Set Maven Docbook and import this Maven Docbook project into it with File →
Import… → Maven → Existing Maven Projects from Root directory C:\dev\projects\maven-docbook and
click Finish.
219
Chapter 17.
With this setup the Development Production Line manual would look something like this:
Figure 17.15. Development Production Line - PressGang Look and Feel
Important
When building a jDocBook using maven in combination with java.home pointing to a jdk1.7 the
following error occured: “Failure reading http://docbook.sourceforge.net/release/xsl/1.76.1/
xhtml/chunk.xsl: Connection timed out: connect”. Just update MAVEN_OPTS as mentioned in
the Maven installation guide.
17.3.2. Documentation setup
Lets setup a base structure, for Maven Documentation Customization, with the following JIRA project:
• Maven Docs [MVNDCS]: Maven documentation setup (see also repository branches/maven-docs).
With the following components:
1. docs: Documentation setup.
2. style: Custom HTML and PDF styling.
3. xslt: Custom XHTML and PDF XSLTs.
4. jdocbook: Maven jDocBook plugin adds support for DocBook handling to Maven.
5. fop: The Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL formatting objects
(XSL-FO) and an output independent formatter.
and versions:
• 1.0-alpha - Custom Look and Feel.
• 2.0-alpha - Fluido Look and Feel.
Note
This second project is necessary because the custom style and xslt, that will be defined in
maven-docs and used in maven-docbook, cause a chicken and egg problem because those
artifacts are referenced as dependencies for the jdocbook plugin during the build.
Start a new bare Git repository maven-docs by calling /p/dev/apps/windows/batch/git-create-repo.sh
/p/dev/data/repo/git maven-docs.git "Maven documentation setup" -jenkinsHook in
Git
Bash.
220
Quality Assurance
Clone this remote repository with the following command git-clone jjasper maven-docs.
Supply some information in C:\dev\projects\maven-docs\src\site\apt\index.apt.vm:
+Free Dumb Bytes documentation setup
+
+ {{{http://www.docbook.org/} DocBook}} is, in part, <an XML vocabulary that
lets you create documents in a presentation-neutral form that captures the
logical structure of your content>.
+ Another aspect of DocBook is the rendering of that content into various
formats using DocBook-supplied (or custom) XSLT stylesheets.
+ Basically, DocBook allows you to write and maintain a single source for
documentation, and to then render that single source into multiple formats
such as PDF or HTML.
+
+ {{{http://docbook.sourceforge.net/} The DocBook Project} supports the
open-source development of a variety of DocBook resources; in particular,
{{{http://wiki.docbook.org/DocBookXslStylesheets}
the DocBook XSL stylesheets}}.
+
+ {{{http://pressgang.jboss.org/} PressGang}} is
{{{https://github.com/pressgang} the home of PressGang}} CCMS and the
JBoss Base Styles. We are here to help you write awesome user documentation
that meets the needs of your users.
+
+ The purpose of {{{http://maven-jdocbook-plugin.jboss.org/}
the jDocBook Plugin}} is to allow these DocBook transformations to occur
as a natural part of the users Maven build.
+ The main difficulty with this has always been the fact that DocBook
transformations are usually very closely tied to the user's local environment.
+ The design goal with writing this plugin was to utilize Maven's dependency
mechanism to bring all the pieces together on demand. Those pieces are:
+
+ * {{{https://github.com/pressgang/maven-jdocbook-plugin}
Maven jDocBook plugin}} adds support for DocBook handling to Maven.
+
+ * {{{https://github.com/pressgang/maven-jdocbook-style-plugin}
Maven Docbook Style Plugin}} defines the custom <jdocbook-style> packaging.
+
+ * {{{https://github.com/pressgang/pressgang-tools} Pressgang Tools}}
for all artifacts which support JBoss Community documentation.
+
+ * {{{https://github.com/…/…-tools/tree/master/pressgang-jdocbook-style}
JBoss Community Documentation Style}} for Blue and Grey CSS and Images to
use as a base for your project XHTML JBoss Community Documentation.
+
+ * {{{https://github.com/…/…-tools/tree/master/pressgang-xslt-ns}
JBoss Community DocBook XSLT}} is the main project to transform DocBook XML
into XHTML and other formats for JBoss Community Documentation.
Use this with XSD based docbook XML files.
+
+ * {{{https://github.com/…/…-tools/tree/master/pressgang-highlight}
JBoss Community DocBook Code Highlighter}} provides code highlighting
for documentation examples. Currently uses the jHighlight library.
+
+ * {{{https://github.com/pressgang/pressgang-tools/tree/master/pressgang-fonts}
JBoss.org PDF Fonts}} contains both the fonts themselves
and the xslt templates necessary to get them included into the generated
PDFs (simply import/include this xslt into your project's pdf xslt).
+
+ []
+
+ <<Note>>: To create the intermediate FO itself execute
+ <<<mvn org.jboss.maven.plugins:maven-jdocbook-plugin:xslfo>>>
(see also GenerateXslFoMojo.java).
+
+ {{{https://xmlgraphics.apache.org/commons/} Apache XML Graphics Commons}}
is a library that consists of several reusable components used by Apache Batik
and Apache FOP. Many of these components can easily be used separately outside
the domains of SVG and XSL-FO.
+ You will find components such as a PDF library, an RTF library, Graphics2D
implementations that let you generate PDF & PostScript files, and much more.
+
+ {{{http://xmlgraphics.apache.org/batik/} Batik}} is a Java-based toolkit
221
Chapter 17.
for applications or applets that want to use images in the Scalable Vector
Graphics (SVG) format for various purposes, such as display, generation or
manipulation.
+
+ The {{{https://xmlgraphics.apache.org/fop/} Apache FOP}}
(Formatting Objects Processor) is a print formatter driven by XSL formatting
objects (XSL-FO) and an output independent formatter.
+ It is a Java application that reads a formatting object (FO) tree and renders
the resulting pages to a specified output.
+ Output formats currently supported include PDF, PS, PCL, AFP, XML
(area tree representation), Print, AWT and PNG, and to a lesser extent,
RTF and TXT.
+ The primary output target is PDF.
+
+ {{{https://xmlgraphics.apache.org/fop/trunk/hyphenation.html}
Apache FOP Hyphenation}} uses Liang's hyphenation algorithm, well known from
{{{https://tug.org/} TeX}}.
+ It needs language specific pattern and other data for operation.
+
+ Because of licensing issues (and for convenience), all hyphenation patterns
for FOP are made available through the OFFO
({{{http://offo.sourceforge.net/hyphenation/index.html}
Objects For Formatting Objects}}) project.
Figure 17.16. Free Dumb Bytes Documentation Setup
Create the maven-docs minimal project base POM in C:\dev\projects\maven-docs\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
222
Quality Assurance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
+
+
+
+
+
<scm>
<developerConnection>scm:git:${gitHost}/maven-docs.git</developerConnection>
<url>${fisheyeHost}/browse/maven-docs</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/maven-docs</url>
</ciManagement>
+
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/MVNDCS</url>
</issueManagement>
+
+
+
+
+
+
+
<distributionManagement>
<site>
<id>mvn-sites</id>
<name>Maven Documentation Sites</name>
<url>dav:${mavenHost}/maven-docs</url>
</site>
</distributionManagement>
+
+
+
+
<modules>
<module>custom-docbook-style</module>
<module>custom-docbook-xslt</module>
</modules>
<parent>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>base-pom</artifactId>
<version>3.1-beta</version>
</parent>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>docs</artifactId>
<version>2.0-alpha</version>
<packaging>pom</packaging>
<name>Free Dumb Bytes Documentation</name>
<description>Free Dumb Bytes documentation setup.</description>
<url>${mavenHost}/maven-docs</url>
<inceptionYear>2010</inceptionYear>
+ <properties>
+
<mavenDocsVersion>2.0-alpha</mavenDocsVersion>
+
+
<jdocbookPluginVersion>2.3.9</jdocbookPluginVersion>
+
<jdocbookStylePluginVersion>2.0.0</jdocbookStylePluginVersion>
+
<docbookXslVersion>1.76.1</docbookXslVersion>
+
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
+ </properties>
+</project>
Create the maven-docs minimal style module POM in C:\dev\projects\maven-docs\custom-docbook-style\pom.xml:
+
+
+
+
<parent>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>docs</artifactId>
<version>2.0-alpha</version>
223
Chapter 17.
+
+
+
+
+
+
+
+
</parent>
<artifactId>custom-docbook-style</artifactId>
<packaging>jdocbook-style</packaging>
<name>Free Dumb Bytes Documentation Styles</name>
<description>Custom HTML and PDF styling.</description>
<inceptionYear>2010</inceptionYear>
+ <build>
+
<plugins>
+
<plugin>
+
<groupId>org.jboss.maven.plugins</groupId>
+
<artifactId>maven-jdocbook-style-plugin</artifactId>
+
<version>${jdocbookStylePluginVersion}</version>
+
<extensions>true</extensions>
+
<configuration>
+
<cssSourceDirectory>
+
${basedir}/src/docbook/custom-css
+
</cssSourceDirectory>
+
<imagesSourceDirectory>
+
${basedir}/src/docbook/custom-images
+
</imagesSourceDirectory>
+
<fontSourceDirectory>
+
${basedir}/src/docbook/custom-fonts
+
</fontSourceDirectory>
+
<xsltSourceDirectory>
+
${basedir}/src/docbook/custom-xslt
+
</xsltSourceDirectory>
+
</configuration>
+
</plugin>
+
</plugins>
+ </build>
+</project>
Create the maven-docs minimal xslt module POM in C:\dev\projects\maven-docs\custom-docbook-xslt
\pom.xml:
+
+
+
+
+
+
+
+
+
+
+
<parent>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>docs</artifactId>
<version>2.0-alpha</version>
</parent>
<artifactId>custom-docbook-xslt</artifactId>
<name>Free Dumb Bytes Documentation XSLT</name>
<description>Custom XHTML and PDF XSLTs.</description>
<inceptionYear>2010</inceptionYear>
+ <dependencies>
+
<dependency>
+
<groupId>net.sf.docbook</groupId>
+
<artifactId>docbook-xsl</artifactId>
+
<version>${docbookXslVersion}</version>
+
<classifier>ns-resources</classifier>
+
<type>zip</type>
+
</dependency>
+
+
<dependency>
+
<groupId>org.jboss.pressgang</groupId>
+
<artifactId>pressgang-highlight</artifactId>
+
<version>${pressgangHighlightVersion}</version>
+
</dependency>
+ </dependencies>
+</project>
In Eclipse create a Working Set Maven Docs and import this Maven Docs project into it with File → Import… →
Maven → Existing Maven Projects from Root directory C:\dev\projects\maven-docs and click Finish.
Make an anynomous clone from the pressgang-tools with:
224
Quality Assurance
cd /d C:\dev\projects
git clone http://github.com/pressgang/pressgang-tools
cd \projects\pressgang-tools
git tag -l
git checkout pressgang-tools-3.1.3
cd \projects\pressgang-tools\pressgang-jdocbook-style\src\main
xcopy /S /I css\*.css ^
C:\dev\projects\maven-docs\custom-docbook-style\src\docbook\custom-css
xcopy /S /I images\*.svg ^
C:\dev\projects\maven-docs\custom-docbook-style\src\docbook\custom-images
xcopy /S /I images\*.png ^
C:\dev\projects\maven-docs\custom-docbook-style\src\docbook\custom-images
xcopy /S /I images\*.gif ^
C:\dev\projects\maven-docs\custom-docbook-style\src\docbook\custom-images
cd \projects\pressgang-tools\pressgang-xslt-ns\src\main
xcopy /S /I resources\xslt\*.xsl ^
C:\dev\projects\maven-docs\custom-docbook-xslt\src\main\resources\xslt
cd \projects\maven-docs
mvn clean install
Configure the maven-docbook POM in C:\dev\projects\maven-docbook\pom.xml to use the just installed
custom modules:
+
+
+
-
+
+
+
+
+
+
+
-
<parent>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>base-pom</artifactId>
<version>3.1-beta</version>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>docs</artifactId>
<version>2.0-alpha</version>
</parent>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>docbook</artifactId>
<version>3.1-beta</version>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>2.3.9</version>
<version>${jdocbookPluginVersion}</version>
<extensions>true</extensions>
<dependencies>
<dependency>
<groupId>org.jboss.pressgang</groupId>
<artifactId>pressgang-jdocbook-style</artifactId>
<version>3.1.3</version>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>custom-docbook-style</artifactId>
<version>${mavenDocsVersion}</version>
<type>jdocbook-style</type>
</dependency>
<dependency>
<groupId>org.jboss.pressgang</groupId>
<artifactId>pressgang-xslt-ns</artifactId>
<version>3.1.3</version>
<groupId>net.dev.freedumbytes.documentation</groupId>
<artifactId>custom-docbook-xslt</artifactId>
<version>${mavenDocsVersion}</version>
</dependency>
</dependencies>
…
<formats>
<format>
<formatName>html</formatName>
<stylesheetResource>
classpath:/xslt/org/jboss/pressgang/xhtml.xsl
</stylesheetResource>
225
Chapter 17.
+
+
+
+
+
+
+
+
+
+
+
<stylesheetResource>
classpath:/xslt/xhtml-chunk.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
<format>
<formatName>pdf</formatName>
<stylesheetResource>
classpath:/xslt/org/jboss/pressgang/pdf.xsl
</stylesheetResource>
<stylesheetResource>classpath:/xslt/pdf.xsl</stylesheetResource>
<finalName>${project.artifactId}-${translation}.pdf</finalName>
</format>
<format>
<formatName>html_single</formatName>
<stylesheetResource>
classpath:/xslt/xhtml-single.xsl
</stylesheetResource>
<finalName>index.html</finalName>
</format>
</formats>
…
<plugin>
Customize the Look and Feel:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
226
MVNDBK-1: Create the minimal POM with PressGang Look and Feel (see also commits for PressGang Tools).
MVNDCS-1: Create the minimal POMs for custom Look and Feel modules.
MVNDCS-2: Initialize custom style based on PressGang style.
MVNDCS-3: Initialize custom xslt based on PressGang xslt.
MVNDBK-2: Switch to custom Look and Feel artifacts.
MVNDCS-4: Refactor initial PressGang xslt.
MVNDCS-5: Refactor initial PressGang style.
MVNDBK-3: Switch to refactored XSLs.
MVNDCS-7: Reenable status draft.
MVNDCS-8: Customize admonitions.
MVNDCS-9: Customize list style.
MVNDCS-10: Customize code style.
MVNDCS-11: Customize link style.
MVNDCS-12: Support role strikethrough.
MVNDCS-13: Support element accel.
MVNDCS-14: Wrap long lists of menu choices.
MVNDCS-15: Screen and Printer output improvements.
MVNDCS-16: Customize community imagery.
MVNDCS-17: Highlight chapters and appendices in the table of contents.
MVNDCS-18: Reenable unused callout XSLs for xHTML.
MVNDCS-19: Fix unwanted line breaks before anchors.
MVNDCS-20: Customize navigation.
MVNDCS-21: Highlight gui, application and command elements.
MVNDCS-22: Customize title page.
MVNDCS-23: Customize pagesetup.
MVNDCS-24: Uniform menuchoice separator.
MVNDCS-25: Create security confidential mode.
MVNDCS-26: Highlight xref links.
MVNDBK-4: Activate hyphenation.
MVNDCS-28: Stop HTML generation from outputing a 'title' attribute.
MVNDCS-29: Switch to Fluido Skin style.
MVNDCS-30 Upgrade DocBook XSL Version 1.78.1.
MVNDCS-31 Upgrade FOP Version 1.0.
MVNDCS-32 Fix programlisting.xsl highlighting with hightlight.js (xHTML only).
MVNDCS-34 Fix programlisting code wrapping (which causes it to look ugly) by simply not auto-wrapping but
adding a horizontal scrollbar.
MVNDCS-35 Large images should auto scale to fit witdh and auto scale height of inline images for PDF output.
MVNDCS-36 Fix console-en-US-pdf.log output errors and warnings.
MVNDCS-37 Title must be bigger then subtitle.
MVNDCS-38 Add cover support to title page.
MVNDBK-8: Copy and extend PressGang example.
MVNDCS-39: Upgrade FOP version 1.1 using a patch.
MVNDCS-40: Fonts information and usage.
Quality Assurance
• MVNDCS-44: Overrule table pgwide=1 required for PDF but unwanted for HTML with width attribute.
• MVNDCS-43: Suppress the overkill of FOP 'Font "Symbol,normal,700" not found. Substituting with
"Symbol,normal,400".' and similar DEBUG messages by switching back to FOP LoggingEventListener an
EventListener implementation that redirects events to Commons Logging.
• MVNDCS-45: [PATCH] FontInfo.findAdjustWeight cannot find Bold weight fonts.
• MVNDCS-42: Header anchor on hover based on github-markdown.css of github-markdown-css.
Important
Processing DocBook V5.0 with XSL Stylesheets or XSL-NS Stylesheets (namespace-aware versions). The DocBook XSL-NS stylesheets are released side-by-side with the DocBook XSL
stylesheets, as a separate docbook-xsl-ns package. They are the recommended XSLT 1.0
stylesheets to use for transforming namespaced (DocBook V5.0) documents. But when
parsing xhtml-chunk.xsl still using the old import http://docbook.sourceforge.net/release/xsl/1.78.1/xhtml5/chunk.xsl instead of recommended http://docbook.sourceforge.net/
release/xsl-ns/1.78.1/xhtml5/chunk.xsl the documents are rendered about 2-3 times faster.
With this custom setup <book
security="confidential"
status="draft"
version="5.0"
xml:id="development.production.line" xml:lang="en-US" xmlns="http://docbook.org/ns/
docbook" the Development Production Line manual looks something like this:
Figure 17.17. Development Production Line - Custom Look and Feel
Important
When building a jDocBook using maven in combination with java.home pointing to a jdk1.7 the
following error occured: “Failure reading http://docbook.sourceforge.net/release/xsl/1.76.1/
xhtml/chunk.xsl: Connection timed out: connect”. Just update MAVEN_OPTS as mentioned in
the Maven installation guide.
17.3.3. Hyphenation
To activate hyphenation for the jDocBook Plugin define the version in C:\dev\projects\maven-docs
\pom.xml:
<jdocbookStylePluginVersion>2.0.0</jdocbookStylePluginVersion>
227
Chapter 17.
+
<docbookXslVersion>1.76.1</docbookXslVersion>
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
<fopHyphVersion>2.0</fopHyphVersion>
</properties>
And add a dependency for it in C:\dev\projects\maven-docbook\pom.xml:
+
+
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>${jdocbookPluginVersion}</version>
<extensions>true</extensions>
<dependencies>
<dependency>
…
<artifactId>custom-docbook-style</artifactId>
…
<artifactId>custom-docbook-xslt</artifactId>
…
</dependency>
<dependency>
<groupId>net.sf.offo</groupId>
<artifactId>fop-hyph</artifactId>
<version>${fopHyphVersion}</version>
</dependency>
<configuration>
17.3.4. Upgrade DocBook XSL stylesheets
To upgrade the docbook-xsl dependency define the new version in C:\dev\projects\maven-docs
\pom.xml:
<jdocbookStylePluginVersion>2.0.0</jdocbookStylePluginVersion>
<docbookXslVersion>1.76.1</docbookXslVersion>
<jdocbookCoreVersion>1.1.1</jdocbookCoreVersion>
<docbookXslVersion>1.78.1</docbookXslVersion>
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
<fopHyphVersion>2.0</fopHyphVersion>
</properties>
+
+
And exclude the old one used by the jdocbook-core plugin:
<artifactId>custom-docbook-xslt</artifactId>
<version>${mavenDocsVersion}</version>
</dependency>
+
+
+
+
+
+
+
+
+
+
+
+
<dependency>
<groupId>org.jboss.jdocbook</groupId>
<artifactId>jdocbook-core</artifactId>
<version>${jdocbookCoreVersion}</version>
<exclusions>
<exclusion>
<groupId>net.sf.docbook</groupId>
<artifactId>docbook-xsl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Note
The new version of docbook-xsl is already included with this version property docbookXslVersion in the above mentioned custom-docbook-xslt artifact, that also was already added
as a custom dependency to maven-jdocbook-plugin. Because of this old entry the directory C:\dev\data\repo\maven\local\net\sf\docbook\docbook-xsl\1.76.1 will still
228
Quality Assurance
contain a pom, but C:\dev\data\repo\maven\local\net\sf\docbook\docbook-xsl
\1.78.1 will contain both pom and zip.
17.3.5. Upgrade FOP
To upgrade the fop dependency (and a little later on the avalon-framework transitive dependencies) define
the new version in C:\dev\projects\maven-docs\pom.xml:
+
+
<docbookXslVersion>1.78.1</docbookXslVersion>
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
<fopHyphVersion>2.0</fopHyphVersion>
<fopVersion>1.1</fopVersion>
<avalonFrameworkVersion>4.3.1</avalonFrameworkVersion>
</properties>
And add a dependency for it in C:\dev\projects\maven-docbook\pom.xml:
+
+
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>${jdocbookPluginVersion}</version>
<extensions>true</extensions>
<dependencies>
<dependency>
…
<artifactId>custom-docbook-style</artifactId>
…
<artifactId>custom-docbook-xslt</artifactId>
…
<artifactId>fop-hyph</artifactId>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>${fopVersion}</version>
</dependency>
</dependencies>
<configuration>
Because for the artifacts of the avalon-framework the groupId changed from avalon-framework to org.apache.avalon.framework as of version 4.3.1 we end up with the following error “[ERROR] Unresolveable build extension: Plugin org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.9 or one of its dependencies could not be resolved: The following artifacts could not
be resolved: org.apache.avalon.framework:avalon-framework-api:jar:4.2.0, org.apache.avalon.framework:avalonframework-impl:jar:4.2.0: Failure to find org.apache.avalon.framework:avalon-framework-api:jar:4.2.0 in http://
freedumbytes.dev.net/nexus/content/groups/public was cached in the local repository, resolution will not be
reattempted until the update interval of nexus-central has elapsed or updates are forced” when trying to mvn
install the maven-docbook project.
To fix this issue just add the avalon-framwork artifacts as dependencies for the jdocbook-core plugin at the
same level as the fop artifact in C:\dev\projects\maven-docbook\pom.xml:
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>${jdocbookPluginVersion}</version>
<extensions>true</extensions>
<dependencies>
…
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>${fopVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>
229
Chapter 17.
+
+
+
+
+
+
+
<version>${avalonFrameworkVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
<version>${avalonFrameworkVersion}</version>
</dependency>
</dependencies>
<configuration>
To suppress the remaining warnings “[WARNING] The POM for org.apache.avalon.framework:avalonframework-api:jar:4.2.0 is missing, no dependency information available” and “[WARNING] The POM for
org.apache.avalon.framework:avalon-framework-impl:jar:4.2.0 is missing, no dependency information available”
exclude them in C:\dev\projects\maven-docbook\pom.xml:
+
+
+
+
+
+
+
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>${jdocbookPluginVersion}</version>
<extensions>true</extensions>
<dependencies>
…
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>${fopVersion}</version>
<exclusions>
<exclusion>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>${avalonFrameworkVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
<version>${avalonFrameworkVersion}</version>
</dependency>
</dependencies>
<configuration>
With this setup the next error is “[ERROR] Failed to execute goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.9:resources (default-resources) on project development-production-line: Unexpected problem:
Unable to locate artifact [org.apache.avalon.framework:avalon-framework-api:jar:4.2.0]: Could not find artifact rg.apache.avalon.framework:avalon-framework-api:jar:4.2.0 in nexus-central (http://freedumbytes.dev.net/
nexus/content/groups/public)” when trying to generate this manual with mvn package. To fix this change the
dependencyManagement in C:\dev\projects\maven-docs\pom.xml:
+
+
+
+
+
+
+
+
+
+
+
+
230
<dependencyManagement>
…
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
<version>${fopVersion}</version>
<exclusions>
<exclusion>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
Quality Assurance
+
+
+
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Alas the next error “[ERROR] Failed to execute goal org.jboss.maven.plugins:maven-jdocbook-plugin:2.3.9:generate (default-generate) on project development-production-line: Rendering problem: error building transformation result [C:\dev\projects\dpl-manual\target\docbook\publish\en-US\pdf\Production
evelopment Line (en-US).pdf]: org.apache.fop.fonts.FontSetup.createMinimalFontResolver()Lorg/apache/fop/
fonts/FontResolver;” is caused by a change of the method public static FontResolver createMinimalFontResolver() into public static FontResolver createMinimalFontResolver(boolean useComplexScriptFeatures) in the class FontSetup since fop version 1.1.
Thus upgrade the fop dependency only to 1.0 in C:\dev\projects\maven-docs\pom.xml for now:
+
+
<docbookXslVersion>1.78.1</docbookXslVersion>
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
<fopHyphVersion>2.0</fopHyphVersion>
<fopVersion>1.0</fopVersion>
<avalonFrameworkVersion>4.3.1</avalonFrameworkVersion>
</properties>
17.3.5.1. Patch FOP version
Alternatively start a new bare Git repository custom-jdocbook-core by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git custom-jdocbook-core.git "Patch
the core jDocBook functionality to support fop 1.1." -jenkinsHook in
Git Bash (see also
repository branches/custom-jdocbook-core).
Therefore upgrade the fop to 1.1 in C:\dev\projects\maven-docs\pom.xml first:
+
<docbookXslVersion>1.78.1</docbookXslVersion>
<pressgangHighlightVersion>3.1.3</pressgangHighlightVersion>
<fopHyphVersion>2.0</fopHyphVersion>
<fopVersion>1.0</fopVersion>
<fopVersion>1.1</fopVersion>
<avalonFrameworkVersion>4.3.1</avalonFrameworkVersion>
</properties>
Create the custom-jdocbook-core project POM in C:\dev\projects\custom-jdocbook-core\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.documentation</groupId>
+
<artifactId>docs</artifactId>
+
<version>2.0-alpha</version>
+ </parent>
+
+ <artifactId>custom-jdocbook-core</artifactId>
+
+ <name>Free Dumb Bytes jDocBook FOP patch</name>
+ <description>
+
Patch the core jDocBook functionality to support FOP 1.1.
+ </description>
+ <url>${mavenHost}/maven-docs</url>
+ <inceptionYear>2016</inceptionYear>
…
+
+
+
<properties>
<jdocbookCorePatchVersion>${jdocbookCoreVersion}</jdocbookCorePatchVersion>
<jdomVersion>1.0</jdomVersion>
231
Chapter 17.
+
<truezipMavenPluginVersion>1.2</truezipMavenPluginVersion>
+ </properties>
+</project>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<dependencies>
<dependency>
<groupId>org.jboss.jdocbook</groupId>
<artifactId>jdocbook-core</artifactId>
<exclusions>
<exclusion>
<groupId>net.sf.docbook</groupId>
<artifactId>docbook-xml</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop</artifactId>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>${avalonFrameworkVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.avalon.framework</groupId>
<artifactId>avalon-framework-impl</artifactId>
<version>${avalonFrameworkVersion}</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>${jdomVersion}</version>
</dependency>
</dependencies>
Fetch original pom and jar:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
232
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-jdocbook-core</id>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.jboss.jdocbook</groupId>
<artifactId>jdocbook-core</artifactId>
<version>${jdocbookCoreVersion}</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/repackage
</outputDirectory>
<destFileName>
jdocbook-core-${jdocbookCorePatchVersion}.jar
</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.jboss.jdocbook</groupId>
Quality Assurance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<artifactId>jdocbook-core</artifactId>
<version>${jdocbookCoreVersion}</version>
<type>pom</type>
<overWrite>true</overWrite>
<outputDirectory>
${project.build.directory}/repackage
</outputDirectory>
<destFileName>
jdocbook-core-${jdocbookCorePatchVersion}.pom
</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
Override the Java class file with patched version FopConfigHelper from this project:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>${truezipMavenPluginVersion}</version>
<executions>
<execution>
<id>patch-jdocbook-core</id>
<goals>
<goal>copy</goal>
</goals>
<phase>package</phase>
<configuration>
<verbose>false</verbose>
<fileset>
<directory>${project.build.directory}/classes</directory>
<includes>
<include>org/jboss/jdocbook/**/*.class</include>
</includes>
<outputDirectory>
${project.build.directory}/repackage
/jdocbook-core-${jdocbookCorePatchVersion}.jar
</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
Install patched jar with original pom in the local Maven repository:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<inherited>false</inherited>
<executions>
<execution>
<id>install-patch-jdocbook-core</id>
<phase>install</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<file>
${project.build.directory}/repackage
/jdocbook-core-${jdocbookCorePatchVersion}.jar
</file>
<pomFile>
${project.build.directory}/repackage
/jdocbook-core-${jdocbookCorePatchVersion}.pom
</pomFile>
<generatePom>false</generatePom>
<groupId>org.jboss.jdocbook</groupId>
<artifactId>jdocbook-core</artifactId>
<version>${jdocbookCorePatchVersion}</version>
233
Chapter 17.
+
+
+
+
+
<type>jar</type>
</configuration>
</execution>
</executions>
</plugin>
Deploy patched jar with original pom in the remote Nexus releases repository:
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-deploy-plugin</artifactId>
+
<inherited>false</inherited>
+
<executions>
+
<execution>
+
<id>deploy-patch-jdocbook-core</id>
+
<phase>deploy</phase>
+
<goals>
+
<goal>deploy-file</goal>
+
</goals>
+
<configuration>
+
<file>
+
${project.build.directory}/repackage
+
/jdocbook-core-${jdocbookCorePatchVersion}.jar
+
</file>
+
<repositoryId>nexus-releases</repositoryId>
+
<url>${project.distributionManagement.repository.url}</url>
+
<pomFile>
+
${project.build.directory}/repackage
+
/jdocbook-core-${jdocbookCorePatchVersion}.pom
+
</pomFile>
+
<groupId>org.jboss.jdocbook</groupId>
+
<artifactId>jdocbook-core</artifactId>
+
<version>${jdocbookCorePatchVersion}</version>
+
<type>jar</type>
+
</configuration>
+
</execution>
+
</executions>
+
</plugin>
+
</plugins>
+ </build>
+</project>
This way we can always revert to the original version of this jar in the Nexus JBoss repository by deleting the
patched jar from the local and Nexus releases repositories.
The actual patch to fix “[ERROR] … org.apache.fop.fonts.FontSetup.createMinimalFontResolver()Lorg/apache/
fop/fonts/FontResolver;” when running jDocbook core with fop 1.1 is made to FopConfigHelper:
FontCache fontCache =
componentRegistry.getConfiguration().isUseFopFontCacheEnabled()
? FontCache.loadFrom( new File( getFopWorkDirectory(),
FONT_CACHE_FILE ) )
: new FontCache();
FontResolver fontResolver = FontSetup.createMinimalFontResolver();
+
FontResolver fontResolver = FontSetup.createMinimalFontResolver(true);
FontInfoFinder fontInfoFinder = new FontInfoFinder();
fontInfoFinder.setEventListener(
new FontEventListener() {
…
+
+
@Override
+
public void fontDirectoryNotFound(Object source, String dir) {
+
log.trace("Font directory not found dir=[" + dir
+
+ "]; source=" + source);
+
}
+
+
@Override
+
public void svgTextStrokedAsShapes(Object source, String fontFamily) {
+
log.trace("SVG text stroked as shapes fontFamily=[" + fontFamily
+
+ "]; source=" + source);
+
}
}
);
234
Quality Assurance
for ( File fontDirectory :
componentRegistry.getEnvironment().getFontDirectories() ) {
17.3.5.2. Patch FOP logging
The actual patch to suppress the overkill of FOP “Font "Symbol,normal,700" not found. Substituting with
"Symbol,normal,400".” DEBUG messages when running jDocbook core with fop 1.1 is made to ResultImpl:
import javax.xml.transform.sax.SAXResult;
+import
import
…
+import
import
org.apache.commons.logging.LogFactory;
org.apache.fop.apps.FOUserAgent;
org.apache.fop.events.LoggingEventListener;
org.jboss.jdocbook.JDocBookComponentRegistry;
FOUserAgent fopUserAgent = fopFactory.newFOUserAgent();
fopUserAgent.setProducer( "jDocBook - Java-based DocBook processor" );
fopUserAgent.getEventBroadcaster()
.addEventListener( new EventListenerBridge() );
.addEventListener(
new LoggingEventListener(LogFactory.getLog(FOUserAgent.class)) );
+
+
Fop fop = fopFactory.newFop( MimeConstants.MIME_PDF, fopUserAgent,
outputStream );
With the upcoming pressgang-tools-example this fix reduced the number of logged messages
in C:\dev\projects\maven-docbook\pressgang-tools-example\target\docbook\work\log\console-en-US-pdf.log from 4590 to 220.
17.3.5.3. Patch FOP font weight
Start a new bare Git repository custom-fop by calling /p/dev/apps/windows/batch/git-create-repo.sh
/p/dev/data/repo/git custom-fop.git "Patch the core FOP functionality." -jenkinsHook
in Git Bash (see also repository branches/custom-fop).
The actual patch to fix bold weight font with fop 1.1 is made to FontInfo (see also bug 49301):
+
+
+
+
} else if (newWeight > 500) {
while (f == null && newWeight < 1000) {
newWeight += 100;
while (f == null && newWeight < 1100) {
key = createFontKey(family, style, newWeight);
f = getInternalFontKey(key);
newWeight += 100;
}
newWeight = weight;
while (f == null && newWeight > 400) {
newWeight -= 100;
while (f == null && newWeight > 300) {
key = createFontKey(family, style, newWeight);
f = getInternalFontKey(key);
newWeight -= 100;
}
}
17.3.6. Fonts
In metal typesetting, a font is a particular size, weight and style of a typeface. Each font was a matched set of type,
one piece (called a sort) for each glyph, and a typeface consisting of a range of fonts that shared an overall design.
In modern usage, with the advent of digital typography, font is frequently synonymous with typeface, although
the two terms do not necessarily mean the same thing. In particular, the use of vector or outline fonts means that
different sizes of a typeface can be dynamically generated from one design. Each style may still be in a separate
font file—for instance, the typeface Bulmer may include the fonts Bulmer roman, Bulmer italic, Bulmer bold and
Bulmer extended—but the term font might be applied either to one of these alone or to the whole typeface.
In typography, a typeface (also known as font family) is a set of one or more fonts each composed of glyphs that
share common design features. Each font of a typeface has a specific weight, style, condensation, width, slant,
italicization, ornamentation, and designer or foundry (and formerly size, in metal fonts).
Complex text layout (abbreviated CTL) or complex text rendering refers to the typesetting of writing systems
in which the shape or positioning of a grapheme depends on its relation to other graphemes. The term is used
235
Chapter 17.
in the field of software internationalization, where each grapheme is a character. Scripts which require CTL for
proper display may be known as complex scripts. Examples include the Arabic alphabet and scripts of the Brahmic
family, such as Devanagari or the Thai alphabet. Many scripts do not require CTL. For instance, the Latin alphabet
or Chinese characters can be typeset by simply displaying each character one after another in straight rows or
columns. However, even these scripts have alternate forms or optional features (such as cursive writing) which
require CTL to produce on computers.
ISO 639 is a standardized nomenclature used to classify all known languages. Each language is assigned a two-letter (639-1) and three-letter (639-2 and 639-3), lowercase abbreviation, amended in later versions of the nomenclature. The system is highly useful for linguists and ethnographers to categorize the languages spoken on a regional basis, and to compute analysis in the field of lexicostatistics.
17.3.6.1. Resources
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Google Noto Fonts (Updates).
Asciidoc Book Editor based on JavaFX 8 with How To install Microsoft Core Fonts on Linux OSes.
How to Install, Remove and Hide Fonts in Windows 7 & Windows 8.1.
Although some people will never use anything other than the default fonts, Microsoft provides a wide range
of fonts with Windows:
• Arial Unicode MS the extended version of Monotype's Arial contains glyphs for all code points within The
Unicode Standard, Version 2.0.
• The Verdana typeface family consists of four TrueType fonts created specifically to address the challenges
of on-screen display.
• Although inspired by the need for - and providing - clarity at low resolutions on the screen, Georgia is a
typeface resonant with typographic personality.
• Meiryo is a very versatile modern sans serif type designed to give an exceptionally clean appearance on
screen, as well as in print. It is optimized for on-screen reading.
Ubuntu font family is a unique, custom designed font that has a very distinctive look and feel.
Papyrus is one of those fonts that are far too popular for their own good.
Lucida is a font family that includes serif, sans-serif and handwritten variants.
Guide to the LaTeX markup language.
Custom Font List for Unicode 8.0.
GitHub Octicons.
Specials is the name of a short Unicode block allocated at the very end of the Basic Multilingual Plane, at U
+FFF0–FFFF.
Brahmi is the modern name given to one of the oldest writing systems used in the Indian subcontinent and in
Central Asia during the final centuries BCE and the early centuries CE. Like its contemporary, Kharosthi, which
was used in what is now Afghanistan and Pakistan, it is an abugida.
Burmese script is used in Myanmar for the Burmese language, and for the country's minority languages. It is
also used for the liturgical languages of Pali and Sanskrit.
Javanese (Aksara Jawa) is one of the Austronesian languages, but it is not particularly close to other languages
and is difficult to classify. Its closest relatives are the neighbouring languages such as Sundanese, Madurese
and Balinese.
Tagalog grammar is the body of rules that describe the structure of expressions in the Tagalog language, the
language of the Tagalog region of the Philippines.
Sundanese script (Aksara Sunda) is a writing system which is used by the Sundanese people. It is built based
on Old Sundanese script (Aksara Sunda Kuno) which was used by the ancient Sundanese between the 14th
and 18th centuries.
17.3.6.2. Additional fonts usage
When text is rendered by a computer, sometimes there will be characters in the text that can not be displayed,
because no font that supports them is available to the computer. When this occurs, small boxes are shown to represent the characters. We call those small boxes tofu [for example:
] and we want
to remove tofu from the Web. This is how the Noto font families got their name. Noto is a font family designed
to cover all the scripts encoded in the Unicode standard. It is designed with the goal of achieving visual harmony
(e.g., compatible heights and stroke thicknesses) across multiple languages/scripts. Like Open Sans, it is derived
from Droid fonts. Commissioned by Google, the font is licensed under the SIL Open Font License.
Microsoft and Noto Fonts counterparts:
•
•
•
•
•
•
•
•
•
•
•
•
•
•
236
Meiryo or Noto Sans.
Arial or Noto Sans.
Euphemia or Noto Sans Canadian Aboriginal.
Arial or Noto Kufi Arabic.
Arial or Noto Sans Hebrew.
Batang / Gulim or Noto Sans CJK KR.
MV Boli or Noto Sans Thaana.
DokChampa or Noto Sans Lao.
Microsoft Himalaya / Dzongkha or Noto Sans Tibetan.
Gautami / Vani or Noto Sans Telugu.
Microsoft Himalaya or Noto Sans Tibetan.
Iskoola Pota or Noto Sans Sinhala.
Kalinga or Noto Sans Oriya.
Kartika or Noto Sans Malayalam.
Quality Assurance
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Latha / Vijaya or Noto Sans Tamil.
Leelawadee / DokChampa or Noto Sans Thai.
Mangal or Noto Sans Devanagari.
Meiryo or Noto Sans CJK JP.
MoolBoran or Noto Sans Khmer.
Nyala or Noto Sans Ethiopic.
Raavi or Noto Sans Gurmukhi.
SimSun or Noto Sans CJK SC / TC.
Shruti or Noto Sans Gujarati.
Sylfaen or Noto Sans Armenian.
Sylfaen or Noto Sans Georgian.
Tunga or Noto Sans Kannada.
Vrinda or Noto Sans Bengali.
Microsoft Yi Baiti or Noto Sans Yi.
Noto Sans Tai Viet.
tofu or Noto Fonts only:
•
•
•
•
Noto Sans Javanese.
Noto Sans Myanmar.
Noto Sans Sundanese.
Noto Sans Tagalog.
After installing the necessary fonts, start using them in the DocBook generated HTML with the following change in C:\dev\projects\maven-docs\custom-docbook-style\src\docbook\custom-css\css
\freedumbytes.css:
body {
background-image: url(../images/community/docbook/paper.jpg);
- font-family: 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;
+ font-family:
+
Ubuntu,
+
Noto Sans,
+
Noto Sans Canadian Aboriginal,
+
Noto Kufi Arabic,
+
Noto Sans Hebrew,
+
Noto Sans CJK KR,
+
Noto Sans CJK JP,
+
Noto Sans CJK TC,
+
Noto Sans CJK SC,
+
Noto Sans Lao,
+
Noto Sans Armenian,
+
Noto Sans Bengali,
+
Noto Sans Devanagari,
+
Noto Sans Ethiopic,
+
Noto Sans Georgian,
+
Noto Sans Gujarati,
+
Noto Sans Gurmukhi,
+
Noto Sans Kannada,
+
Noto Sans Khmer,
+
Noto Sans Malayalam,
+
Noto Sans Oriya,
+
Noto Sans Sinhala,
+
Noto Sans Tai Viet,
+
Noto Sans Tamil,
+
Noto Sans Telugu,
+
Noto Sans Thaana,
+
Noto Sans Thai,
+
Noto Sans Tibetan,
+
Noto Sans Yi,
+
Noto Sans Javanese,
+
Noto Sans Myanmar,
+
Noto Sans Sundanese,
+
Noto Sans Tagalog,
+
Euphemia,
+
SimSun,
+
DokChampa,
+
Batang,
+
Gulim,
+
Microsoft Himalaya,
+
Dzongkha,
+
MV Boli,
+
Gautami,
+
Vani,
+
Iskoola Pota,
237
Chapter 17.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Kalinga,
Kartika,
Latha,
Leelawadee,
Mangal,
MoolBoran,
Nyala,
Raavi,
Shruti,
Sylfaen,
Tunga,
Vijaya,
Vrinda,
Microsoft Yi Baiti,
Meiryo,
Lucida Sans Unicode,
Georgia,
Verdana,
Arial Unicode MS,
Arial,
Geneva,
Helvetica,
sans-serif;
padding: 0em 2em;
}
Start using them in the DocBook generated PDF with the following change in C:\dev\projects\maven-docs
\custom-docbook-xslt\src\main\resources\xslt\fo\font.xsl:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
238
<xsl:template name="pickfont-mono">
<xsl:variable name="font">
<xsl:call-template name="pickfont" />
</xsl:variable>
<xsl:copy-of select="$font" />
<xsl:text>Liberation Mono,monospace</xsl:text>
<xsl:text>
Liberation Mono,
Lucida Console,
Monaco,Consolas,
Courier New,
Courier,
Arial Unicode MS,
Lucida Sans Unicode,
monospace
</xsl:text>
</xsl:template>
<xsl:template name="pickfont-sans">
<xsl:variable name="font">
<xsl:call-template name="pickfont" />
</xsl:variable>
<xsl:copy-of select="$font" />
<xsl:text>Liberation Sans,sans-serif</xsl:text>
<xsl:text>
Ubuntu,
Euphemia,
SimSun,
DokChampa,
Batang,
Gulim,
Microsoft Himalaya,
Dzongkha,
MV Boli,
Gautami,
Vani,
Iskoola Pota,
Kalinga,
Kartika,
Latha,
Leelawadee,
Quality Assurance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Mangal,
MoolBoran,
Nyala,
Raavi,
Shruti,
Sylfaen,
Tunga,
Vijaya,
Vrinda,
Microsoft Yi Baiti,
Meiryo,
Lucida Sans Unicode,
Georgia,
Verdana,
Arial Unicode MS,
Arial,
Geneva,
Helvetica,
Noto Sans,
Noto Sans Canadian Aboriginal,
Noto Kufi Arabic,
Noto Sans Hebrew,
Noto Sans CJK KR,
Noto Sans CJK JP,
Noto Sans CJK TC,
Noto Sans CJK SC,
Noto Sans Lao,
Noto Sans Armenian,
Noto Sans Bengali,
Noto Sans Devanagari,
Noto Sans Ethiopic,
Noto Sans Georgian,
Noto Sans Gujarati,
Noto Sans Gurmukhi,
Noto Sans Kannada,
Noto Sans Khmer,
Noto Sans Malayalam,
Noto Sans Oriya,
Noto Sans Sinhala,
Noto Sans Tai Viet,
Noto Sans Tamil,
Noto Sans Telugu,
Noto Sans Thaana,
Noto Sans Thai,
Noto Sans Tibetan,
Noto Sans Yi,
Noto Sans Javanese,
Noto Sans Myanmar,
Noto Sans Sundanese,
Noto Sans Tagalog,
sans-serif
</xsl:text>
</xsl:template>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<xsl:template name="pickfont-serif">
<xsl:text>
Ubuntu,
Meiryo,
Lucida Sans Unicode,
Georgia,
Arial Unicode MS,
Arial,
Noto Serif,
Noto Naskh Arabic,
Noto Serif Lao,
Noto Serif Armenian,
Noto Serif Georgian,
Noto Serif Khmer,
Noto Serif Thai,
serif
</xsl:text>
</xsl:template>
239
Chapter 17.
+
+
+
<xsl:template name="pickfont-dingbat">
<xsl:call-template name="pickfont-sans"/>
</xsl:template>
+
+
+
+
+
<xsl:template name="pickfont-symbol">
<xsl:text>
Symbol,
ZapfDingbats
</xsl:text>
</xsl:template>
</xsl:stylesheet>
For the fonts to be auto detected by FOP and thus displayed in the DocBook generated PDF (see also Figure 17.18,
“PDF without auto detect fonts”), edit the maven-docbook project as follows in C:\dev\projects\mavendocbook\pom.xml:
+
<build>
<plugins>
<plugin>
<groupId>org.jboss.maven.plugins</groupId>
<artifactId>maven-jdocbook-plugin</artifactId>
<version>${jdocbookPluginVersion}</version>
…
<configuration>
…
</formats>
<options>
<autoDetectFonts>true</autoDetectFonts>
<xmlTransformerType>saxon</xmlTransformerType>
<xincludeSupported>true</xincludeSupported>
<useRelativeImageUris>true</useRelativeImageUris>
Note
For now PDF selects the Microsoft fonts prior to those of Noto because of a baseline shift (see
also Figure 17.19, “PDF with Sans Noto fonts” and Figure 17.20, “PDF with Microsoft fonts”).
Figure 17.18. PDF without auto detect fonts
Figure 17.19. PDF with Sans Noto fonts
240
Quality Assurance
Figure 17.20. PDF with Microsoft fonts
17.3.7. PressGang Example
Create the pressgang-tools-example module in C:\dev\projects\maven-docbook\pressgang-tools-example\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.documentation</groupId>
+
<artifactId>docbook</artifactId>
+
<version>3.0-alpha</version>
+ </parent>
+
+ <artifactId>pressgang-tools-example</artifactId>
+ <packaging>jdocbook</packaging>
+
+ <name>Pressgang Tools Example (${translation})</name>
+ <description>
+
Shows how to use the pressgang styles in a maven project.
+
Also shows how each docbook element looks like.
+ </description>
+ <inceptionYear>2015</inceptionYear>
And add for example the resulting single html to the Maven site:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>${wagonMavenPluginVersion}</version>
<executions>
<execution>
<id>site-deploy-example</id>
<phase>site-deploy</phase>
<goals>
<goal>upload</goal>
</goals>
<configuration>
<fromDir>
${project.build.directory}/docbook/publish/en-US/html_single
241
Chapter 17.
+
</fromDir>
+
<includes>**</includes>
+
<serverId>mvn-sites</serverId>
+
<url>dav:${mavenHost}/maven-docbook</url>
+
<toDir>${project.artifactId}/example</toDir>
+
</configuration>
+
</execution>
+
</executions>
+
</plugin>
+
</plugins>
+ </build>
+</project>
Important
Wagon Plugin with <phase>site-deploy</phase> requires usage of phase site-deploy
instead of goals site:site site:deploy during the Jenkins build (see also Build / Goals
and Options)
17.3.8. Publication
Make sure all local changes have been committed with commands for both maven-docs and maven-docbook:
git status
git log --oneline --decorate
Also check if all remote changes are “up to date” with command:
git remote show origin
Release the maven-docs project:
mvn -Dusername=jjasper -Dpassword=password release:prepare
mvn -Dusername=jjasper -Dpassword=password release:perform -Dgoals=deploy
Upgrade the maven-docbook project to use this release of maven-docs:
mvn versions:update-parent
[INFO] Updating parent from 1.0-SNAPSHOT to 1.0
mvn versions:commit
mvn versions:update-properties
[INFO] Updated ${mavenDocsVersion} from 1.0-SNAPSHOT to 1.0
mvn versions:commit
git push or create an upgrade issue in Eclipse and commit; thus tracking every commit in
JIRA.
Release the maven-docbook project itself:
mvn -Dusername=jjasper -Dpassword=password release:prepare
mvn -Dusername=jjasper -Dpassword=password release:perform -Dgoals=deploy
242
Appendix A.
Appendix A. Tips & Tricks
A.1. Archives
A.1.1. How to extract content from MSI files
While there are plenty of utilities available to extract the contents of an MSI file, you can do it straight from
the command line: msiexec /a file.msi /qb TARGETDIR=folder.
A.1.2. How to determine absolute path of a loaded Class
Of course, this is not always possible (if you think of dynamically created classes), but if the loaded Class is inside
a jar how to get the absolute path for this jar?
package net.dev.freedumbytes.maven.qa.sandbox.classloader;
import static org.assertj.core.api.Assertions.*;
import org.junit.*;
public class ClassloaderTest
{
@Test()
public void testClassloaderResourceRequiresRelativePath()
{
assertThat(getClass().getClassLoader().getResource("/net/dev/freedumbytes/
maven/qa/sandbox/classloader/ClassloaderTest.class")).isNull();
System.out.println(getClass().getClassLoader().getResource("net/dev/
freedumbytes/maven/qa/sandbox/classloader/ClassloaderTest.class"));
assertThat(getClass().getClassLoader().getResource("net/dev/freedumbytes/
maven/qa/sandbox/classloader/ClassloaderTest.class").toString())
.endsWith("qa-sandbox/target/test-classes/net/dev/freedumbytes/maven/qa/
sandbox/classloader/ClassloaderTest.class");
}
@Test()
public void testClassResourceRequiresAbsolutePath()
{
assertThat(getClass().getResource("net/dev/freedumbytes/maven/qa/sandbox/
classloader/ClassloaderTest.class")).isNull();
System.out.println(getClass().getResource("/net/dev/freedumbytes/maven/qa/
sandbox/classloader/ClassloaderTest.class"));
assertThat(getClass().getResource("/net/dev/freedumbytes/maven/qa/sandbox/
classloader/ClassloaderTest.class").toString())
.endsWith("qa-sandbox/target/test-classes/net/dev/freedumbytes/maven/qa/
sandbox/classloader/ClassloaderTest.class");
}
@Test()
public void testAbsolutePathOfLoadedClass()
{
System.out.println(ClassloaderTest.class.getProtectionDomain().getCodeSource().getLocation().
assertThat(ClassloaderTest.class.getProtectionDomain().getCodeSource().getLocation().getPath(
.endsWith("qa-sandbox/target/test-classes/");
}
}
A.2. Version Control System
A.2.1. GitWeb enhancement
Might as well use script git-create-repo.sh to add support for creating repositories to GitWeb by patching
P:\dev\apps\vcs\git\share\gitweb\gitweb.cgi:
243
Appendix A.
@@ -760,6 +760,8 @@ our @cgi_param_mapping = (
extra_options => "opt",
search_use_regexp => "sr",
ctag => "by_tag",
+ new_project_name => "pn",
+ new_project_description => "pd",
# this must be last entry (for manipulation from JavaScript)
javascript => "js"
);
@@ -799,6 +801,7 @@ our %actions = (
"opml" => \&git_opml,
"project_list" => \&git_project_list,
"project_index" => \&git_project_index,
+ "create" => \&git_project_create,
);
# finally, we have the hash of allowed extra_options for the commands that
@@ -976,7 +979,7 @@ sub evaluate_path_info {
our ($action, $project, $file_name, $file_parent, $hash, $hash_parent,
$hash_base,
$hash_parent_base, @extra_options, $page, $searchtype, $search_use_regexp,
$searchtext, $search_regexp);
+
$searchtext, $search_regexp, $new_project_name, $new_project_description);
sub evaluate_and_validate_params {
our $action = $input_params{'action'};
if (defined $action) {
@@ -1075,6 +1078,26 @@ sub evaluate_and_validate_params {
}
$search_regexp = $search_use_regexp ? $searchtext : quotemeta $searchtext;
}
+
+ our $new_project_name = $input_params{'new_project_name'};
+ if (defined $new_project_name) {
+
if (length($new_project_name) < 1) {
+
die_error(403, "Project name is a required parameter");
+
}
+
if ($new_project_name =~ m/[^a-zA-Z0-9-]/) {
+
die_error(400, "Invalid project name parameter");
+
}
+ }
+
+ our $new_project_description = $input_params{'new_project_description'};
+ if (defined $new_project_description) {
+
if (length($new_project_description) < 1) {
+
die_error(403, "Project description is a required parameter");
+
}
+
if ($new_project_description =~ m/[^a-zA-Z0-9 -]/) {
+
die_error(400, "Invalid project description parameter");
+
}
+ }
}
# path to the current git repository
@@ -1136,7 +1159,7 @@ sub dispatch {
if (!defined($actions{$action})) {
die_error(400, "Unknown action");
}
- if ($action !~ m/^(?:opml|project_list|project_index)$/ &&
+ if ($action !~ m/^(?:opml|project_list|project_index|create)$/ &&
!$project) {
die_error(400, "Project needed");
}
@@ -6005,9 +6028,6 @@ sub git_project_list {
244
Tips & Tricks
}
-
my @list = git_get_projects_list();
if (!@list) {
die_error(404, "No projects found");
}
git_header_html();
if (defined $home_text && -f $home_text) {
@@ -6020,10 +6040,29 @@ sub git_project_list {
$cgi->textfield(-name => "s", -value => $searchtext) . "\n" .
"</p>" .
$cgi->end_form() . "\n";
- git_project_list_body(\@list, $order);
+ if (!@list) {
+
print "<center>\n".
+
"<b>No projects found</b><br />\n".
+
"</center>\n<br />\n";
+ }
+ else {
+
git_project_list_body(\@list, $order);
+ }
+ git_project_create_form();
git_footer_html();
}
+sub git_project_create_form {
+ print $cgi->startform(-method => "get") .
+
"<p align=\"right\" class=\"projcreate\">Project Name:\n" .
+
$cgi->textfield(-name => "pn", -value => $searchtext) . "\n" .
+
"Description:\n" .
+
$cgi->textfield(-name => "pd", -value => $searchtext) . "\n" .
+
$cgi->submit(-name => "a", -value => "create") . "\n" .
+
"</p>" .
+
$cgi->end_form() . "\n";
+}
+
sub git_forks {
my $order = $input_params{'order'};
if (defined $order && $order !~ m/none|project|descr|owner|age/) {
@@ -6069,6 +6108,39 @@ sub git_project_index {
}
}
+sub git_project_create {
+ if (!defined $new_project_name) {
+
die_error(400, "Project name is empty");
+ }
+ if (!defined $new_project_description) {
+
die_error(400, "Project description is empty");
+ }
+
+ my $full_project_name = "$new_project_name.git";
+
+ my @result = `git-create-repo.sh $projectroot $full_project_name
"$new_project_description"`;
+ my $exit_value = $? >> 8;
+ $result[-1] =~ s/\n/ /g;
+
+ if ($exit_value eq "9") {
+
die_error(400, "Failed to create project $full_project_name - $result[-1]");
+ }
+ elsif ($exit_value eq "1") {
+
die_error(400, "Unable to create Git repository directory - $result[-1]");
+ }
+ elsif ($exit_value eq "2") {
+
die_error(400, "Project $full_project_name already exists.");
+ }
+ elsif ($exit_value eq "3") {
245
Appendix A.
+
die_error(400, "Couldn't create temporary clone for initial commit $result[-1]");
+ }
+ elsif ($exit_value eq "4") {
+
die_error(400, "Couldn't cleanup temporary clone for initial commit $result[-1]");
+ }
+
+ git_project_list();
+}
+
sub git_summary {
my $descr = git_get_project_description($project) || "none";
my %co = parse_commit("HEAD");
Note
Make sure git-create-repo.sh is available on the BATCH_HOME [6] path.
Now it is possible to create a remote repository with GitWeb. Just enter a project name (without
.git suffix) and description by calling http://freedumbytes.dev.net/git-repo?pn=gitweb&pd=GitWeb+CGI
+enhancement&a=create direct or through the user interface enhancement:
Figure A.1. GitWeb enhancement
246
Appendix B.
Appendix B. Custom skins
Lets setup a base structure, for Maven skins to come, with the following JIRA project:
• Maven Skins [MVNSKN]: Maven custom skins (see also repository branches/maven-skins).
With the following components:
1. paper: Paperlike skin.
2. fluido: Apache Maven Fluido skin enhancement.
3. reflow: Responsive Apache Maven Reflow skin enhancement.
4. sample: Samples of Maven skins: Default, Classic, Application, Stylus and Fluido.
and versions:
• 3.0-gamma - Custom Paper skin with also Maven skins samples: Default, Classic, Application, Stylus and
Fluido.
• 3.1-gamma - Custom Fluido and Reflow skins.
Start a new bare Git repository maven-skins by calling /p/dev/apps/windows/batch/git-create-repo.sh /p/dev/data/repo/git maven-skins.git "Maven custom skins" -jenkinsHook in
Git Bash.
Clone this remote repository with the following command git-clone jjasper maven-skins.
Create the minimal base POM in C:\dev\projects\maven-skins\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+
+
+
+
<parent>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>setup</artifactId>
<version>3.1-beta</version>
</parent>
+
+
+
+
<groupId>net.dev.freedumbytes.maven.skins</groupId>
<artifactId>maven-skins</artifactId>
<version>3.1-gamma</version>
<packaging>pom</packaging>
+
+
+
+
<name>Free Dumb Bytes Maven Skins</name>
<description>Setup the site skins.</description>
<url>${mavenHost}/maven-skins</url>
<inceptionYear>2010</inceptionYear>
+
+
+
+
+
+
+
<scm>
<developerConnection>
scm:git:${gitHost}/maven-skins.git
</developerConnection>
<url>${fisheyeHost}/browse/maven-skins</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/maven-skins</url>
</ciManagement>
+
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/MVNSKN</url>
</issueManagement>
247
Appendix B.
+ <distributionManagement>
+
<site>
+
<id>mvn-sites</id>
+
<name>Maven Documentation Sites</name>
+
<url>dav:${mavenHost}/maven-skins</url>
+
</site>
+ </distributionManagement>
+</project>
In Eclipse create a Working Set Maven Skins and import this Maven Skins project into it with File → Import…
→ Maven → Existing Maven Projects from Root directory C:\dev\projects\maven-skins and click Finish.
B.1. Custom Paper Skin
To create a paperlike skin export a copy of maven-default-skin-1.1:
cd /d C:\dev\projects
svn export ^
http://svn.apache.org/repos/asf/maven/skins/tags/maven-default-skin-1.1 ^
maven-default-skin-1.1
Copy the theme into project maven-skins:
cd maven-default-skin-1.1
xcopy /S /I src\*.css C:\dev\projects\maven-skins\maven-paper-skin\src
xcopy /S /I src\*.gif C:\dev\projects\maven-skins\maven-paper-skin\src
xcopy /S /I src\*.png C:\dev\projects\maven-skins\maven-paper-skin\src
Commit those files:
1.
2.
3.
4.
5.
6.
7.
maven-skins/maven-paper-skin/src/main/resources/css/maven-theme.css
maven-skins/maven-paper-skin/src/main/resources/images/icon_error_sml.gif
maven-skins/maven-paper-skin/src/main/resources/images/icon_info_sml.gif
maven-skins/maven-paper-skin/src/main/resources/images/icon_success_sml.gif
maven-skins/maven-paper-skin/src/main/resources/images/icon_warning_sml.gif
maven-skins/maven-paper-skin/src/main/resources/images/external.png
maven-skins/maven-paper-skin/src/main/resources/images/newwindow.png
Define a new module maven-paper-skin in C:\dev\projects\maven-skins\pom.xml:
</distributionManagement>
+
+
+
+
<modules>
<module>maven-paper-skin</module>
</modules>
</project>
Supply the new module C:\dev\projects\maven-skins\maven-paper-skin\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.skins</groupId>
+
<artifactId>maven-skins</artifactId>
+
<version>3.1-gamma</version>
+ </parent>
+
+
+
+
+
248
<artifactId>maven-paper-skin</artifactId>
<packaging>jar</packaging>
<name>Free Dumb Bytes Paper Skin</name>
<description>Free Dumb Bytes paperlike skin for the Maven site.</description>
Custom skins
+ <inceptionYear>2010</inceptionYear>
+</project>
Eat your own dog food by overriding the ancestor skin settings in C:\dev\projects\maven-skins\mavenpaper-skin\pom.xml:
<inceptionYear>2010</inceptionYear>
+
+
+
+
+
+
<properties>
<skinGroupId>${project.groupId}</skinGroupId>
<skinArtifactId>${project.artifactId}</skinArtifactId>
<skinVersion>${project.version}</skinVersion>
</properties>
</project>
And also override the <skin/> part of the ancestor C:\dev\projects\maven-setup\src\site\site.xml
with a simple C:\dev\projects\maven-skins\maven-paper-skin\src\site\site.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/DECORATION/1.6.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0
+
http://maven.apache.org/xsd/decoration-1.6.0.xsd">
+
+
+
+
<bannerLeft>
<name>${project.name}</name>
<href />
</bannerLeft>
+
+
+
+
<bannerRight>
<name>Skin Sample</name>
<href />
</bannerRight>
+ <skin>
+
<groupId>${skinGroupId}</groupId>
+
<artifactId>${skinArtifactId}</artifactId>
+
<version>${skinVersion}</version>
+ </skin>
+</project>
Activate the paperlike skin for all other sites with mvn install to be able to reference it in C:\dev\projects
\maven-setup\pom.xml:
+
+
+
+
<properties>
<skinGroupId>org.apache.maven.skins</skinGroupId>
<skinArtifactId>maven-fluido-skin</skinArtifactId>
<skinVersion>${mavenFluidoSkinVersion}</skinVersion>
<skinGroupId>net.dev.freedumbytes.maven.skins</skinGroupId>
<skinArtifactId>maven-paper-skin</skinArtifactId>
<skinVersion>${customMavenPaperSkinVersion}</skinVersion>
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
<customMavenPaperSkinVersion>3.1-gamma</customMavenPaperSkinVersion>
</properties>
B.1.1. Customization
First customize the site banner and favicon with for example the following images:
1. maven-skins/maven-paper-skin/src/main/resources/images/logos/shadowrun.png
2. maven-skins/maven-paper-skin/src/main/resources/images/logos/shadowrun.jpg
Now reference them in C:\dev\projects\maven-skins\maven-paper-skin\src\site\site.xml:
<bannerLeft>
249
Appendix B.
+
+
+
<name>${project.name}</name>
<href />
<src>images/logos/shadowrun.png</src>
<alt>Free Dumb Bytes</alt>
<href>http://shadowrun.wikia.com</href>
<width />
</skin>
+
+
+
+
+
+
<body>
<head>
<link rel="shortcut icon" href="./images/logos/shadowrun.jpg" />
</head>
</body>
</project>
But before making the custom changes to the site template start out by extracting the doxia-sitetools siterenderer resources of version 1.2 with:
cd /d C:\dev\projects
svn export ^
http://svn.apache.org/repos/asf/maven/doxia/doxia-sitetools/tags/doxiasitetools-1.2 ^
doxia-sitetools-1.2
Note
The sample version in the subversion repository is update to doxia-sitetools-1.6.
Copy the resources into project maven-skins:
cd doxia-sitetools-1.2\doxia-site-renderer\src\main\resources
cd org\apache\maven\doxia\siterenderer\resources
mkdir C:\dev\projects\maven-skins\maven-paper-skin\src\main\resources\META-INF
\maven
copy default-site.vm ^
C:\dev\projects\maven-skins\maven-paper-skin\src\main\resources\META-INF
\maven\site.vm
xcopy /S /I css ^
C:\dev\projects\maven-skins\maven-paper-skin\src\main\resources\css
xcopy /S /I images ^
C:\dev\projects\maven-skins\maven-paper-skin\src\main\resources\images
Commit those resource files:
1.
2.
3.
4.
5.
6.
maven-skins/maven-paper-skin/src/main/resources/META-INF/maven/site.vm
maven-skins/maven-paper-skin/src/main/resources/css/maven-base.css
maven-skins/maven-paper-skin/src/main/resources/css/print.css
maven-skins/maven-paper-skin/src/main/resources/images/collapsed.gif
maven-skins/maven-paper-skin/src/main/resources/images/expanded.gif
maven-skins/maven-paper-skin/src/main/resources/images/logos/build-by-mavenblack.png
7. maven-skins/maven-paper-skin/src/main/resources/images/logos/build-by-mavenwhite.png
8. maven-skins/maven-paper-skin/src/main/resources/images/logos/maven-feather.png
Create a Fixed Header & Footer Layout:
1.
2.
3.
4.
5.
6.
7.
8.
250
maven-skins/maven-paper-skin/src/main/resources/css/maven-base.css
maven-skins/maven-paper-skin/src/main/resources/css/maven-theme.css
maven-skins/maven-paper-skin/src/main/resources/css/print.css
maven-skins/maven-paper-skin/src/main/resources/images/gradient-header.png
maven-skins/maven-paper-skin/src/main/resources/images/gradient-footer.png
maven-skins/maven-paper-skin/src/main/resources/images/paper.jpg
maven-skins/maven-paper-skin/src/main/resources/images/logos/hacker.png
maven-skins/maven-paper-skin/src/main/resources/js/css-browser-selector.js
Custom skins
9. maven-skins/maven-paper-skin/src/main/resources/META-INF/maven/site.vm
Since the banner logo and the favicon are now set in maven-theme.css and site.vm remove the references in
C:\dev\projects\maven-skins\maven-paper-skin\src\site\site.xml:
-
<bannerLeft>
<src>images/logos/shadowrun.png</src>
<alt>Free Dumb Bytes</alt>
<href>http://shadowrun.wikia.com</href>
</bannerLeft>
<bannerRight>
</skin>
-
<body>
<head>
<link rel="shortcut icon" href="./images/logos/shadowrun.jpg" />
</head>
</body>
</project>
Note
Favicons are no longer shown in Firefox URL Bar.
Create a parchment like menu with Liquid Round Corners:
1.
2.
3.
4.
maven-skins/maven-paper-skin/src/main/resources/css/maven-base.css
maven-skins/maven-paper-skin/src/main/resources/css/maven-theme.css
maven-skins/maven-paper-skin/src/main/resources/images/parchment.gif
maven-skins/maven-paper-skin/src/main/resources/images/parchment-left-righttearoff.gif
5. maven-skins/maven-paper-skin/src/main/resources/images/parchment-topbottom-tearoff.gif
6. maven-skins/maven-paper-skin/src/main/resources/META-INF/maven/site.vm
Reclaim the empty space below the menu:
Index: maven-skins/maven-paper-skin/src/main/resources/css/maven-base.css
=========================================================================
table {
padding:0px;
- width: 100%;
+ min-width: 70%;
margin-left: -2px;
margin-right: -2px;
}
+
+
#leftColumn {
width: 280px;
float:left;
overflow: auto;
float: right;
overflow: hidden;
}
+
+
#bodyColumn {
margin-right: 1.5em;
margin-left: 300px;
margin: 0px;
padding: 5px;
}
Index: maven-skins/maven-paper-skin/src/main/resources/css/maven-theme.css
251
Appendix B.
==========================================================================
#leftColumn {
- margin: 10px 0 0 5px;
- padding-bottom: 3px; /* IE-9 scrollbar-fix */
+ margin: 0px;
+ padding: 5px;
+ position: relative;
+ z-index:999;
}
Activate the changes with mvn install and verify them with mvn site in your browser at file:///C:/dev/projects/
maven-skins/maven-paper-skin/target/site/index.html.
Figure B.1. Paperlike Skin Sample
Release 3.0-gamma-SNAPSHOT with:
mvn -Dusername=jjasper -Dpassword=password release:prepare
mvn -Dusername=jjasper -Dpassword=password release:perform -Dgoals=deploy
B.2. Custom Fluido Skin
To add some custom imagery repackage the Apache Maven Fluido Skin.
Define a new module maven-fluido-skin in C:\dev\projects\maven-skins\pom.xml:
</distributionManagement>
<modules>
<module>maven-paper-skin</module>
+
<module>maven-fluido-skin</module>
</modules>
</project>
Supply the new module C:\dev\projects\maven-skins\maven-fluido-skin\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.skins</groupId>
+
<artifactId>maven-skins</artifactId>
+
<version>3.1-gamma</version>
+ </parent>
252
Custom skins
+
+
+
+
+
+
+
+
<artifactId>maven-fluido-skin</artifactId>
<packaging>jar</packaging>
+
+
+
+
+
<properties>
<skinGroupId>${project.groupId}</skinGroupId>
<skinArtifactId>${project.artifactId}</skinArtifactId>
<skinVersion>${project.version}</skinVersion>
</properties>
<name>Free Dumb Bytes Fluido Skin</name>
<description>
Free Dumb Bytes repackaged Fluido skin for the Maven site.
</description>
<inceptionYear>2012</inceptionYear>
+ <build>
+
<plugins>
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-dependency-plugin</artifactId>
+
<executions>
+
<execution>
+
<id>unpack-fluido-skin-stuff</id>
+
<phase>generate-resources</phase>
+
<goals>
+
<goal>unpack</goal>
+
</goals>
+
<configuration>
+
<artifactItems>
+
<artifactItem>
+
<groupId>org.apache.maven.skins</groupId>
+
<artifactId>maven-fluido-skin</artifactId>
+
<version>${mavenFluidoSkinVersion}</version>
+
<overWrite>true</overWrite>
+
<outputDirectory>
+
${project.build.outputDirectory}
+
</outputDirectory>
+
</artifactItem>
+
</artifactItems>
+
<excludes>
+
**/MANIFEST.MF,
+
**/META-INF/maven/org.apache.maven.skins/**,
+
</excludes>
+
</configuration>
+
</execution>
+
</executions>
+
</plugin>
+
</plugins>
+ </build>
+</project>
Supply the site banners, powered by and favicon with for example the following images:
1. maven-skins/maven-fluido-skin/src/main/
resources/images/logos/Bocca-della-Verita.png
2. maven-skins/maven-fluido-skin/src/main/resources/images/logos/hacker.png
3. maven-skins/maven-fluido-skin/src/main/resources/images/logos/Janus.png
4. maven-skins/maven-fluido-skin/src/main/resources/images/logos/shadowrun.jpg
Now reference them in C:\dev\projects\maven-setup\src\site\site.xml:
+
+
+
+
+
<bannerLeft>
<name>Free Dumb Bytes</name>
<href>${devHost}</href>
<name>Bocca della Verità</name>
<src>images/logos/Bocca-della-Verita.png</src>
<href>http://en.wikipedia.org/wiki/Bocca_della_Verita</href>
<width>138</width>
<height>125</height>
</bannerLeft>
253
Appendix B.
+
+
+
+
+
+
+
<bannerRight>
<name>Janus</name>
<src>images/logos/Janus.png</src>
<href>http://en.wikipedia.org/wiki/Janus</href>
<width>116</width>
<height>125</height>
</bannerRight>
<publishDate position="left" format="yyyy-MM-dd HH:mm:ss z" />
<version position="right" />
+
+
+
+
+
+
+
+
+
+
<poweredBy>
<logo name="Free Dumb Bytes"
href="${mavenHost}"
img="./images/logos/hacker.png"
width="80" height="15" />
</poweredBy>
<body>
<head>
<link rel="shortcut icon" href="./images/logos/shadowrun.jpg" />
</head>
<menu name="Free Dumb Bytes" inherit="top">
To customize the site layout get a copy of C:\dev\projects\maven-skins\maven-fluido-skin\target\classes\META-INF\maven\site.vm in C:\dev\projects\maven-skins\maven-fluido-skin
\src\main\resources\META-INF\maven. And tweak for example the banner to always display the project
name.
Release 3.1-gamma-SNAPSHOT with:
mvn -Dusername=jjasper -Dpassword=password release:prepare
mvn -Dusername=jjasper -Dpassword=password release:perform -Dgoals=deploy
Activate the repackaged skin for all other sites in C:\dev\projects\maven-setup\pom.xml:
</distributionManagement>
+
+
+
<properties>
<skinGroupId>net.dev.freedumbytes.maven.skins</skinGroupId>
<skinArtifactId>maven-paper-skin</skinArtifactId>
<skinVersion>${customMavenPaperSkinVersion}</skinVersion>
<skinArtifactId>maven-fluido-skin</skinArtifactId>
<skinVersion>${customMavenFluidoSkinVersion}</skinVersion>
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
<customMavenFluidoSkinVersion>3.1-gamma</customMavenFluidoSkinVersion>
<customMavenPaperSkinVersion>3.1-gamma</customMavenPaperSkinVersion>
</properties>
Figure B.2. Fluido Skin Sample
254
Custom skins
B.3. Custom Reflow Skin
Alternatively to add some custom style repackage the Reflow Maven Skin, which is a Responsive Apache Maven
skin to reflow the standard Maven site with a modern feel.
Define a new module maven-reflow-skin in C:\dev\projects\maven-skins\pom.xml:
</distributionManagement>
<modules>
<module>maven-paper-skin</module>
<module>maven-fluido-skin</module>
+
<module>maven-reflow-skin</module>
</modules>
</project>
Supply the new module C:\dev\projects\maven-skins\maven-reflow-skin\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+
<groupId>net.dev.freedumbytes.maven.skins</groupId>
+
<artifactId>maven-skins</artifactId>
+
<version>3.1-gamma</version>
+ </parent>
+
+
+
+
+
+
+
+
<artifactId>maven-reflow-skin</artifactId>
<packaging>jar</packaging>
+
+
+
+
+
<properties>
<skinGroupId>${project.groupId}</skinGroupId>
<skinArtifactId>${project.artifactId}</skinArtifactId>
<skinVersion>${project.version}</skinVersion>
</properties>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>lt.velykis.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>${mavenReflowSkinVersion}</version>
</dependency>
<name>Free Dumb Bytes Reflow Skin</name>
<description>
Free Dumb Bytes repackaged Reflow skin for the Maven site.
</description>
<inceptionYear>2015</inceptionYear>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocityVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
255
Appendix B.
+
+
<plugins>
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-dependency-plugin</artifactId>
+
<executions>
+
<execution>
+
<id>unpack-reflow-skin-stuff</id>
+
<phase>generate-resources</phase>
+
<goals>
+
<goal>unpack</goal>
+
</goals>
+
<configuration>
+
<artifactItems>
+
<artifactItem>
+
<groupId>lt.velykis.maven.skins</groupId>
+
<artifactId>reflow-maven-skin</artifactId>
+
<version>${mavenReflowSkinVersion}</version>
+
<overWrite>true</overWrite>
+
<outputDirectory>
+
${project.build.outputDirectory}
+
</outputDirectory>
+
</artifactItem>
+
</artifactItems>
+
<excludes>
+
**/MANIFEST.MF,
+
**/META-INF/maven/lt.velykis.maven.skins/**,
+
</excludes>
+
</configuration>
+
</execution>
+
</executions>
+
</plugin>
+
</plugins>
+ </build>
+</project>
Again supply the site banner, footer and favicon stuff with for example the following images:
1. maven-skins/maven-reflow-skin/src/main/
resources/images/logos/Bocca-della-Verita.png
2. maven-skins/maven-reflow-skin/src/main/resources/images/logos/hacker.png
3. maven-skins/maven-reflow-skin/src/main/resources/images/logos/Janus.png
4. maven-skins/maven-reflow-skin/src/main/resources/images/logos/shadowrun.jpg
To customize the site layout get a copy of C:\dev\projects\maven-skins\maven-reflow-skin\target\classes\META-INF\maven\site.vm in C:\dev\projects\maven-skins\maven-reflow-skin
\src\main\resources\META-INF\maven. And upgrade and/or tweak using localResouces for example:
1. The HTML5 Shiv [version 3.7.3] enables use of HTML5 sectioning elements in legacy Internet Explorer and
provides basic HTML5 styling for Internet Explorer 6-9, Safari 4.x (and iPhone 3.x), and Firefox 3.x. For the full
story of HTML5 Shiv and all of the people involved in making it, read The Story of the HTML5 Shiv.
2. Bootstrap [version 2.3.2] is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web. Upgrade as local resources: bootstrap.min.css,
bootstrap-responsive.min.css and bootstrap.min.js. Keep Reflow Skin supplied: glyphicons-halflings.png and glyphicons-halflings-white.png.
3. Bootswatch [version 2.3.2] saving the web from default Bootstrap. Switch to for example United and Readable. Or customize United with a darker body and a lighter well. Support responsiveness for desktops with
width 1920 and bigger.
4. jQuery [version 1.11.3] is a fast, small, and feature-rich JavaScript library. It makes things like HTML document
traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that
works across a multitude of browsers.
5. highlight.js [version 8.9.1] Syntax highlighting for the Web. Switch to Github Gist theme. Also fix usage of
highlightJs flag for localResources.
6. Lightbox [version 2.8.1] is small javascript library used to overlay images on top of the current page.
7. Fix 'Back to Top' link which isn't working because of smooth scrolling for anchor links.
8. Fix bottom-nav menu highlighting issues (multiple highlight for submenu and its last menuitem; and missing
highlight for submenu itself).
256
Custom skins
Figure B.3. Lightbox Sample
257
Appendix B.
Release 3.1-gamma-SNAPSHOT with:
mvn -Dusername=jjasper -Dpassword=password release:prepare
mvn -Dusername=jjasper -Dpassword=password release:perform -Dgoals=deploy
Activate the repackaged skin for all other sites in C:\dev\projects\maven-setup\pom.xml (don't forget the
extra velocity tools and its required velocity upgrade for the site plugin):
</distributionManagement>
+
+
+
+
+
<properties>
<skinGroupId>net.dev.freedumbytes.maven.skins</skinGroupId>
<skinArtifactId>maven-fluido-skin</skinArtifactId>
<skinVersion>${customMavenFluidoSkinVersion}</skinVersion>
<skinArtifactId>maven-reflow-skin</skinArtifactId>
<skinVersion>${customMavenReflowSkinVersion}</skinVersion>
<velocityVersion>1.7</velocityVersion>
<mavenReflowSkinVersion>1.1.1</mavenReflowSkinVersion>
<customMavenReflowSkinVersion>3.1-gamma</customMavenReflowSkinVersion>
<mavenFluidoSkinVersion>1.4</mavenFluidoSkinVersion>
<customMavenFluidoSkinVersion>3.1-gamma</customMavenFluidoSkinVersion>
<customMavenPaperSkinVersion>3.1-gamma</customMavenPaperSkinVersion>
</properties>
<build>
…
+
+
+
+
+
+
+
+
+
+
+
+
+
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${mavenSitePluginVersion}</version>
<dependencies>
<dependency>
<groupId>lt.velykis.maven.skins</groupId>
<artifactId>reflow-velocity-tools</artifactId>
<version>${mavenReflowSkinVersion}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocityVersion}</version>
</dependency>
</dependencies>
<configuration>
<generateSitemap>true</generateSitemap>
<inputEncoding>UTF-8</inputEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
</plugin>
…
</plugins>
</pluginManagement>
Now switch from custom fluido settings to those for reflow in C:\dev\projects\maven-setup\src\site
\site.xml:
-
<bannerLeft>
<name>Bocca della Verità</name>
<src>images/logos/Bocca-della-Verita.png</src>
<href>http://en.wikipedia.org/wiki/Bocca_della_Verita</href>
<width>138</width>
<height>125</height>
</bannerLeft>
<bannerRight>
258
Custom skins
+
+
+
+
<name>Janus</name>
<src>images/logos/Janus.png</src>
<href>http://en.wikipedia.org/wiki/Janus</href>
<width>116</width>
<name>Bocca della Verità</name>
<src>images/logos/Bocca-della-Verita.png</src>
<href>http://en.wikipedia.org/wiki/Bocca_della_Verita</href>
<width>138</width>
<height>125</height>
</bannerRight>
-
<publishDate position="left" format="yyyy-MM-dd HH:mm:ss z" />
<version position="right" />
<poweredBy>
<logo name="Free Dumb Bytes" href="${mavenHost}"
img="./images/logos/hacker.png" width="80" height="15" />
</poweredBy>
<skin>
<groupId>${skinGroupId}</groupId>
<version>${skinVersion}</version>
</skin>
+
+
<publishDate position="bottom" format="yyyy-MM-dd HH:mm:ss z" />
<version position="navigation-bottom" />
+
+
<custom>
<fluidoSkin>
<topBarEnabled>true</topBarEnabled>
<navBarStyle>navbar-inverse</navBarStyle>
<reflowSkin>
<localResources>true</localResources>
+
<sideBarEnabled>true</sideBarEnabled>
<leftColumnClass>span2</leftColumnClass>
<bodyColumnClass>span10</bodyColumnClass>
<highlightJs>true</highlightJs>
-
<sourceLineNumbersEnabled>true</sourceLineNumbersEnabled>
<copyrightClass>pull-right</copyrightClass>
</fluidoSkin>
+
+
+
+
+
+
+
+
+
<brand>
<name>Free Dumb Bytes</name>
<href>${devHost}</href>
</brand>
<slogan>
Outside of a dog, a book is a man's best friend.
Inside of a dog it's too dark to read.
</slogan>
<titleTemplate>%2$s | %1$s</titleTemplate>
+
+
+
+
+
<topNav>parent|modules|reports</topNav>
<navbarInverse>true</navbarInverse>
+
+
+
+
+
<pages>
<source-repository>
<highlightJs>false</highlightJs>
</source-repository>
<issue-tracking>
<breadcrumbs>false</breadcrumbs>
<toc>false</toc>
259
Appendix B.
+
+
+
+
+
+
<highlightJs>false</highlightJs>
</issue-tracking>
<integration>
<highlightJs>false</highlightJs>
</integration>
</pages>
+
+
+
+
+
<bottomNav maxSpan="9">
<column>Free Dumb Bytes</column>
<column>parent|modules|Example</column>
<column>reports</column>
</bottomNav>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<bottomDescription>
<![CDATA[
<div>
<a href="http://en.wikipedia.org/wiki/Janus">
<img src="images/logos/Janus.png" alt="Janus"
width="116" height="125">
</a>
</div>
I never forget a face, but in your case I'll be glad to make an exception.
<div>
<a href="${devHost}" title="Free Dumb Bytes" class="builtBy">
<img class="builtBy" alt="Free Dumb Bytes"
src="images/logos/hacker.png" width="80" height="15">
</a>
</div>
]]>
</bottomDescription>
+
+
<skinAttribution>false</skinAttribution>
</reflowSkin>
</custom>
+
+
+
<body>
<menu name="Example">
<item name="PressGang" href="example/index.html" />
</menu>
Note
Don't forget to edit a column
260
in bottomNav to make the additional menu Example visible.
Custom skins
Figure B.4. Reflow Skin Sample
After the activation of the custom reflow settings fix fluido skin error “ParseException: Encountered "source" at
line 1162, column 52. Was expecting one of: "," … ")" … <WHITESPACE> …” due to velocity upgrade in C:\dev
\projects\maven-skins\maven-fluido-skin\pom.xml:
<skinGroupId>${project.groupId}</skinGroupId>
<skinArtifactId>${project.artifactId}</skinArtifactId>
<skinVersion>${project.version}</skinVersion>
+
+
<velocityVersion>1.6.4</velocityVersion>
</properties>
and override the unsupported position attribute in C:\dev\projects\maven-skins\maven-fluido-skin\src\site\site.xml:
</bannerRight>
261
Appendix B.
+
+
+
+
<publishDate position="left" format="yyyy-MM-dd HH:mm:ss z" />
<version position="right" />
<poweredBy>
Also after the activation of the custom reflow settings fix reflow skin sample now overridden default settings in
C:\dev\projects\maven-skins\maven-reflow-skin-sample\src\site\site.xml:
+
+
262
<custom>
<reflowSkin>
<localResources>false</localResources>
<theme>bootswatch-united</theme>
…
<skinAttribution>true</skinAttribution>
</reflowSkin>
</custom>
Appendix C.
Appendix C. Quality Assurance
Sandbox
Lets setup a base structure, for Quality Assurance Sandbox code to come, with the following JIRA project:
• Quality Assurance Sandbox [QASNDBX]: Quality Assurance Sandbox sample code (see also repository branches/qa-sandbox).
With the following components:
1. sandbox: Code sandbox.
and versions:
• 1.0-delta - Quality Assurance Plugins config: Javadoc, JXR, JavaNCSS, JDepend, Clover, FindBugs, PMD and
Checkstyle.
• 1.1-delta - Switch from Clover to JaCoCo.
Start a new bare Git repository qa-sandbox by calling /p/dev/apps/windows/batch/git-create-repo.sh
/p/dev/data/repo/git qa-sandbox.git "Quality Assurance Sandbox sample code" -jenkinsHook in Git Bash.
Clone this remote repository with the following command git-clone jjasper qa-sandbox.
Create the Quality Assurance Sandbox project, with sample code for FindBugs, PMD and Checkstyle to eliminate
duplicate checks, in C:\dev\projects\qa-sandbox\pom.xml:
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+
+
+
+
<parent>
<groupId>net.dev.freedumbytes.maven</groupId>
<artifactId>java-se-8-base-pom</artifactId>
<version>3.1-beta</version>
</parent>
+
+
<artifactId>qa-sandbox</artifactId>
<version>1.1-delta</version>
+
+
+
+
+
+
+
<name>Free Dumb Bytes Quality Assurance Sandbox</name>
<description>
Free Dumb Bytes sample code for Javadoc, JXR, JavaNCSS, JDepend,
JaCoCo, FindBugs, PMD and Checkstyle to eliminate duplicate checks.
</description>
<url>${mavenHost}/qa-sandbox</url>
<inceptionYear>2010</inceptionYear>
+
+
+
+
+
<scm>
<developerConnection>scm:git:${gitHost}/qa-sandbox.git</developerConnection>
<url>${fisheyeHost}/browse/qa-sandbox</url>
<tag>HEAD</tag>
</scm>
+
+
+
+
<ciManagement>
<system>Jenkins</system>
<url>${jenkinsHost}/job/qa-sandbox</url>
</ciManagement>
+
+
+
<issueManagement>
<system>JIRA</system>
<url>${jiraHost}/projects/QASNDBX</url>
263
Appendix C.
+
</issueManagement>
+
+
+
+
+
+
+
<distributionManagement>
<site>
<id>mvn-sites</id>
<name>Maven Documentation Sites</name>
<url>dav:${mavenHost}/qa-sandbox</url>
</site>
</distributionManagement>
+
+
+
+
+
+
+
<properties>
<!-- (see also Section 16.1.7.2, “Surefire”) -->
<skipIntegrationTests>${skipTests}</skipIntegrationTests>
<commonsLoggingVersion>1.1.2</commonsLoggingVersion>
<junitVersion>4.12</junitVersion>
</properties>
+ <dependencies>
+
<dependency>
+
<groupId>commons-logging</groupId>
+
<artifactId>commons-logging</artifactId>
+
<version>${commonsLoggingVersion}</version>
+
<scope>provided</scope>
+
</dependency>
+
+
<dependency>
+
<groupId>junit</groupId>
+
<artifactId>junit</artifactId>
+
<version>${junitVersion}</version>
+
<scope>test</scope>
+
</dependency>
+ </dependencies>
+</project>
In Eclipse create a Working Set Quality Assurance Sandbox and import this Maven Skins project into it with
File → Import… → Maven → Existing Maven Projects from Root directory C:\dev\projects\qa-sandbox
and click Finish.
Tip
In case of the following build error “Access restriction: The type … is not accessible due to
restrictions on required library …\jre\lib\rt.jar” select for the project in question Project →
Properties → Java Build Path → Libraries and Remove the JRE System Library. After that
Add Library… JRE System Library back again.
C.1. Javadoc report
Alas configuring the Javadoc plugin in the <reporting/> or <build/> elements in the pom have not the same
behavior as described in the Guide to Configuring Plug-ins. Thus the configuration has to be duplicated in C:\dev
\projects\qa-sandbox\pom.xml:
</dependencies>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
264
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${mavenJavadocPluginVersion}</version>
<configuration>
<javadocExecutable>${baseJavadocExecutable}</javadocExecutable>
<javadocVersion>${baseJavadocVersion}</javadocVersion>
<source>${baseJdkVersion}</source>
<quiet>true</quiet>
<detectJavaApiLink>false</detectJavaApiLink>
<detectOfflineLinks>false</detectOfflineLinks>
<breakiterator>true</breakiterator>
Quality Assurance Sandbox
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<show>protected</show>
<minmemory>128m</minmemory>
<maxmemory>512m</maxmemory>
<encoding>UTF-8</encoding>
<docencoding>UTF-8</docencoding>
</configuration>
<reportSets>
<reportSet>
<id>javadoc-reports</id>
<reports>
<report>javadoc(-no-fork)</report>
<report>test-javadoc(-no-fork)</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
C.2. Cross-reference
The JXR Plugin produces a cross-reference of the project's sources. The generated reports make it easier for the
user to reference or find specific lines of code (see also Quality Assurance plugins).
<properties>
…
<commonsLoggingVersion>1.1.2</commonsLoggingVersion>
<junitVersion>4.12</junitVersion>
+
+
<mavenJxrPluginVersion>2.5</mavenJxrPluginVersion>
</properties>
…
<reporting>
<plugins>
…
+
<plugin>
+
<groupId>org.apache.maven.plugins</groupId>
+
<artifactId>maven-jxr-plugin</artifactId>
+
<version>${mavenJxrPluginVersion}</version>
+
<configuration>
+
<aggregate>false</aggregate>
+
<linkJavadoc>true</linkJavadoc>
+
<inputEncoding>UTF-8</inputEncoding>
+
<outputEncoding>UTF-8</outputEncoding>
+
</configuration>
+
</plugin>
</plugins>
</reporting>
</project>
Make use of this cross-reference in the surefire report by overriding the inherited linkXRef in C:\dev\projects
\qa-sandbox\pom.xml:
+
+
+
+
+
+
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${mavenSurefireReportPluginVersion}</version>
<configuration>
<linkXRef>true</linkXRef>
</configuration>
</plugin>
</plugins>
</reporting>
C.3. Maven Quality Assurance reports
The following sections contain the configuration of the Maven Quality Assurance plugins (see also Maven vs SonarQube Quality Assurance reports comparison).
265
Appendix C.
C.3.1. Checkstyle
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It
automates the process of checking Java code to spare humans of this boring (but important) task. This makes it
ideal for projects that want to enforce a coding standard.
Setup the latest Checkstyle Plugin:
<properties>
…
<mavenJxrPluginVersion>2.5</mavenJxrPluginVersion>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<mavenCheckstylePluginVersion>2.17</mavenCheckstylePluginVersion>
<checkstyleVersion>6.12.1</checkstyleVersion>
</properties>
…
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${mavenCheckstylePluginVersion}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyleVersion}</version>
<exclusions>
<exclusion>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Configure the report:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
266
<reporting>
<plugins>
…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${mavenCheckstylePluginVersion}</version>
<configuration>
<configLocation>
${basedir}/src/qa-config/checkstyle.xml
</configLocation>
<outputFileFormat>xml</outputFileFormat>
<includeTestSourceDirectory>false</includeTestSourceDirectory>
<includeTestResources>false</includeTestResources>
<enableRSS>true</enableRSS>
<enableSeveritySummary>true</enableSeveritySummary>
<enableRulesSummary>false</enableRulesSummary>
<enableFilesSummary>true</enableFilesSummary>
<linkXRef>true</linkXRef>
<excludes>**/generated/**/*.java</excludes>
<encoding>UTF-8</encoding>
</configuration>
<reportSets>
<reportSet>
<reports>
<report>checkstyle</report>
</reports>
</reportSet>
Quality Assurance Sandbox
+
+
</reportSets>
</plugin>
</plugins>
</reporting>
C.3.2. PMD/CPD
PMD scans Java source code and looks for potential problems.
Duplicate code can be hard to find, especially in a large project. But PMD's Copy/Paste Detector (CPD) can find
it for you.
Setup the latest PMD Plugin:
<checkstyleVersion>6.12.1</checkstyleVersion>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<mavenPmdPluginVersion>3.5</mavenPmdPluginVersion>
<pmdVersion>5.4.0</pmdVersion>
</properties>
…
<build>
<pluginManagement>
<plugins>
…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${mavenPmdPluginVersion}</version>
<dependencies>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-core</artifactId>
<version>${pmdVersion}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd-java</artifactId>
<version>${pmdVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Configure the report:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${mavenPmdPluginVersion}</version>
<configuration>
<aggregate>false</aggregate>
<includeTests>true</includeTests>
<format>xml</format>
<linkXref>true</linkXref>
<minimumPriority>5</minimumPriority>
<minimumTokens>100</minimumTokens>
<rulesets>
<ruleset>${basedir}/src/qa-config/pmd-java.xml</ruleset>
</rulesets>
<excludes>
<exclude>**/generated/**/*.java</exclude>
</excludes>
<targetJdk>${baseJdkVersion}</targetJdk>
<sourceEncoding>UTF-8</sourceEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
<reportSets>
267
Appendix C.
+
+
+
+
+
+
+
+
<reportSet>
<reports>
<report>pmd</report>
<report>cpd</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
C.3.3. FindBugs
FindBugs uses static analysis to inspect Java bytecode for occurrences of bug patterns. Static analysis means
that FindBugs can find bugs by simply inspecting a program's code: executing the program is not necessary.
Setup the latest FindBugs Plugin:
<pmdVersion>5.4.0</pmdVersion>
+
+
+
+
+
+
+
+
<findbugsMavenPluginVersion>3.0.3</findbugsMavenPluginVersion>
<findbugsVersion>3.0.1</findbugsVersion>
</properties>
…
<build>
<pluginManagement>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugsMavenPluginVersion}</version>
</plugin>
</plugins>
</pluginManagement>
</build>
Configure the report:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugsMavenPluginVersion}</version>
<configuration>
<effort>Default</effort>
<threshold>Low</threshold>
<debug>false</debug>
<includeTests>true</includeTests>
<maxHeap>512</maxHeap>
<timeout>600000</timeout>
<xmlOutput>true</xmlOutput>
<sourceEncoding>UTF-8</sourceEncoding>
<outputEncoding>UTF-8</outputEncoding>
<includeFilterFile>
${basedir}/src/qa-config/findbugs-include.xml
</includeFilterFile>
<excludeFilterFile>
${basedir}/src/qa-config/findbugs-exclude.xml
</excludeFilterFile>
</configuration>
</plugin>
</plugins>
</reporting>
C.3.4. JavaNCSS
JavaNCSS is a source measurement suite for Java which produces quantity & complexity metrics for your java
source code.
268
Quality Assurance Sandbox
Setup the latest JavaNCSS Plugin:
<findbugsVersion>3.0.1</findbugsVersion>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<javancssMavenPluginVersion>2.1</javancssMavenPluginVersion>
<javancssVersion>33.54</javancssVersion>
</properties>
…
<build>
<pluginManagement>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>${javancssMavenPluginVersion}</version>
<dependencies>
<dependency>
<groupId>org.codehaus.javancss</groupId>
<artifactId>javancss</artifactId>
<version>${javancssVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Configure the report:
+
+
+
+
+
+
+
+
+
+
+
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>javancss-maven-plugin</artifactId>
<version>${javancssMavenPluginVersion}</version>
<configuration>
<lineThreshold>30</lineThreshold>
<linkXRef>true</linkXRef>
<excludes>
<exclude>**/generated/**/*.java</exclude>
</excludes>
<sourceEncoding>UTF-8</sourceEncoding>
</configuration>
</plugin>
</plugins>
</reporting>
Note
JavaNCSS and Java 8 syntax cause “ParseException in …\OptionalDemoOne.java Last useful
checkpoint: "….OptionalDemoOne.main(String[])" Encountered " ":" ": "" at line x, column y”.
C.3.5. JDepend
While JavaNCSS simply lets you know how much source code you have to deal with (ncss metric), JDepend informs
you about the package structure of your code and helps you spotting weaknesses in your global code organization,
e.g. identifying dependency cycles, creating a few independent packages on which most other package rely on,
etc.
JDepend traverses Java class file directories and generates design quality metrics for each Java package. JDepend allows you to automatically measure the quality of a design in terms of its extensibility, reusability, and
maintainability to manage package dependencies effectively.
Setup the latest JDepend Plugin:
<javancssVersion>33.54</javancssVersion>
+
269
Appendix C.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<jdependMavenPluginVersion>2.0</jdependMavenPluginVersion>
<jdependVersion>2.9.1</jdependVersion>
</properties>
…
<build>
<pluginManagement>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>${jdependMavenPluginVersion}</version>
<dependencies>
<dependency>
<groupId>jdepend</groupId>
<artifactId>jdepend</artifactId>
<version>${jdependVersion}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
Configure the report:
+
+
+
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jdepend-maven-plugin</artifactId>
<version>${jdependMavenPluginVersion}</version>
</plugin>
</plugins>
</reporting>
C.3.6. Code Coverage
In computer science, code coverage is a measure used to describe the degree to which the source code of a program is tested by a particular test suite. A program with high code coverage has been more thoroughly tested and
has a lower chance of containing software bugs than a program with low code coverage. Many different metrics
can be used to calculate code coverage; some of the most basic are the percent of program subroutines and the
percent of program statements called during execution of the test suite.
C.3.6.1. JaCoCo
To generate reports for the JaCoCo code coverage, that was recorded during surefire and failsafe plugin execution, add the following in C:\dev\projects\qa-sandbox\pom.xml:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
270
<reporting>
<plugins>
…
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<id>jacoco-unit-reports</id>
<configuration>
<dataFile>${coverageReportsPathUnit}</dataFile>
</configuration>
<reports>
<report>report</report>
</reports>
</reportSet>
<reportSet>
<id>jacoco-integration-reports</id>
<configuration>
<dataFile>${coverageReportsPathIntegration}</dataFile>
</configuration>
<reports>
Quality Assurance Sandbox
+
+
+
+
+
+
<report>report-integration</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
Important
When using custom dataFiles and running Clover instrumentation also the JaCoCo IT Coverage
Report will incorrectly show JaCoCo Test Coverage Report content.
C.3.6.2. Clover
Clover goes beyond basic code coverage metrics to help you prioritise time spent creating new tests.
Configure that Clover is run in the pre-site <phase/>:
<jdependVersion>2.9.1</jdependVersion>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<cloverMavenPluginVersion>4.1.1</cloverMavenPluginVersion>
</properties>
…
<build>
<pluginManagement>
<plugins>
…
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>clover-maven-plugin</artifactId>
<version>${cloverMavenPluginVersion}</version>
<configuration>
<jdk>${baseJdkVersion}</jdk>
</configuration>
<executions>
<execution>
<id>create-clover-database</id>
<phase>pre-site</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
Setup the Clover Plugin (Changelog) to run instrument goal:
</pluginManagement>
+
+
+
+
+
+
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>clover-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Configure the report:
+
+
<reporting>
<plugins>
…
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
271
Appendix C.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
<artifactId>clover-maven-plugin</artifactId>
<version>${cloverMavenPluginVersion}</version>
<configuration>
<targetPercentage>70%</targetPercentage>
<generateHistorical>false</generateHistorical>
<generateHtml>true</generateHtml>
<generateJson>false</generateJson>
<generatePdf>false</generatePdf>
<generateXml>true</generateXml>
<charset>UTF-8</charset>
<!-<licenseLocation>
${basedir}/src/qa-config/clover.license
</licenseLocation>
-->
<excludes>
<exclude>**/generated/*.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</reporting>
Figure C.1. QA Sandbox Reports Sample
272
Appendix D.
Appendix D. Source
Downloads for the sources from the following sections (in release order):
• Maven Setup 3.1-beta repository branches/maven-setup (see also Chapter 16, Project).
• Bill of Materials 3.1-epsilon repository branches/bill-of-materials (see also Section 16.1.12, “Grouping Dependencies”).
• Maven Versions Rules 1.0-kappa repository branches/maven-versions-rules (see also Figure 16.2, “Maven Versions Property Updates Report”).
• Maven Eclipse Lifecycle Mapping 1.0-lambda repository branches/lifecycle-mapping (see also Section 16.1.13,
“M2Eclipse lifecycle configuration”).
• Maven Skins 3.1-gamma repository branches/maven-skins (see also Appendix B, Custom skins).
• Maven Docs repository 2.0-alpha branches/maven-docs (see also Section 17.3.2, “Documentation setup”).
• Custom jDocbook Core 2.0-alpha repository branches/custom-jdocbook-core (see also Section 17.3.5.1, “Patch
FOP version” and Section 17.3.5.2, “Patch FOP logging”).
• Custom FOP 2.0-alpha repository branches/custom-fop (see also Section 17.3.5.3, “Patch FOP font weight”).
• Maven DocBook 3.0-alpha repository branches/maven-docbook (see also Section 17.3, “jDocBook”).
• Development Production Line manual 3.1-beta as PDF.
• QA Sandbox 1.1-delta repository branches/qa-sandbox (see also Appendix C, Quality Assurance Sandbox)
273
Appendix D.
Figure D.1. The End Of The Line
274