1 / 37

Developing in CAS

Developing in CAS. Why?. As distributed you edit CAS 3 with Eclipse and build with Maven 2 Best Practice for Release Engineering Difficult edit-debug cycle Extend “edit” to include a separate debug deploy under Eclipse (without the 10 minute Maven 2 build) Understand the development cycle.

calix
Download Presentation

Developing in CAS

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Developing in CAS

  2. Why? • As distributed you edit CAS 3 with Eclipse and build with Maven 2 • Best Practice for Release Engineering • Difficult edit-debug cycle • Extend “edit” to include a separate debug deploy under Eclipse (without the 10 minute Maven 2 build) • Understand the development cycle

  3. You are going to need … • A Java (5 or 6) from Sun • An Eclipse (3.3) from eclipse.org • A subversion plugin for Eclipse to checkout the project from ja-sig • Subversive is becoming part of Eclipse, but parts are still at polarion.org • Now you could check out CAS3

  4. Highly RecommendedCheap but not Free • MyEclipse IDE plugin from genuitec • Commercial J2EE development tool built on top of Eclipse • Free trial, then $31.75 a year

  5. Sanity • Download Tomcat 6 from Apache

  6. Developing CAS - Prepare • Get Maven 2 from apache.org • Unzip and move mvn (.bat or shell script) to Path • Define JAVA_HOME and M2_HOME environment variables

  7. Developing CAS - Checkout • Eclipse SVN perspective • Define SVN source ashttps://www.ja-sig.org/svn/ • Check out the trunk or a tagged release as a Java project • Ignore library errors • Close Eclipse

  8. This is the top level Maven POM <modules> <module>cas-server-core</module> <module>cas-server-support-generic</module> <module>cas-server-support-jdbc</module> <module>cas-server-support-ldap</module> <module>cas-server-support-openid</module> <module>cas-server-support-radius</module> <module>cas-server-support-spnego</module> <module>cas-server-support-trusted</module> <module>cas-server-support-x509</module> <module>cas-server-integration-jboss</module> <module>cas-server-webapp</module> </modules>

  9. Maven: cas-server-core is a “project”Eclipse: cas-server-core/src/main/java is a “src dir”

  10. Build Path (GUI to .classpath)

  11. Build Path (GUI to .classpath)

  12. .classpath file <?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" path="cas-server-core/src/main/java"/> <classpathentry kind="src" path="cas-server-support-openid/src/main/java"/> <classpathentry kind="src" output="test-bin" path="cas-server-core/src/test/java"/> … <classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.5/spring-2.5.jar"/> <classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/2.5/spring-test-2.5.jar"/> … <classpathentry kind="output" path="bin"/> </classpath>

  13. Package Explorer - Libraries Libraries in the JRE Libraries from the project’s Build Path

  14. cas-server-support-trusted/pom.xml <artifactId>cas-server-support-trusted</artifactId> <packaging>jar</packaging> <dependencies> <dependency> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>cas</groupId> <artifactId>casclient</artifactId> <version>2.1.1</version> </dependency> Jar (in M2_REPO) added to classpath for compile

  15. cas-server-webapp/pom.xml <dependency> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-core</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-support-trusted</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-support-x509</artifactId> <version>${project.version}</version> </dependency> Default is core only Add optionartifacts you choose

  16. Download Libraries • “cd” to Workspace, project directory • run “mvn compile” and/or“mvninstall” command • Dependency jar files are downloaded to .m2/respository in your home directory

  17. mvn problems(maybe synch with .classpath) Project 'castrunk' is missing required library: 'C:\Users\...\.m2\repository\org\acegisecurity\acegi-security\1.0.5\acegi-security-1.0.5.jar Directory of C:\Users\gilbert.YALE\.m2\repository\org\acegisecurity\acegi-security\1.0.5 12/20/2007 02:24 PM 5,028 acegi-security-1.0.5.pom 12/20/2007 02:24 PM 40 acegi-security-1.0.5.pom.sha1 Google for the project Download it manually and unzip it Copy the jar file to the .m2/repository directory Close, open, and refresh the CAS projectAlternate: use another version (1.0.4) you have

  18. .m2/repository

  19. Build Path – define M2_REPO

  20. Maven 2 Build MasterPOM compile classpath repository jars corePOM src core jar compile dependencies optionPOMs src more jars jsp, html, web.xml webappPOM WEB-INF/lib cas.war

  21. Simple IDE Build Build Path Source Dirs Build Path libraries core src option src Compile WebRoot webappprojWEB-INF/classes.property files Preloaded jsp and xml pages Deploy toTomcatJBossGlassfishGeronimo … WEB-INF/libWEB-INF/classes

  22. Possible IDE Build Core project .classpath src /bin compile Option depends on Core Option project .classpath src /bin compile /bin from each“depends on”project Web project jsp and xml files .classpath /classes /lib

  23. MyEclipse • Download and install MyEclipse • Point it to the Eclipse 3.3 previously installed • If you have just been reading along up to this point, you can install the “All-in-one” version with Java, Eclipse, and MyEclipse bundled together

  24. cas-server-webapp - WebRoot • Maven uses cas-server-webapp project as a read-only source of HTML/JSP used to create the WAR • MyEclipse uses WebRoot directory as a working template for the WAR file and compiles source and copies resources to its WEB-INF/classes • Copy the HTML, XML, JSP files from cas-server-webapp to WebRoot • Define the cas-server-webapp WEB-INF/classes directory as a “source” (for .properties resources)

  25. MyEclipse Web Project

  26. MyEclipse Web Project

  27. Adding Web capabilities • MyEclipse changes the default compiler output directory to WebRoot/WEB-INF/classes • MyEclipse adds its editors and syntax filters to the project • MyEclipse adds the J2EE (1.4 or 5) package of libraries to the compiler classpath • There are now HTML and XML files with “errors”. [Right click the directories, select MyEclipse, Exclude from Validation]

  28. J2EE 1.4 Libraries

  29. Sanity Check • cas-server-webapp • will be used as the source for Maven • should reflect your production environment (probably on another host) • is associated through SVN to the ja-sig source • WebRoot • used by Eclipse (tell SVN to ignore it) • reflects your local test Tomcat environment

  30. WEB-INF/classes • Java files in a source directory are compiled and the class files are put in the output dir • Other files (“resources”) are copied to the output dir • For a Web Project, the output directory should be WebRoot/WEB-INF/classes • Put JUnit class files someplace else (/test-bin)

  31. Indirect Dependencies • JAR files that are needed to run CAS but are not needed to compile it • Frequently, classes referenced in the Spring configuration XML as beans • Dependencies listed in the cas-server-webapp POM (quartz, ehcache, ognl, acegi-security, …) • run “mvn install” in the project directory • Add them to the Build Path Libraries

  32. Right Click a Source Dir

  33. Select one or more J2EE App Servers Exploded deployments are changed “on the fly” after save and compile.

  34. Application Server Buttons Run Application Server(Tomcat) Manuallyredeploy

  35. Start the Server

More Related