Developing CAS in Eclipse - PowerPoint PPT Presentation

1 / 50
About This Presentation
Title:

Developing CAS in Eclipse

Description:

... that can be compiled to produce a JAR file or zipped up to produce a WAR file ... It can produce a program or a JAR library. ... – PowerPoint PPT presentation

Number of Views:207
Avg rating:3.0/5.0
Slides: 51
Provided by: howardg2
Category:
Tags: cas | ajar | developing | eclipse

less

Transcript and Presenter's Notes

Title: Developing CAS in Eclipse


1
Developing CAS in Eclipse
  • Edit and Debug

2
Maven is Best Practice
  • Compile and Zip WAR file with Maven 2
  • Manage dependencies (external JARs from other
    software libraries or products)
  • Run tests to validate each change cycle
  • Build JAR, WAR, or other standard artifacts
  • Edit with Eclipse
  • Syntax and help for Java and XML
  • Widely used, modularly extensible IDE
  • How about simple testing with Eclipse?

3
Maven Compile
Main POM
Core project source POM
Option project source POM
artifact jar
artifact jar
artifact jar
Option project source POM
artifact jar
Option project source POM
4
Top level Maven POMoptional projects are compiled
ltmodulesgt ltmodulegtcas-server-corelt/modulegt ltmodule
gtcas-server-support-genericlt/modulegt ltmodulegtcas-s
erver-support-jdbclt/modulegt ltmodulegtcas-server-sup
port-ldaplt/modulegt ltmodulegtcas-server-support-open
idlt/modulegt ltmodulegtcas-server-support-radiuslt/mod
ulegt ltmodulegtcas-server-support-spnegolt/modulegt ltm
odulegtcas-server-support-trustedlt/modulegt ltmodulegt
cas-server-support-x509lt/modulegt ltmodulegtcas-serve
r-integration-jbosslt/modulegt ltmodulegtcas-server-we
bapplt/modulegt lt/modulesgt
Options
5
Java Subproject POM
ltartifactIdgtcas-server-support-trustedlt/artifactI
dgt ltpackaginggtjarlt/packaginggt ltdependenciesgt ltde
pendencygt ltgroupIdgtorg.jasig.caslt/groupIdgt
ltartifactIdgtcas-server-corelt/artifactIdgt
ltversiongtproject.versionlt/versiongt
lt/dependencygt ltdependencygt ltgroupIdgtcaslt/grou
pIdgt ltartifactIdgtcasclientlt/artifactI
dgt ltversiongt2.1.1lt/versiongt
lt/dependencygt
Generated result
JAR for Compile
6
Maven build WAR
Main POM
artifact jar
artifact jar
artifact jar
artifact jar
cas.war
webapp HTML POM
WEB-INF/lib
7
cas-server-webapp/pom.xmlcore required, add
option JARs
ltdependencygt ltgroupIdgtorg.jasig.caslt/groupIdgt ltart
ifactIdgtcas-server-corelt/artifactIdgt ltversiongtpr
oject.versionlt/versiongt lt/dependencygt
ltdependencygt ltgroupIdgtorg.jasig.caslt/g
roupIdgt ltartifactIdgtcas-server-support
-trustedlt/artifactIdgt
ltversiongtproject.versionlt/versiongt
lt/dependencygt ltdependencygt
ltgroupIdgtorg.jasig.caslt/groupIdgt
ltartifactIdgtcas-server-support-x509lt/artifactIdgt
ltversiongtproject.versionlt/versiongt
lt/dependencygt
Default is core only
Add optionartifacts you choose
8
Eclipse workspace, CAS projectMaven projects
home/workspace
CAS3xx Eclipse project
Main POM
subproject
subproject
subproject
9
Assume You Know How
  • Install current Java
  • Install Apache Tomcat
  • Install and use Maven 2.0.9

Because this is all part of the standard CAS
development instructions.
10
Fork In the Road
  • Eclipse Web Standard Tools
  • MyEclipse
  • Free
  • Part of Eclipse project
  • Open source
  • New release each June
  • Independent plugins dont work smoothly together
  • 31.75 /year
  • Genuitec.com
  • Includes WST, plus Spring, WS, Hibernate, JPA,
  • A particular group of plugins have been integrated

11
WST Debugging
Eclipse
CAS classes
Servers /conf
Webproject
Tomcat directory
Tomcat process
12
MyEclipse
Eclipse
CAS Project
Java Source
Tomcat, JBoss,
WebContent
/webapps or /deploy
WEB-INF/classes
13
By any other Name
  • A project in Eclipse or Maven is a directory
    with source subdirectories that can be compiled
    to produce a JAR file or zipped up to produce a
    WAR file
  • A Java Project has source to compile. It can
    produce a program or a JAR library.
  • A static Web project is a bunch of HTML, CSS,
    and image files that you can deploy to any Web
    Server. It has no Java.

