Thursday, June 6, 2013

JDK as ZIP

Oracel do not provide JDK as zip, unfortunately.
However, you can:
  • Create working JDK directory ("C:\JDK" in this case)
  • Download latest version of JDK from oracle (for example "jdk-7u7-windows-i586.exe")
  • Download and install 7-zip or download 7-zip portable version if you are not administrator
  • With 7-zip extract all the files from "jdk-7u7-windows-i586.exe" in directory "C:\JDK"
  • In command shell (cmd.exe) do the following:
    • change directory to directory C:\JDK.rsrc\JAVA_CAB10
    • execute command: extrac32 111
  • Unpack C:\JDK\.rsrc\JAVA_CAB10\tools.zip with 7-zip
  • In command shell (cmd.exe) do the following:
    • change directory to C:\JDK.rsrc\JAVA_CAB10\tools\
    • execute command: for /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar" (this will convert all pack files into jar)
  • Copy whole directory and all subdir of c:\JDK.rsrc\JAVA_CAB10\tools" where you want your JDK to be and setup manually JAVA_HOME and PATH to point to your JDK dir and its BIN subdir.
Thats all. After this you'll be able at least to use javac.exe

Reference: http://stackoverflow.com/questions/1619662/where-can-i-get-the-latest-jre-jdk-as-a-zip-file-i-mean-no-exe-installer

Sunday, June 2, 2013

Maven ( POM ) Best Practices


  • Make the build reproducible
    • Always specify a version for Maven2 plugins
    • Minimize number of SNASPHOT dependencies
    • Use dependency management section
    • Beware of relocation in maven repo
    • After a dependency modification, double check the produced artifacts
  • Use and abuse of modules
    • more “technical/layered”
    • more business oriented
  • Make the build maintainable
    • Prefer default directory layout
    • Avoid duplication by moving common tags to parent pom
    • Always specify a version of dependencies in a parent pom
    • Use Properties Liberally
    • Minimize the number of Profiles
  • Make the build portable
    • Don’t commit eclipse and maven artifacts
    • Don't modify pom/artifactsin your "enterprise" repository

Additionally:
  • Make use of maven-resources-plugin. E.g. As below in pom.
<plugin>
<!-- http://maven.apache.org/plugins/maven-resources-plugin/ -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<delimiters>
<delimiter>@*@</delimiter>
</delimiters>
<useDefaultDelimiters>false</useDefaultDelimiters>
<nonFilteredFileExtensions> 
<nonFilteredFileExtension>xls</nonFilteredFileExtension> 
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension> <nonFilteredFileExtension>pdf</nonFilteredFileExtension> 
</nonFilteredFileExtensions>
</configuration>
</plugin>