Help is available by sending an email to csf-support@mit.edu
Have any suggestion on how improve this wiki?  Please give us your feedback at csf-support@mit.edu

Quick Links to:

The SVN repository for the jar template has moved to svn+ssh://svn.mit.edu/es-common-services-framework/es-project-template/jar-template/trunk.
Please note that the dialog screen shots in Section 1-3, 1-5, 1-7 and 1-13 shows the old SVN location of the war-template.

OVERVIEW

This document contain the instruction on how to install and configure your project's WAR component using the war-template.  The screen shots are taken from the Eclipse Java EE IDE for Web Developers - Version: Indigo Service Release 2 IDE.  If you are using a different version of Eclipse Java EE or a different variant of Eclipse, the screen shots may differ.  It is important to keep in mind that the following instructions should be viewed as to what has to be done rather than how to do it.

There are 3 sections to this document.  These sections are:

${renderedContent}
  • Section 1:
    This section deals with creating a Maven war project using the war-template.  You should notice that in this section:
    1. Items 1 - 8 deal with checking out and disconnecting the war template from the SVN repository.
    2. Items 9 - 12 deal with cleanup, renaming the war template and converting the project to a Maven project..
    3. Items 13 - 20 deal with checking in the renamed project into a new SVN repository specifically for your project.
  • Section 2:
    This section deals editing various project files and is very straight forward.
  • Section 3:
    This section deals editing the project's pom.xml.
  • Section 4:
    This section deals with changes that have been made to the WAR template that are not reflected in the documentation.

It should take you approximately 10 - 20 minutes to get your war component created and customized.

Section 1: Creating the project war component using the war-template

  1. Run Eclipse.  Go to File > New > Other....
    Scroll down to SVN and expand then select Project from SVN as shown in the following panel.

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  2. From the Checkout Project from SVN repository panel, select Create a new repository location as shown in the following panel.

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  3. In the Enter Repository Location Information panel do the following:
    for the URL:field enter:

        svn+ssh://svn.mit.edu/es-common-services-framework/es-project-template/war-template/trunk
    

    For the Label, select: use the repository URL as the label
    For the Authentication, enter your User name and password.

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  4. The Repository Location Properties panel is a warning panel.

    ${renderedContent}

    You do not want to normalize the URL!
    click No.

  5. In the Select Resourcepanel, select

        svn+ssh://svn.mit.edu/es-common-services-framework/es-project-template/war-template/trunk
    

    as shown in the following panel:

    ${renderedContent}

    When satisfied that everything is correct, click Finish.

  6. In the Check Out As panel, select Check out as a project with the name specified: as shown in the following panel.

    ${renderedContent}

    When satisfied that everything is correct, click Finish.

  7. Your Eclipse - Project Explorer View should now look similar to the following:

    ${renderedContent}
  8. Right click on the war-template project and select Team > Disconnect
    When the following Confirm Disconnect from SVN panel is displayed, select Also delete the SVN meta-information from the file system.

    ${renderedContent}

    When satisfied that everything is correct, click Yes.

  9. Open the Eclipse Project Explorer View.  The view should look as follows:

    ${renderedContent}

    Right click on the war-template project and select Rename....
    Replace war-template with the short project acronym that you have previously selected.  If you have not selected a short project acronym, please go to Selecting names for your project before continuing.

    ${renderedContent}


    For example: If my short project acronym was att, then my panel would look like the following:

    ${renderedContent}

    When satisfied that everything is correct, click OK.

  10. The Eclipse - Project Explorer View should look similar to the following:

    ${renderedContent}
  11. Right click on the renamed project and select Configure > Convert to Maven Project
    Expand your project and it should look similar to the following:

    ${renderedContent}
  12. Right click on the renamed project and select Team > Share Project...
    Select SVN as shown below:

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  13. Select Create a new repository location as shown below:

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  14. Enter a desired SVN URL for your project.
    The SVN repository that you should use is svn+ssh://svn.mit.edu/es-projects/ followed by the SVN project identifier that you had previously selected.  If you have not selected a SVN project identifier, please go to Selecting names for your project before continuing.
    For example:

    ${renderedContent}
    ${renderedContent}

    Don't forget to enter your User name and Password,
    When satisfied that everything is correct, click Next.

  15. When the following panel is display notifying you that a new SVN entry will be created:

    ${renderedContent}

    When satisfied that everything is correct, click OK.

  16. Do the following:

    ${renderedContent}

    The panel should be as illustrated in the following panel:

    ${renderedContent}

    When satisfied that everything is correct, click Next.

  17. Nothing to do here.  This is an information panel similar to the following panel:

    ${renderedContent}

    When satisfied that everything is correct, click Finish.

  18. When a panel similar to the one below is display, enter a comment.
    This is the initial SVN check-in (svn commit) for the WAR project:

    ${renderedContent}

    When satisfied that everything is correct, click OK.

  19. When the SVN commit has completed, the Eclipse - Project Explorer View should look similar to the following.

    ${renderedContent}

