Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— 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 Recommended Cheap 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 as https://www.ja- sig.org/svn/ https://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 cas-server-core cas-server-support-generic cas-server-support-jdbc cas-server-support-ldap cas-server-support-openid cas-server-support-radius cas-server-support-spnego cas-server-support-trusted cas-server-support-x509 cas-server-integration-jboss cas-server-webapp

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

12 .classpath file … …

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

14 cas-server-support-trusted/pom.xml cas-server-support-trusted jar org.jasig.cas cas-server-core ${project.version} cas casclient Jar (in M2_REPO) added to classpath for compile

15 cas-server-webapp/pom.xml org.jasig.cas cas-server-core ${project.version} org.jasig.cas cas-server-support-trusted ${project.version} org.jasig.cas cas-server-support-x509 ${project.version} Default is core only Add option artifacts you choose

16 Download Libraries “cd” to Workspace, project directory run “mvn compile” and/or “mvn install” 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 jar Directory of C:\Users\gilbert.YALE\.m2\repository\org\acegisecurity\acegi-security\ /20/ :24 PM 5,028 acegi-security pom 12/20/ :24 PM 40 acegi-security 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 project Alternate: use another version (1.0.4) you have

18 .m2/repository

19 Build Path – define M2_REPO

20 Maven 2 Build Master POM core POM repository jars compile classpath core jar option POMs webapp POM compile dependencies more jars src jsp, html, web.xml WEB-INF/lib cas.war

21 Simple IDE Build Build Path libraries core src option src WebRoot Compile Preloaded jsp and xml pages webapp proj WEB-INF/classes.property files WEB-INF/lib WEB-INF/classes Build Path Source Dirs Deploy to Tomcat JBoss Glassfish Geronimo …

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

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

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

34

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

36 Application Server Buttons Manually redeploy Run Application Server (Tomcat)

37 Start the Server


Download ppt "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."

Similar presentations


Ads by Google