Developing and debugging CAS in Netbeans

REQUIREMENTS - this process was tested using:
------------------------
• maven2 (java project management tool)
• CAS v3.4.10
• Ubuntu 11.04 (Natty)
• Netbeans v7.0.1


MAVEN STEPS:
-------------------

Download CAS from jasig
• http://downloads.jasig.org/cas/cas-server-3.4.10-release.tar.gz
• un-tar the download in to directory cas-server-3.4.10:  
    tar -xzvf cas-server-3.4.10-release.tar.gz  cas-server-3.4.10

Add LDAP dependency to the <your-maven-path>/cas-server-webapp/pom.xml file [optional]:
• https://wiki.jasig.org/display/CASUM/LDAP

        <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>cas-server-support-ldap</artifactId>
             <version>${project.version}</version>
        </dependency>

Add Trusted dependency to the <your-maven-path>/cas-server-webapp/pom.xml file [optional]:
• https://wiki.jasig.org/display/CASUM/Trusted
    <dependency>
         <groupId>${project.groupId}</groupId>
         <artifactId>cas-server-support-trusted</artifactId>
         <version>${project.version}</version>
    </dependency>

Add Client dependency to the <your-maven-path>/cas-server-webapp/pom.xml file [optional]:
• https://wiki.jasig.org/display/CASC/Obtaining+from+Maven2+Repository
        <dependency>
           <groupId>org.jasig.cas.client</groupId>
           <artifactId>cas-client-core</artifactId>
           <version>3.1.11</version>
           <scope>runtime</scope>
           <type>jar</type>
        </dependency>

Do Maven build:
• mvn package install
• mvn source:jar (this jars up the source code of each package for debugging within an IDE)

Test the generated .war file (sanity check):
• <your-maven-path>/cas-server-webapp/target/cas.war
• Deploy on Tomcat
• This should work: login using  [any-name]/[any-name]  default credentials


NETBEANS IDE:
-------------------------

Create a new Java Web project within your IDE.

Create a symlink to the maven build to replace the generated Netbeans 'web' directory:
• The ../cas-server-webapp/target/cas-server-webapp-3.4.10/ directory contains the files needed to build a tomcat webapp project. (ie. WEB-INF, index.jsp, etc.)
• within the new project file, rename the generated 'web' directory to 'web-old'
• create a symlink from 'web'  to the maven build target: ie. ln -s <your-maven-path>/cas-server-3.4.10/cas-server-webapp/target/cas-server-webapp-3.4.10 <your-netbeans-path>/web

Create a symlink from the Netbeans src directory to the Maven project source code:
• cd <your-netbeans-path>/src
• rename "java" directory to "java-old"
• ln -s <your-maven-path>/cas-server-webapp/src/main/java   java
• your Netbeans "Source Packages" should now include two source packages:
∘ org.jasig.cas.util
∘ org.jasig.cas.web.flow

Add the required CAS jar files and Spring configuration XML files to your IDE project library:
• Edit the Netbeans project properties to add all the jar files in WEB-INF/lib to the project Libraries path.
• Edit the Netbeans project properties to add all the Spring configuration files to the "Spring Framework" properties

Build and run your Netbeans project:
• you may get permissions error on "cas.log" and perfStats.log", which you can ignore for the moment
• login to CAS using the default [any-name] / [any-name] credentials