Creating the project war component using the war-template is now complete.

Section 2: Customizing the project WAR

${renderedContent}
  1. Run Eclipse.  From the Project Explorer View, open the Maven WAR project that you want to customize.
    Your Project Explorer View should look similar to the following:

    ${renderedContent}
  2. Expand your project, then expand src/main/resources.
    Your Project Explorer View should look similar to the following:

    ${renderedContent}
  3. Open the applicationContext-projectName-config.xml for editing and change the following lines substituting your short project acronym for projectName.
    There are 6 occurances of projectNamethat have to be changed.

    <value>file:${user.dir}/projectName/projectName.properties</value>
    <value>file:${user.home}/projectName.properties</value>
    <value>file:${user.dir}/projectName/projectName.properties</value>
    <value>file:${user.home}/projectName.properties</value>
    

    When you have made all the changes, the lines you have changed should look similar to the following:

    <value>file:${user.dir}/att/att.properties</value>
    <value>file:${user.home}/att.properties</value>
    <value>file:${user.dir}/att/att.properties</value>
    <value>file:${user.home}/att.properties</value>
    

    In the above example, my short project acronym was att so I replaced projectName with att and ProjectName with Att.
    When you are satisifed with the changes, save and close the file.

  4. Open the log4j.xml for editing and change the following lines substituting your short project acronym for projectName.

    • For Tomcat 7 implementations:
      There are 4 occurances of projectNamethat have to be changed.

      <param name="File" value="${logs.dir}/projectName/projectName.log" />
      <param name="File" value="${logs.dir}/projectName/hbn-projectName.log" />
      

      When you have made all the changes, the lines you have changed should look similar to the following:

      <param name="File" value="${logs.dir}/att/att.log" />
      <param name="File" value="${logs.dir}/att/hbn-att.log" />
      

      In the above example, my short project acronym was att so I replaced projectName with att and ProjectName with Att.

    • For OC4J implementations:
      Replace ${logs.dir}/projectName with log and the 2 remaining occurances of projectNamehave to be changed.

      <param name="File" value="${logs.dir}/projectName/projectName.log" />
      <param name="File" value="${logs.dir}/projectName/hbn-projectName.log" />
      

      When you have made all the changes, the lines you have changed should look similar to the following:

      <param name="File" value="log/att.log" />
      <param name="File" value="log/hbn-att.log" />
      

      In the above example, my short project acronym was att so I replaced projectName with att and ProjectName with Att.

      When you are satisifed with the changes, save and close the file.

  5. Open the applicationContext-projectName.xml for editing and change the following lines substituting your short project acronym for projectName.
    There are 3 occurances of projectNamethat have to be changed.

    <import resource="classpath*:applicationContext-projectName-component-scan.xml" />
    <import resource="classpath*:applicationContext-projectName-config.xml" />
    <import resource="classpath*:applicationContext-projectName-security-spring.xml" />
    

    When you have made all the changes, the lines you have changed should look similar to the following:

    <import resource="classpath*:applicationContext-att-component-scan.xml" />
    <import resource="classpath*:applicationContext-att-config.xml" />
    <import resource="classpath*:applicationContext-att-security-spring.xml" />
    

    In the above example, my short project acronym was att so i replaced projectName with att.*.
    When you are satisifed with the changes, save and close the file.

  6. Open the servlet.xml for editing and change the following lines substituting your short project acronym for projectName.
    There is 1 occurance of projectNamethat has to be changed.

    <context:component-scan base-package="edu.mit.projectName.web">
    

    When you have made the change, the line you have changed should look similar to the following:

    <context:component-scan base-package="edu.mit.att.web">
    

    In the above example, my short project acronym was att so I replaced projectName with att.*.
    When you are satisifed with the changes, save and close the file.

  7. From the Project Explorer View, rename each of the following files, substituting your short project acronym for projectName.
    There are 4 files that have to be renamed.

    applicationContext-projectName-component-scan.xml
    applicationContext-projectName-config.xml
    applicationContext-projectName-security-spring.xml
    applicationContext-projectName.xml
    

    When you have made all the changes, the file names that you have changed should look similar to the following:

    applicationContext-att-component-scan.xml
    applicationContext-att-config.xml
    applicationContext-att-security-spring.xml
    applicationContext-att.xml
    

    In the above example, my short project acronym was att so I replaced projectName with att.*.
    Your Project Explorer Viewshould look similar to the following:

    ${renderedContent}
  8. In the Project Explorer View, expand src/main/java.
    Rename the edu.mit.projectName.web package, substituting your short project acronym for projectName.
    Your Project Explorer Viewshould look similar to the following:

    ${renderedContent}
  9. In the Project Explorer View, expand src/test/resources.
    Open the applicationContext-csf-unit-tests-default.xml for editing and change the following lines substituting your project name for projectName.
    There are 3 occurances of projectNamethat have to be changed.

    <import resource="classpath*:applicationContext-csf-projectName.xml" />
    <import resource="classpath*:applicationContext-projectName.xml" />
    <import resource="classpath*:applicationContext-projectName-config-test.xml" />
    

    When you have made all the changes, the lines you have changed should look similar to the following:

    <import resource="classpath*:applicationContext-csf-att.xml" />
    <import resource="classpath*:applicationContext-att.xml" />
    <import resource="classpath*:applicationContext-att-config-test.xml" />
    

    In the above example, my short project acronym was att so I replaced projectName with att.*.
    When you are satisifed with the changes, save and close the file.

  10. In the Project Explorer View, expand src/test/resources.
    Open the applicationContext-projectName-config-test.xml for editing and change the following lines substituting your project name for projectName.
    There are 2 occurances of projectNamethat have to be changed.

    <value>classpath:projectName-test.properties</value>
    <value>classpath:projectName-test.properties</value>
    

    When you have made all the changes, the lines you have changed should look similar to the following:

    <value>classpath:att-test.properties</value>
    <value>classpath:att-test.properties</value>
    

    In the above example, my short project acronym was att so I replaced projectName with att.*.
    When you are satisifed with the changes, save and close the file.

  11. From the Project Explorer View, rename the following file, substituting your short project acronym for projectName.
    There are 2 files that have to be renamed.

    applicationContext-projectName-config-test.xml
    projectName-test.properties
    

    When you have made all the changes, the file names that you have changed should look similar to the following:

    applicationContext-att-config-test.xml
    att-test.properties
    

    In the above example, my short project acronym was att so I replaced projectName with att.*.

  12. In the Project Explorer View, expand src/main/webapp/WEB-INF.
    Open the web.xml for editing and change the following lines substituting your short project acronym for projectName.

    • There are 7 occurances of projectNamethat have to be changed.

      <display-name>projectName</display-name>
      classpath*:applicationContext-csf-projectName.xml,	
      classpath*:applicationContext-projectName.xml
      <servlet-name>projectName</servlet-name>
      <servlet-name>projectName</servlet-name>
      <servlet-name>projectName</servlet-name>
      <servlet-name>projectName</servlet-name>
      

      When you have made all the changes, the lines you have changed should look similar to the following:

      <display-name>att</display-name>
      classpath*:applicationContext-csf-att.xml,	
      classpath*:applicationContext-att.xml
      <servlet-name>att</servlet-name>
      <servlet-name>att</servlet-name>
      <servlet-name>att</servlet-name>
      <servlet-name>att</servlet-name>
      

      In the above example, my short project acronym was att so I replaced projectName with att.*.

    • Find the following line and change MitsisDSfor your project's JNDI name.

      <res-ref-name>jdbc/MitsisDS</res-ref-name>
      


      When you are satisifed with the changes, save and close the file.

  13. Commit all changes to the SVN repository.

Customizing the project WAR is now complete.

Section 3: Customizing the project WAR pom.xml

${renderedContent}
  1. Run Eclipse.  From the Project Explorer View, open the Maven WAR project that you want to customize.
    Expand your project and open the project's pom.xml for editing.
    Select the pom.xml tab.
    You should have a display similar to the following panel.  From time to time the war-template is updated and, as a result, the Configuration Instructionsare changed.  The instructions found in the pom.xml will ALWAYS be up-to-date and may differ from what is display in the panel below.

    ${renderedContent}

    Follow the Configuration Instructions that are provided in the pom.xml.
    When you are satisfied with the changes that you have made, save the changes and close the file.

  2. Commit the changes to the SVN repository.

Customizing the project WAR pom.xml is now complete.

Section 4: One final thing to do

There may have been changes made to the WAR template that are not reflected in the above documentation.
The final task that must be done is to search the entire project for any occurance of projectName.
Open any file that contain projectName for editing and change projectName to your short project acronym.

One final thing to do is now complete.

  • No labels