Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 4 Next »

If you are just installing CAS "as is" it is not necessary to create the source development projects. Simple configuration can be performed using the WAR Overlay mechanism. You create an Eclipse Project to generate a WAR artifact (give it your own group, name, and version), and you make it dependent on the specific JA-SIG CAS WAR artifact. Then you populate the project with any configuration files that have local customizations. When Maven runs, it reads in the JA-SIG WAR file, keeps any files that are not overridden, replaces any files with versions you provided in your project, and then writes out the WAR containing your customizations.

However, if you want to work with the CAS 3 source, then you want to check out that source from the JA-SIG SVN repository and create the Eclipse projects that will allow development. Unfortunately, this never works as expected. There is always something wrong. Sometimes it is an error in the JA-SIG files, and sometimes it is a difference between the way that Eclipse and Maven used to work and the way they work today.

If you were hoping for a list of 20 steps that you can apply without thinking, it won't do you any good. Fortunately, the Maven plugin is perfectly able to rebuild the projects correctly starting from the bare POM, so often the only thing you have to do is scrap an existing incorrect Eclipse project configuration and have a new one rebuilt.

The End Result

The first step is to describe the target result. Then a sequence of "repair" steps will demonstrate how to clear errors and rebuild the projects to achieve this desired end result.

When you start Eclipse, you choose a Workspace directory. The default is the directory {user-home}/workspace but you can choose another name in the startup dialog or, if you have already set some workspace directory to be the default used every time, you can choose an alternative with the File - Choose Workspace menu option. The following process involves some trial and error, so it may be a good idea to start will a new empty test workspace that you can discard and start over.

The CAS 3 source is available from the www.jasig.org Web site as a downloadable zip file. The easiest approach is to expand this zip file in a directory, delete any .project and .classpath files contained in it, and then use this directory as the source of an Eclipse Import (of a directory filled with Maven projects).

CAS 3 can also be checked out from the Subversion repository. This gives you access to the current unreleased code ("trunk") and provides developers with the ability to track bug fixes that others have checked in and (for authorized developers) to commit changes. Eclipse can only synchronize with SVN if it checked the source out of the SVN repository before you made any changes.

So the first step will be to create a single "cas3" project directory containing all the CAS 3 source. This directory can be the unzipped download from JA-SIG or it can be checked out from SVN. If this is done right, however, this project will just be a container for everything else. From the Eclipse point of view, it isn't even important that this be regarded as a Java project. It will have no source files, it needs no classpath, and Eclipse will not "build" it. From the Maven point of view, this is a parent project containing a POM that references subproject modules.

Each module subdirectory is a Maven project in its own right and current best practice is to create a corresponding Eclipse project. Eclipse will do this automatically if you use the "File - Import ... - Maven - Existing Maven Projects" sequence from the menus. If the CAS3 project is open, Eclipse will discover the POM files in each of the subdirectories and list each subdirectory as an Eclipse project that it is prepared to generate. Although the Eclipse Project Explorer will list each of these projects as a peer (at the same level) as the cas3 project, they are actually subdirectories inside the cas3 directory.

If you get this structure right (one big "cas3" directory/project containing all the source files but regarded by Eclipse as having no Java source directories to compile, then one project per subdirectory that compiles and builds the source for that one module) then the Eclipse Maven plugin is prepared to get the rest of the Eclipse project configuration right (or close to right) if you take steps to clean up the residue of any misconfiguration left behind by the original JA-SIG files.

Check Out

Display the SVN Repository Exploiring Perspective (Window - Open Perspective - Other - SVN Repository Exploring). If the JA-SIG repository has not already been added, right lick in the SVN Repositories view and choose New ... Repository Location. The URL is https:source.jasign.org and that becomes the name of the Repository. Expand this repository as a tree, expand "cas3". Now decide if you want to work on the unreleased next version of the server ("trunk") or one of the numbered previous releases ("tags"). Expanding "trunk" or one of the "tags" should show a pom.xml file and subdirectories including "cas-server-core". Choose the directory ("trunk" or "cas-server-3.4.2") right click, and choose Check Out...

Unfortunately, the "cas-server-3.4.2" and earlier releases (but not the "trunk" or later releases) of the CAS server have checked in .project and .classpath files that do not reflect current Eclipse Maven practices. However, there is no option in Eclipse to check out everything except these two files, and when Eclipse checks out a directory containing a .project file it processes it before you can stop it. So the first step after checkout is to undo the incorrect structure they create.

  • No labels