14
By Any Other Name
  • A dynamic Web application project has a WEB-INF
    subdirectory with a web.xml file
  • A WAR file is a zipped up copy of the dynamic
    Web application, but the unzipped directory is
    also sometimes called a WAR too.
  • A context is the runtime environment created by
    the Web server to run the code in a dynamic Web
    application

15
Ganymede WST
  • Dynamic Web projects can only be created empty. A
    Java SE project cannot be converted into a
    dynamic Web project. The JA-SIG CAS source is an
    ordinary Java SE source project.
  • Create an empty dynamic Web project. Copy the
    cas-server-webapp contents. Configure the CAS
    project as a library module for the Web project
    . Finally, copy external JAR dependencies into
    the WEB-INF/lib.

16
WST Runtime Magic
  • ltContext docBase"casx" path"/casx
    source"org.eclipse.jst.jee.servercasx"/gt
  • Get files from the dynamic Web project dir.
  • Get classes from the CAS compiler output
    directory.
  • No support for Maven dependencies.

17
Create WST project
Eclipse
Library Project(CAS source)
copy from cas-server-webapp projectthe
src/main/webapp files and target/cas-server-webapp
-3.3/WEB-INF/lib jars
new dynamic Web proj
dynamic web project (WAR)
Tomcat /conf
Tomcat directory
Server
18
MyEclipse
  • Good News MyEclipse can add dynamic Web
    application behavior to an existing Java (SE)
    project.
  • Bad News MyEclipse uses the WEB-INF/classes
    directory as a build work area, so the WebContent
    directory cant be in cas-server-webapp
  • Copy cas-server-webapp source to an new
    WebContent directory

19
MyEclipse Deployment
  • Web application is copied to the real external
    tomcat/webapps directory and the real external
    server configuration is started
  • Tomcat runs with normal environment, under with
    Eclipse debugging
  • Any problems can be fixed by standard Tomcat
    documentation and configuration
  • Application can also run under Tomcat without
    Eclipse

20
Download Ganymede EE from www.eclipse.org/downloa
ds
21
Download MyEclipse 7.0 (M2 or later)
22
Common Steps
23
Add update sites
Help Software Updates Available Software
24
Subversion
Windows-onlyNative Java 1.5 HL1.5 HL Win32
binaries
PolarionSubversiveSVN Connectors
EclipseSubversionTeam Provider
Unix or Windows SVNKit 1.2.0
25
SVN Repository Exploring
26
Checkout
  • JA-SIG source repository looks like a tree of
    projects
  • Select the trunk or a tagged release and check
    out as a Java (SE) project

27
Update Dependencies
28
Maven cas-server-core is a projectEclipse
cas-server-core/src/main/java is a src dir
29
Build Path (GUI to .classpath)
30
Build Path (GUI to .classpath)
31
Package Explorer - Libraries
32
WST in Ganymede EE
33
WST New Dynamic Web Project
34
New Dynamic Web Project Wizard
35
(No Transcript)
36
Cut and Paste
  • Copy (cut and paste) the Web application files
    (cas-server-webapp/src/main/webapp/) from the
    CAS source project to the WebContent directory of
    the new dynamic Web project
  • Click OK to replace the generated web.xml file in
    WEB-INF

37
WST Java EE Module Dependencies
38
Get the POM dependencies
  • cd to Workspace, CAS source project directory
  • run mvn install command
  • Refresh the Eclipse view of the project.
  • Go to cas-server-webapp/target/cas-server-webapp-3
    .3/WEB-INF/lib
  • Copy all the external JAR files (exclude the
    cas-server-.jar files) to the WEB-INF/lib of the
    new dynamic Web project

39
Validation
  • WST has validators for HTML, XML, etc.
  • Some CAS source files fail validation (headers,
    footers, etc.)
  • In WST, only option is to disable validation for
    the entire project.

40
MyEclipse
41
Add Web Project Capabilitiesto existing CAS
project
42
MyEclipse Wizard
43
Adding Web capabilities
  • MyEclipse changes the default compiler output
    directory to WebContent/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

44
J2EE 1.4 Libraries
45
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
  • WebContent
  • used by Eclipse (tell SVN to ignore it)
  • reflects your local test Tomcat environment

46
WEB-INF/classes
  • Source directories are compiled and classes are
    stored here
  • Data files (resources) are copied here
  • add cas-server-webapp/src/main/webapp/WEB-INF/cl
    asses as a MyEclipse source directory to get
    .properties files
  • Put JUnit class files someplace else (/test-bin)

47
(No Transcript)
48
Select one or more J2EE App Servers
Exploded deployments are changed on the fly
after save and compile.
49
Application Server Buttons
Run Application Server(Tomcat)
Manuallyredeploy
50
Start the Server
Write a Comment
User Comments (0)
About PowerShow.com