Tuesday, June 29, 2010

Adding a pre-comit hook to simulate "global ignores" at visual svn server

This one is one of the few (but kinda big) problems we are having with Subversion:  The inability to set global, server side ignores.  Unless all developers remember to add the usual java *.class, classes etc (or .dll, .exe, .suo, etc for .net) from their SVN client,  then you end up with all kinds of unwanted files in your svn repository. 

So here's the setup:  Visual SVN Server on Windows Server 2003, development using jdeveloper 10.1.2 (our customers are yet to upgade their OAS) on Windows 7 and Tortoise SVN clients.
And here's what we did:
Step 1:
We entered all ignored file extensions and file names in a file called ignoreFiles.txt, and all ignored folders in file ignoreFolders.txt.  The entries are one per line.

Step 2:
Developed a vb script that opens these 2 files and compares them agains all added files and folders in the current svn transation.  The vbscript is here

Step 3:
Access your SVN Server, right click on the repository name, and choose Propetrties.  From the properties page, choose "Hooks", then Pre-commit hook, edit and copy/paste the following pre comit trigger.
Then click OK, and you are done.  To test this, SVN-Checkout a test directory, create a couple of "illegal" files and folders and then try to commit.  You should get an error message.

Monday, June 28, 2010

How to run the latest ANT with jdeveloper 10.1.2.3

  1. Download latest ANT from ant.apache.org web site and unzip it in directory \jdev\lib\apache-ant--bin.

    So if your jdev dir is at C:\jdev10.1.2.3\jdev\lib, then and you downloaded ant 1.8.1, then you will have c:\jdev10.1.2.3\jdev\lib\apache-ant-1.8.1-bin
  2. Edit \jdev\bin\jdev.conf and comment line that loads ant.jar and load the new ant jar you downloaded. Example below:
    #AddJavaLibFile ../lib/ant.jar
    AddJavaLibFile ../lib/apache-ant-1.8.1-bin/lib/ant.jar
    
  3. Open file \jdev\lib\libraries.xml and change library "Apache Ant" to include jars in the new ant jar you downloaded. Example below:
    <item class="oracle.jdeveloper.library.JLibrary">
    <defaultlibrarydefinition>
    <jdkversion>
    <classpath>
    <entries>
    <item jar-entry="" path="apache-ant-1.8.1-bin\lib\ant.jar"/>
    <item jar-entry="" path="apache-ant-1.8.1-bin\lib\ant-launcher.jar/">
    <item jar-entry="" path="apache-ant-1.8.1-bin\lib\ant-commons-net.jar/">
    <item jar-entry="" path="apache-ant-1.8.1-bin\lib\ant-jsch.jar/">
    <item jar-entry="" path="apache-ant-1.8.1-bin\lib\com.jcraft.jsch_0.1.31.jar"/>
    </entries>
    </classpath>
    <docpath>
    <entries class="[Ljava.net.URL;">
    </docpath>
    <locked>false</locked>
    <sourcepath>
    <entries class="[Ljava.net.URL;">
    </sourcepath>
    </defaultlibrarydefinition>
    <definitionlist class="java.util.ArrayList">
    <locked>true</locked>
    <name>Apache Ant</name>
    </item>
    

Changing the java version on an OC4J instance

We are working with Oracle Application Server 10.1.2, which ships with java 1.4. This is getting a little old and outdated. The customer does not plan on updating any time soon (if it ain't broke don't fix it) .  The developers of my team want to write java 1.6 ! So how do you change the java version that runs an OC4J instance? Here's the scoop:
  1. Install the latest jdk or jre on your Oracle Application Server machine.
  2. Access the OAS web based Application Server Control and click on the OC4J instance you want to change.
  3. Click on Server Properties and scroll down to "Command Line Options'" and enter in the "Java Executable" field the path to the java installation.
  4. Open the application.xml file under the config directory of your OC4J instance (use vi if on UNIX, notepad if on windows) and add the library directory of the new java jdk/jre instalation under the libary path entries:

    Example:
    <library path="/usr/java/jre1.6.0_16/lib">
     
That should be it. Your application now runs under the java executable you specified at step#3