Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The cas-server project is a Maven "parent" project with subprojects to build JARs and WARs in subdirectories. Although CAS is written in Java, it is the subprojects/subdirectories of cas-server that are Java projects. The parent directory just has a Maven pom. So do not use the Check Out As wizard or assume that you need to tell Eclipse what type of project it is. Just do a simple Check Out of a bunch of files into a project directory, and after that we tell Eclipse that it is ... wizard normally assumes you are checking out a single project with a single result, so it will no configure this project properly on its own. Just check it out as a directory with no particular type, or you can try to configure it as a Maven project.

Return to the J2EE perspective, right click the new cas-server project directory, and choose Import - Maven - Existing Maven Projects. The This is the point where the M2E 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. All the projects should be checked, then click the Next button. The next panel displays the status of Maven plugins and Eclipse support.At this point, if the M2E-AspectJ support has not been installed in Eclipse you will get error messages that Eclipse does not know how to emulate the Maven AspectJ plugin support. There are Eclipse plugins and Maven plugins. M2E is a package of Eclipse plugins that attempts, more or less, to duplicate all the important functions of the most frequently used Maven plugins. However, it does not require much effort to use a Maven option that Eclipse does not know how to emulate. This does not matter to CAS development because we are going to use real Maven processing to build the CAS executable. However, it is useful for Eclipse to do as much Maven processing as it can so that the source files display without error markers and you can use all the Eclipse tools. Lack of AspectJ support in Eclipse does not affect CAS development, but you will get some error messages warning you that Eclipse has notice a Maven feature it cannot emulate and you have to ignore them. Click OK to ignore the AspectJ "build error" messagesdiscovers the parent and subdirectory structure. It reads through the parent POM to find the "modules", then scans the subdirectories for POM files that configure the subprojects. Then it presents a new dialog listing the projects it has found. Generally it has already found and configured the parent project, so only the subprojects will be checked.

If you are working on a CAS release that has already been configured, you will only see the subprojects that some previous Yale programmer decided were of interest at Yale. If you are working on a new release of CAS with a vanilla POM you may see a list of all the projects, and this may be a good time to deselect the CAS optional projects that Yale does not use.

Now sit back while the M2E logic tries to scan the POMs of all the subprojects and downloads the dependency JAR files from the internet. If you get a missing dependency for a Yale JAR file, then the $HOME/.m2/settings.xml file does not point to the Artifactory server where Yale stores its JAR files. You can ignore error messages about XML file syntax errors. In the Luna version of Eclipse, the M2E support discovers that CAS uses AspectJ and offers to install support for AspectJ in Eclipse. When you are done, there may still be a few error messages but they should not be important.

A Maven project has standard source directories (src/main/java) used to build the output JAR or WAR artifact. A Maven POM has "dependency" declarations it uses to download JAR files (to your local Maven repository) and build a "classpath" used to find referenced classes at compile time. Eclipse has a "Build Path"  (physically the .classpath file) that defines source directories, the location where the ouput class files are stored, and the libraries that have to be used to compile the source. M2E runs through the POM files in each subproject and creates a Eclipse project with a Eclipse Build Path that tells Eclipse to do exactly the same thing Maven would do to the same project. Eclipse will compile the same source in the same source directory and produce the same output to the same output directory using the same JAR libraries to run the compiler. It is important (because it answers questions later on) that you understand that Eclipse is being configured to do MOSTLY the same thing that Maven would do, but Eclipse does it without running Maven itself. The MOSTLY qualification is that M2E sets default values for the enormous number of options that an Eclipse project has (what error message to display or hide, syntax coloring, everything else you can set if you right click the project and choose Preferences from the menu). After M2E creates an initial default batch of project setting, you are free to change them and ask Eclipse to do things slightly different without breaking the development process.

...