...
Now return to the J2EE perspective, right click the new project directory, and choose Import - Maven - Existing Maven Projects. The Eclipse support for Maven will search the directory for its POM and then find POM files in the subdirectories.It will then display a list of the subdirectories that contain Maven projects listed in the parent POM. Select the checkbox for all of them and push the OK button. Next button. The next panel displays the status of Maven plugins and Eclipse support. Ignore the errors (to be Resolved Later) and press Finish. Ignore the popup box that warns you that the project will have build errors. This simply means that Eclipse itself cannot do the complete build and you will have to run Maven under Eclipse to create a fully functional CAS server.
At this point Eclipse will do a lot of work. It is running through all the POM files understanding what they say and is downloading from the internet into the local Maven repository all the JAR files that any of the CAS projects identify as a dependency. It creates in the Eclipse workspace a "shadow project" for each subdirectory project. This shadow is an Eclipse project with .project, .classpath, and .settings files and folders with the correct options and settings to compile Java source for the corresponding JAR or WAR that the Maven POM is going to build.
There are several types of error messages generated. Some JSP and HTML files are fragments that are not regarded as well formed, but that is because CAS will assemble a page from several fragment pieces which only become well formed when they are completely assembled. There will also be a Maven error because the Eclipse support for Maven (really the Eclipse interactive simulation of Maven batch function) does not simulate the Aspectj maven plugin. This is not a real problem because we will not be using Eclipse simulation to run CAS under JBoss, but will instead run a full Maven batch command where all the standard Maven plugins are available to build real JAR and WAR files. So ignore the errors or click OK.
When Eclipse is done with the import, it will have created shadow project directories named cas-server-core, cas-server-documentation, and so on. There is now a discrepancy between the Eclipse view of the workspace and the reality you would see if you opened the workspace directory using the operating system file explorer. From the Eclipse project view, each new project appears to have the Java source files and resource data files for that project. However, Eclipse also shows what appears to be a second copy of the same files in the various src/main subdirectories of each project subdirectory of the parent "cas-server" project. These are two views of the same files, and really the only copy of the real file is in the subdirectory of cas-server. The Java view of packages and source files in the shadow directories such as "cas-server-support-ldap" are a logical view of what Eclipse found in the project POM. This means that if you do certain global operations like Search - File you may find the same file returned twice by the matching process, once in its physical location under cas-server and once in its logical project location under one of the shadow projects. You can edit the file in either parent "folder" and any changes you make apply to both views because there is really only one filean Eclipse project with Eclipse compile options and an Eclipse "Build Path" that as closely as possible matches everything in the POM file.
At the end there should be several types of error messages that don't really matter:
- JSP, HTML, XML, XHTML, and JavaScript files may report errors because Eclipse is trying to validate syntax without having everything it needs to do the validation properly, or because some files are fragmentary and have to be assembled from pieces before they are well formed.
- You can get Build Path error if you only have a JDK 1.7 or later installed on your machine, because the Maven template used to translate POM files automatically defaults to 1.6 or earlier. CAS should run fine on later versions of Java, or you can manually change each generated project to use 1.7 as the compiler level.
- There will be a Maven problem reported because CAS uses the Maven Aspectj plugin during its build, but the Eclipse simulation of Maven does not support that particular function. You can ignore this message because a real Maven build will be run to create the real artifacts.
Generally, there should only be Warning level Java messages.
Before the import, there was only the "cas-server" project (and the installer). The import creates an Eclipse "shadow project" (my name) for every subdirectory under cas-server that is needed. These shadow projects are Eclipse entities built from the Maven POM files. They contain Eclipse configuration and option elements (what Eclipse thinks of as the project and Build Path). What these shadow projects don't have are real source files. They contain configuration pointers the real source files in the subdirectories of the cas-server project. As you open and look at these projects, they will appear to have source. However, this source will be structured as Java Packages and Java Classes and Java Resources. This is a logical representation in Java and WAR terms of the actual source files that remain as subdirectories of the cas-source directory.
In a few cases, such as the Search option on the menu, you may look for files with certain text or attributes and the results of the search will display the same file twice, once as a physical text file in the cas-server directory tree and once as a Java Class source in the corresponding Eclipse project. Just realize that these are two different views of the same file, and changes you make to either view are also changes to the other view.
Interactive and Batch Modes
...