...
- The .classpath checked in with the CAS 3.4.2 and earlier servers was based on an older model where there was just one big "cas3" project and all the subprojects/modules were represented as Build Path Source directories in that one project. If you check out from SVN, there is no way to avoid getting the .classpath file and starting out with this old and now deprecated project design. So you have to manually delete all these source directories and create the separate subdirectory/module projects manually.
- The checked in .classpath file contains a configured Source directory that does not exist. The only way to fix this is to manually delete the entry.
- The Eclipse Maven plugin seems to have a problem with the "enforcer" Maven plugin. This is an optional Maven module that checks to make sure that you are using the right version of Maven and the right level of JDK. Unfortunately, these checks are not helpful and, if you want, you can certainly build and run CAS with a later version of both Maven and the JDK. However, if you leave the "enforcer" plugin configured in the top level POM (in the "cas3" project) it tends to generate Maven build errors that screw up the project generation. So it is a good idea to delete this one entry in the POM before you do anything serious with Maven.
- There are some HTML fragments in the cas-server-webapp directory that will generate error messages after everything builds. Ignore these errors.
...
UnZip or SVN
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). This is certainly adequate for those who are just exploring the CAS source and do not intend to do any development.
...
Eclipse has SVN support and can easily check out the entire "trunk" or any prior version of the code (such as the cas-server-3.4.2 which, at the time this is written, is the latest release). However, when you check out from subversion, Eclipse does not give you the option of omitting the .project and .classpath files if they exist, and before you will be given interactive access to the project it will have used these files to initially configure the project.
UnZip
Presumably you already know where to go to download the current CAS release from www.jasig.org. Unzip the file into a directory on any convenient disk.
Because of the maven-enforcer problem, it is a good idea to open the pom.xml in the directory that you just created and remove the section from <plugin> to </plugin> that defines the maven-enforcer plugin. Save the file.
Now start Eclipse, preferably with an empty workspace file the first time so it is easy to discard everything and start over if something goes wrong. In the empty Project Explorer window, right click and choose Import ... Select Maven - Existing Maven Projects. The top Root Directory box can be filled in by clicking the Browse ... button and navigating to the directory you just created when you unzipped the source.
The dialog will display all the Maven projects that it can find in the uzip directory.
If you want to work with all the optional projects, leave them checked. If you only want Eclipse to generate a subset of the projects, uncheck the ones you don't want. Click Finish.
The Eclipse Maven plugin scans the POM files and creates Eclipse projects that correspond to the parent and each of the optional subproject/modules. Each POM generates a corresponding Eclipse project:
Note that the parent project here is called "cas-server". This is the artifact name configured in the top level parent POM. (In the following discussion where the project is checked out from SVN, this first project will acquire the name "cas3" because that is the name of the original Eclipse project that was plugged into SVN. However, when you unzip the distributed source, there are no Eclipse project files in the zip archive, so the name comes from the Maven project configuration instead of any Eclipse configuration).
Although the projects appear to be in the current Workspace, nothing has actually been moved. The Eclipse "Import" function is an import-in-place and actually creates the projects and the project configuration files in the directory you created when you unzipped the archive. So if you make some changes and then decide to toss everything and start over, you have to delete the unzipped directory as well as the workspace and start over by doing a new unzip.
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...
...
At the bottom of the cas3 project, open the pom.xml file. This brings up the Eclipse Maven plugin POM editor. Select the plugins tab at the bottom
In the CAS 3.4.2 server the first plugin will be the maven-enforcer plugin. Select it and the details of the entry will appear on the right.
Press the Delete button to remove the entry. You want to do this before you import the subproject/modules because if the line is present, it can screw up the import process.
...
Right click in the Project Explorer empty area and from the context menu select Import ... From the dialog choose Maven - Existing Maven Projects
The next panel will
In my experience, when the checked out cas3 project is in the workspace, doing an Import of existing Maven projects automatically primes the Root Directory window with the fully qualified path to the cas3 project directory in the current Eclipse workspace. So if the workspace is named "tempspace" and is in the current user home directory of "gilbert.YALE", the Root Directory will be filled in and the Eclipse Maven plugin will automatically locate and display all the POM projects that the Eclipse Maven plugin found in the cas3 project directoryand all its subdirectories.
You can accept the default and import all of them, or if you are only interested in a subset of the projects this might be a good point to save some time and effort and turn off the checkbox on the projects you do not care to work with. When you are done, each selected Maven project will be turned into a peer project of cas3 in the workspace.
Note that there will be an HTML validation error on the webapp project, but that is inevitable and is not a real issue.
Each generated project is associated with the SVN version number and SVN repository even though it was the original cas3 project that was actually checked out and these secondary projects were "manufactured" from that original checkout.
If you look in the workspace directory, you will only find the cas3 directory and all the files will be under it. Although the other projects appear in Project Explorer to be peers of the cas3 project, physically they are subdirectories of the cas3 directory.